Skip to content

Conversation

Licini
Copy link

@Licini Licini commented Jul 3, 2025

add support to convert a compas scene to a usd stage.
plz see example added at scripts/scene.py

@Licini Licini requested review from romanarust and tomvanmele July 3, 2025 12:36
Comment on lines +61 to +65
transformation = (
sceneobject.transformation
if sceneobject.transformation is not None
else Transformation()
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit convoluted syntax, why not plain:

Suggested change
transformation = (
sceneobject.transformation
if sceneobject.transformation is not None
else Transformation()
)
transformation = sceneobject.transformation
if transformation is None:
transformation = Transformation()

else Transformation()
)

prim = prim_from_transformation(stage, "/" + "/".join(path), transformation)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this path concat using / work on Windows also?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we not use pathlib or at least os.path for this?

return prim


def prim_from_item(stage: Usd.Stage, item: Data, parent_path=[]) -> Usd.Prim:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use [] empty list as default arg value, this has nasty consequences.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parent_path = parent_path or []

Comment on lines +96 to +101
if isinstance(item, Box):
prim = prim_from_box(stage, "/" + "/".join(path), item)
elif isinstance(item, Sphere):
prim = prim_from_sphere(stage, "/" + "/".join(path), item)
elif isinstance(item, Mesh):
prim = prim_from_mesh(stage, "/" + "/".join(path), item)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question about whether these paths using the unix slash work on Windows.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about using pathlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants