Commit 0396cf07 authored by Mayank Mittal's avatar Mayank Mittal

Fixes issue with setting the ground plane color

parent aa220dbc
...@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING ...@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
import carb import carb
import omni.isaac.core.utils.prims as prim_utils import omni.isaac.core.utils.prims as prim_utils
from omni.isaac.version import get_version
import omni.kit.commands import omni.kit.commands
from pxr import Gf, Sdf, Usd from pxr import Gf, Sdf, Usd
...@@ -219,9 +220,18 @@ def spawn_ground_plane(prim_path: str, cfg: from_files_cfg.GroundPlaneCfg, **kwa ...@@ -219,9 +220,18 @@ def spawn_ground_plane(prim_path: str, cfg: from_files_cfg.GroundPlaneCfg, **kwa
# Change the color of the plane # Change the color of the plane
# Warning: This is specific to the default grid plane asset. # Warning: This is specific to the default grid plane asset.
if cfg.color is not None: if cfg.color is not None:
# obtain isaac sim version
isaac_sim_version = int(get_version()[2])
# check the property name based on isaac sim version
if isaac_sim_version == 2022:
prop_path = f"{prim_path}/Looks/theGrid.inputs:diffuse_tint"
else:
prop_path = f"{prim_path}/Looks/theGrid/Shader.inputs:diffuse_tint"
# change the color
print("Changing color to: ", cfg.color, prop_path)
omni.kit.commands.execute( omni.kit.commands.execute(
"ChangePropertyCommand", "ChangePropertyCommand",
prop_path=Sdf.Path(f"{prim_path}/Looks/theGrid.inputs:diffuse_tint"), prop_path=Sdf.Path(prop_path),
value=Gf.Vec3d(*cfg.color), value=Gf.Vec3d(*cfg.color),
prev=None, prev=None,
type_to_create_if_not_exist=Sdf.ValueTypeNames.Color3f, type_to_create_if_not_exist=Sdf.ValueTypeNames.Color3f,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment