MCPcopy Create free account
hub / github.com/BeingBeyond/BeTTER / _default_scale_reader

Function _default_scale_reader

src/scene/episode_runtime.py:286–304  ·  view source on GitHub ↗
(stage: Any, prim_path: str)

Source from the content-addressed store, hash-verified

284
285
286def _default_scale_reader(stage: Any, prim_path: str) -> tuple[float, ...]:
287 from pxr import UsdGeom # type: ignore[import]
288
289 prim = stage.GetPrimAtPath(prim_path)
290 if prim is None or (hasattr(prim, "IsValid") and not prim.IsValid()):
291 raise RuntimeError(f"Invalid prim for scale read: {prim_path}")
292
293 scale = [1.0, 1.0, 1.0]
294 xformable = UsdGeom.Xformable(prim)
295 for op in xformable.GetOrderedXformOps():
296 if op.GetOpType() != UsdGeom.XformOp.TypeScale:
297 continue
298 value = op.Get()
299 if value is None:
300 continue
301 scale[0] *= float(value[0])
302 scale[1] *= float(value[1])
303 scale[2] *= float(value[2])
304 return tuple(scale)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected