Repository navigation
Closed
Description
Unfortunately I can't reopen #288
I still can't dowwnload physicallybased material info, despite #288 being closed
In [1]: from importlib.metadata import version
In [2]: version("mat-vis-client"), version("py-materials")
Out[2]: ('0.6.4', '3.10.0')
...
In [10]: v = Vis("physicallybased", "Aluminum")
In [11]: v.to_threejs()
---------------------------------------------------------------------------
MaterialNotStagedError Traceback (most recent call last)
Cell In[11], line 1
----> 1 v.to_threejs()
File ~/Development/CAD/build123d-fork/.venv/lib/python3.13/site-packages/pymat/vis/_model.py:576, in Vis.to_threejs(self)
567 """Shorthand for ``pymat.vis.to_threejs(material)`` — method form.
568
569 Same output as the module-level adapter. Use this when you have
(...) 572 that's explicitly function-composition oriented.
573 """
574 from pymat.vis.adapters import to_threejs
--> 576 return to_threejs(self)
File ~/Development/CAD/build123d-fork/.venv/lib/python3.13/site-packages/pymat/vis/adapters.py:86, in to_threejs(obj)
79 def to_threejs(obj: MaterialOrVis) -> dict[str, Any]:
80 """Format as a Three.js MeshPhysicalMaterial-compatible dict.
81
82 Accepts either a ``Material`` or a standalone ``Vis``. Reads PBR
83 scalars and texture maps from ``obj.vis`` (or from ``obj`` itself
84 if it's a Vis). Delegates to mat-vis's generic adapter.
85 """
---> 86 return _to_threejs(_extract_scalars(obj), _extract_textures(obj))
File ~/Development/CAD/build123d-fork/.venv/lib/python3.13/site-packages/pymat/vis/adapters.py:76, in _extract_textures(obj)
74 if not vis.has_mapping:
75 return {}
---> 76 return vis.textures
File ~/Development/CAD/build123d-fork/.venv/lib/python3.13/site-packages/pymat/vis/_model.py:531, in Vis.textures(self)
528 return {}
530 if not self._fetched:
--> 531 self._fetch()
533 return self._textures
File ~/Development/CAD/build123d-fork/.venv/lib/python3.13/site-packages/pymat/vis/_model.py:644, in Vis._fetch(self)
642 # Thin delegate — matches the ADR-0002 principle.
643 src, mid, tier = self._identity_args()
--> 644 textures = self.client.fetch_all_textures(src, mid, tier=tier)
645 # Write via super() so we don't trip the identity-invalidation
646 # guard (`_textures` and `_fetched` aren't identity fields, so
647 # direct assignment would work too; using super() documents that
648 # we're explicitly bypassing the cache-invalidation side effect).
649 super().__setattr__("_textures", textures)
File ~/Development/CAD/build123d-fork/.venv/lib/python3.13/site-packages/mat_vis_client/client.py:1343, in MatVisClient.fetch_all_textures(self, source, material_id, tier, tag)
1341 if tag is not None and tag != self._tag:
1342 return self.at(tag).fetch_all_textures(source, material_id, tier)
-> 1343 resolved = self._resolve_material_id(source, material_id, tier)
1344 chs = self.channels(source, resolved, tier)
1345 return {ch: self.fetch_texture(source, resolved, ch, tier) for ch in chs}
File ~/Development/CAD/build123d-fork/.venv/lib/python3.13/site-packages/mat_vis_client/client.py:1289, in MatVisClient._resolve_material_id(self, source, material_id, tier)
1286 return resolved
1287 # #280: the user passed a name; carry it through so the
1288 # error message names *which* material in their batch broke.
-> 1289 raise MaterialNotStagedError(
1290 source=source,
1291 material_id=resolved,
1292 tier=tier,
1293 original_name=material_id,
1294 )
1296 # Build the "available materials at this tier" hint from the
1297 # catalog. #286: prefer human names over UUIDs and surface
1298 # close-matches before the full list.
1299 staged_names = sorted(
1300 _display_name(e) for e in idx if isinstance(e, dict) and _is_staged(e) and e.get("id")
1301 )
MaterialNotStagedError: material 'Aluminum' (resolved id 'aluminum') exists in 'physicallybased' index but is not staged for tier '1k'. Needs a re-bake.Metadata
Metadata
Assignees
Labels
No labels
Activity
gerchowl commentedon May 7, 2026
Cascade fix: needs both sides to land for your repro to pass:
bake_scalar_sourceshipsavailable_tiers=["scalar"]instead of[]. One-line fetcher fix + a re-bake of physicallybased.Visdefaultstier="1k"; needs scalar-source detection soVis("physicallybased", "Aluminum")resolves totier="scalar"automatically.Both required + the mat-vis fix needs to be on the substrate the client reads (DEFAULT_TAG-pinned). Forward-verify acceptance on both children explicitly requires re-running your repro through pymat — no closing on unit tests alone.
test: pin Bernhard's open mat-vis bugs as strict xfails (#330/#331/#332/
test: pin Bernhard's open mat-vis bugs as strict xfails (#330/#331/#332/
bugfix(baker): physicallybased fetcher emits available_tiers=['scalar…
feat(client): tier becomes optional on materials() — hides 'scalar' s…
gerchowl commentedon May 11, 2026
Fixed by the combination of #379 (commit 8c73865 — baker emits
available_tiers=["scalar"]for physicallybased entries) and #371 (commit fcc9e27 — resolver acceptstier="scalar"). Live verified ongerchowl/[email protected]:VisAsset("physicallybased", "Aluminum").scalarsyields the full PBR dict;fetch_all_textures(..., tier="scalar")returns{}cleanly. End-to-end coverage inbake/preview/tests/layered/test_layered_isolation.py.test: pin Bernhard's open mat-vis bugs as strict xfails (#330/#331/#332/
bugfix(baker): physicallybased fetcher emits available_tiers=['scalar…
feat(client): tier becomes optional on materials() — hides 'scalar' s…