-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Creates a minimal function to change prim properties #4337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Creates a minimal function to change prim properties #4337
Conversation
Greptile SummaryReplaces Kit's Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Client Code
participant NewFunc as change_prim_property()
participant USD as USD Stage/Prim
Note over Client,USD: Property Change Flow
Client->>NewFunc: change_prim_property(prop_path, value, stage, ...)
NewFunc->>NewFunc: Get stage handle (if not provided)
NewFunc->>NewFunc: Convert prop_path to Sdf.Path
NewFunc->>NewFunc: Extract prim_path from prop_path
NewFunc->>USD: GetPrimAtPath(prim_path)
USD-->>NewFunc: Return prim (or invalid)
alt Prim invalid
NewFunc-->>Client: Raise ValueError
end
NewFunc->>USD: GetPropertyAtPath(prop_path)
USD-->>NewFunc: Return property (or None)
alt Property doesn't exist
alt type_to_create_if_not_exist provided
NewFunc->>USD: CreateAttribute(name, type, is_custom)
USD-->>NewFunc: Return new property
else No type provided
NewFunc-->>Client: Return False (log error)
end
end
alt value is None
NewFunc->>USD: property.Clear()
else value provided
NewFunc->>USD: property.Set(value, timecode)
end
NewFunc-->>Client: Return True (success)
|
matthewtrepte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
Description
This MR introduces a simplified version of the
ChangePrimPropertycommand.The original command is designed to handle complex USD layer compositions, but most of our applications do not require this level of functionality. In practice, we either do not support multiple composition layers at all, or only support limited mechanisms such as references or variants.
Using the Kit-provided command also introduces unnecessary side effects, such as early stage attachment, due to its reliance on layer-resolving APIs. To avoid this extra coupling and complexity, this MR replaces the command with a lightweight implementation tailored to our actual use cases.
Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there