Skip to content

Commit

Permalink
Improve OV time controls (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-bremer authored Aug 19, 2024
1 parent d12d735 commit 30770de
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/ansys/pyensight/core/utils/omniverse_dsg_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def __init__(
self._live_edit: bool = live_edit
if self._live_edit:
self._stagename = "dsg_scene.live"
# USD time slider will have 120 tick marks per second of animation time
self._time_codes_per_second = 120.0
OmniverseWrapper.verbose = verbose

omni.client.set_log_callback(OmniverseWrapper.logCallback)
Expand Down Expand Up @@ -381,10 +383,10 @@ def add_timestep_group(
visibility_attr.Set("inherited", Usd.TimeCode.EarliestTime())
else:
visibility_attr.Set("invisible", Usd.TimeCode.EarliestTime())
visibility_attr.Set("inherited", timeline[0])
visibility_attr.Set("inherited", timeline[0] * self._time_codes_per_second)
# Final timestep has timeline[0]==timeline[1]. Leave final timestep visible.
if timeline[0] < timeline[1]:
visibility_attr.Set("invisible", timeline[1])
visibility_attr.Set("invisible", timeline[1] * self._time_codes_per_second)
return timestep_prim

def create_dsg_points(
Expand Down Expand Up @@ -647,10 +649,13 @@ def add_group(self, id: int, view: bool = False) -> None:
self._group_prims[id] = self._root_prim

if self._omni._stage is not None:
self._omni._stage.SetStartTimeCode(self.session.time_limits[0])
self._omni._stage.SetEndTimeCode(self.session.time_limits[1])
self._omni._stage.SetTimeCodesPerSecond(1)
self._omni._stage.SetFramesPerSecond(1)
self._omni._stage.SetStartTimeCode(
self.session.time_limits[0] * self._omni._time_codes_per_second
)
self._omni._stage.SetEndTimeCode(
self.session.time_limits[1] * self._omni._time_codes_per_second
)
self._omni._stage.SetTimeCodesPerSecond(self._omni._time_codes_per_second)

# Send the variable textures. Safe to do so once the first view is processed.
if not self._sent_textures:
Expand Down

0 comments on commit 30770de

Please sign in to comment.