Skip to content

Commit

Permalink
Fix mirroring by adding the id to the base part name, and improve the…
Browse files Browse the repository at this point in the history
… timeline by making the first timestep visible for all time prior to the start time.
  • Loading branch information
david-bremer committed Jul 11, 2024
1 parent bc75539 commit b0c95da
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ansys/pyensight/core/utils/omniverse_dsg_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,11 @@ def create_dsg_mesh_block(
diffuse=[1.0, 1.0, 1.0, 1.0],
variable=None,
timeline=[0.0, 0.0],
first_timestep=False,
):
# 1D texture map for variables https://graphics.pixar.com/usd/release/tut_simple_shading.html
# create the part usd object
partname = self.clean_name(name + str(timeline[0]))
partname = self.clean_name(name + str(id) + str(timeline[0]))
stage_name = "/Parts/" + partname + ".usd"
part_stage_url = self.stage_url(stage_name)
omni.client.delete(part_stage_url)
Expand Down Expand Up @@ -363,7 +364,10 @@ def create_dsg_mesh_block(
)
timestep_prim = UsdGeom.Xform.Define(self._stage, timestep_group_path)
visibility_attr = UsdGeom.Imageable(timestep_prim).GetVisibilityAttr()
visibility_attr.Set("invisible", Usd.TimeCode.EarliestTime())
if first_timestep:
visibility_attr.Set("inherited", Usd.TimeCode.EarliestTime())
else:
visibility_attr.Set("invisible", Usd.TimeCode.EarliestTime())
visibility_attr.Set("inherited", timeline[0])
# Final timestep has timeline[0]==timeline[1]. Leave final timestep visible.
if timeline[0] < timeline[1]:
Expand Down Expand Up @@ -685,7 +689,7 @@ def finalize_part(self, part: Part) -> None:
if command is None:
return
parent_prim = self._group_prims[command.parent_id]
obj_id = self._session.mesh_block_count
obj_id = self.session.mesh_block_count
matrix = command.matrix4x4
name = command.name
color = [
Expand All @@ -707,6 +711,7 @@ def finalize_part(self, part: Part) -> None:
diffuse=color,
variable=var_cmd,
timeline=self.session.cur_timeline,
first_timestep=(self.session.cur_timeline[0] == self.session.time_limits[0]),
)
super().finalize_part(part)

Expand Down

0 comments on commit b0c95da

Please sign in to comment.