-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Newton RGB default fixes #5168
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: develop
Are you sure you want to change the base?
Newton RGB default fixes #5168
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -234,13 +234,19 @@ def spawn_ground_plane( | |||||||||||||||||||||||||||
| # Change the color of the plane | ||||||||||||||||||||||||||||
| # Warning: This is specific to the default grid plane asset. | ||||||||||||||||||||||||||||
| if cfg.color is not None: | ||||||||||||||||||||||||||||
| # change the color | ||||||||||||||||||||||||||||
| # change the color on the visual grid shader | ||||||||||||||||||||||||||||
| change_prim_property( | ||||||||||||||||||||||||||||
| prop_path=f"{prim_path}/Looks/theGrid/Shader.inputs:diffuse_tint", | ||||||||||||||||||||||||||||
| value=Gf.Vec3f(*cfg.color), | ||||||||||||||||||||||||||||
| stage=stage, | ||||||||||||||||||||||||||||
| type_to_create_if_not_exist=Sdf.ValueTypeNames.Color3f, | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
| # Also set displayColor on the collision plane so non-RTX renderers | ||||||||||||||||||||||||||||
| # (e.g. Newton) can pick up the configured color. | ||||||||||||||||||||||||||||
| if collision_prim is not None: | ||||||||||||||||||||||||||||
| UsdGeom.Gprim(collision_prim).CreateDisplayColorAttr().Set( | ||||||||||||||||||||||||||||
| [Gf.Vec3f(*cfg.color)] | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
|
Comment on lines
+246
to
+249
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Alternatively, initialise
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They clearly copied their homework... |
||||||||||||||||||||||||||||
| # Remove the light from the ground plane (USD API, works without Kit/Newton) | ||||||||||||||||||||||||||||
| # It isn't bright enough and messes up with the user's lighting settings | ||||||||||||||||||||||||||||
| light_prim = stage.GetPrimAtPath(f"{prim_path}/SphereLight") | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
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.
Bug:
NameErrorwhencfg.physics_material is Nonecollision_primis only assigned inside theif cfg.physics_material is not None:block (~line 214). If a caller setsphysics_material=None, the variable is never bound, and this line raisesNameError— theif collision_prim is not Noneguard doesn't help because the name itself doesn't exist.While the default
GroundPlaneCfgsetsphysics_material=RigidBodyMaterialCfg()(non-None), this is a public API — callers can and do override defaults. The simplest fix: look up the collision prim independently here rather than relying on the physics-material block's side effect:This is slightly more robust than
collision_prim = Noneat function top, because it also works if the physics-material block raises and is caught elsewhere.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.
@nblauch the bot has a good point here.