Timeline#

class omni.timeline.Timeline#

Bases: pybind11_object

Defines a timeline controller.

Methods

__init__(*args, **kwargs)

clear_tentative_time(self)

Clear tentative time of animation in seconds.

clear_zoom(self)

Clears the zoom state, i.e. sets the zoom range to [get_start_time(), get_end_time()].

commit(self)

Applies all pending state changes and invokes all callbacks.

commit_silently(self)

Applies all pending state changes but does not invoke any callbacks.

forward_one_frame(self)

Forwards the timeline by one frame.

get_current_tick(self)

Gets the current tick index, starting from zero.

get_current_time(self)

Gets current time of animation in seconds.

get_director(self)

Returns the current director Timeline.

get_end_time(self)

Gets the end time of animation in seconds.

get_event_key(self)

Retrieves the event key that can be used as the `filter` argument to IEventDispatcher.observe_event().

get_fast_mode(self)

Checks if fast mode is on or off.

get_play_every_frame(self)

Checks if the timeline sends updates every frame.

get_start_time(self)

Gets the start time of animation in seconds.

get_target_framerate(self)

Gets the target frame rate, which affects the derived FPS of the runloop in play mode.

get_tentative_time(self)

Gets tentative time of animation in seconds.

get_ticks_per_frame(self)

Gets the tick count per frame, i.e. how many times update event is ticked per frame.

get_ticks_per_second(self)

Gets the tick count per seconds, i.e. how many times update event is ticked per second.

get_time_codes_per_second(self)

Gets timeCodePerSecond metadata from currently opened stage.

get_time_codes_per_seconds(self)

Gets timeCodePerSecond metadata from currently opened stage.

get_timeline_event_stream(self)

Gets TimelineEventStream, emitting TimelineEventType.

get_zoom_end_time(self)

Gets the end time of zoomed animation in seconds.

get_zoom_start_time(self)

Gets the start time of zoomed animation in seconds.

is_auto_updating(self)

Checks if timeline is auto updating.

is_looping(self)

Checks if animation is looping.

is_playing(self)

Checks if animation is playing.

is_prerolling(self)

Checks if timeline is prerolling.

is_stopped(self)

Checks if animation is stopped, as opposed to paused.

is_zoomed(self)

Returns whether a zoom is set, i.e. whether the zoom range is not the entire

pause(self)

Pauses animation.

play(self[, start_timecode, end_timecode, ...])

Plays animation with current timeCodePerSecond.

rewind_one_frame(self)

Rewinds the timeline by one frame.

set_auto_update(self, auto_update)

Turns on/off auto update.

set_current_time(self, time_in_seconds)

Sets current time of animation in seconds.

set_director(self, timeline)

Sets a director Timeline.

set_end_time(self, end_time)

Sets the end time of animation in seconds.

set_fast_mode(self, fast_mode)

Turns fast mode on or off.

set_looping(self, looping)

Sets animation looping mode.

set_play_every_frame(self, play_every_frame)

Turns frame skipping off (true) or on (false).

set_prerolling(self, preroll)

Turns on/off preroll status.

set_start_time(self, start_time)

Sets the begin time of animation in seconds.

set_target_framerate(self, target_framerate)

Sets the target frame rate, which affects the derived FPS of the runloop in play mode.

set_tentative_time(self, time_in_seconds)

Sets tentative time of animation in seconds.

set_ticks_per_frame(self, ticks_per_frame)

Sets the tick count per frame, i.e. how many times update event is ticked per frame.

set_time_codes_per_second(self, ...)

Sets timeCodePerSecond metadata to currently opened stage.

set_zoom_range(self, start_time, end_time)

Sets the zoom range, i.e. the playback interval.

stop(self)

Stops animation.

time_code_to_time(self, arg0)

Converts time codes to seconds, w.r.t.

time_to_time_code(self, arg0)

Converts time in seconds to time codes, w.r.t.

__init__(*args, **kwargs)#
clear_tentative_time(
self: omni.timeline._timeline.Timeline,
) None#

Clear tentative time of animation in seconds.

Clear/Invalidate the tentative time

clear_zoom(self: omni.timeline._timeline.Timeline) None#

Clears the zoom state, i.e. sets the zoom range to [get_start_time(), get_end_time()].

commit(self: omni.timeline._timeline.Timeline) None#

Applies all pending state changes and invokes all callbacks.

This method is not thread-safe, it should be called only from the main thread.

commit_silently(
self: omni.timeline._timeline.Timeline,
) None#

Applies all pending state changes but does not invoke any callbacks.

This method is thread-safe.

forward_one_frame(
self: omni.timeline._timeline.Timeline,
) None#

Forwards the timeline by one frame.

get_current_tick(
self: omni.timeline._timeline.Timeline,
) int#

Gets the current tick index, starting from zero. Always returns zero when ticks per frame is one.

Returns:

The current tick index.

get_current_time(
self: omni.timeline._timeline.Timeline,
) float#

Gets current time of animation in seconds.

Returns:

Current time of animation in seconds.

get_director(
self: omni.timeline._timeline.Timeline,
) omni.timeline._timeline.Timeline#

Returns the current director Timeline.

Returns:

The director timeline object or None if none is set.

get_end_time(self: omni.timeline._timeline.Timeline) float#

Gets the end time of animation in seconds.

End time means no frames can start strictly after this time point. When start and end time define an integer number of frames, end time is the end of the last animation frame.

Returns:

End time of animation in seconds.

get_event_key(self: omni.timeline._timeline.Timeline) dict#

Retrieves the event key that can be used as the `filter` argument to IEventDispatcher.observe_event().

get_fast_mode(self: omni.timeline._timeline.Timeline) bool#

Checks if fast mode is on or off. Deprecated, same as get_play_every_frame.

Returns:

true is fast mode is on.

get_play_every_frame(
self: omni.timeline._timeline.Timeline,
) bool#

Checks if the timeline sends updates every frame. Same as get_fast_mode.

Returns:

true if the timeline does not skip frames.

get_start_time(
self: omni.timeline._timeline.Timeline,
) float#

Gets the start time of animation in seconds.

Start time is defined as the beginning of the first frame.

Returns:

Start time of animation in seconds.

get_target_framerate(
self: omni.timeline._timeline.Timeline,
) float#

Gets the target frame rate, which affects the derived FPS of the runloop in play mode. Exact runloop FPS is usually not the same as this value, as it is always a multiple of get_time_codes_per_seconds.

Returns:

The target frame rate.

get_tentative_time(
self: omni.timeline._timeline.Timeline,
) float#

Gets tentative time of animation in seconds.

Returns:

Tentative time of animation if it is valid, otherwise return current time

get_ticks_per_frame(
self: omni.timeline._timeline.Timeline,
) int#

Gets the tick count per frame, i.e. how many times update event is ticked per frame.

Returns:

The tick per frame count.

get_ticks_per_second(
self: omni.timeline._timeline.Timeline,
) float#

Gets the tick count per seconds, i.e. how many times update event is ticked per second.

Returns:

The tick per second count.

get_time_codes_per_second(
self: omni.timeline._timeline.Timeline,
) float#

Gets timeCodePerSecond metadata from currently opened stage. This is equivalent to calling GetTimeCodesPerSecond on UsdStage.

Returns:

timeCodePerSecond for current UsdStage.

get_time_codes_per_seconds(
self: omni.timeline._timeline.Timeline,
) float#

Gets timeCodePerSecond metadata from currently opened stage. This is equivalent to calling GetTimeCodesPerSecond on UsdStage.

This function is same as get_time_codes_per_second but incorrectly named. Kept for backwards compatibility.

Returns:

timeCodePerSecond for current UsdStage.

get_timeline_event_stream(
self: omni.timeline._timeline.Timeline,
) carb::events::IEventStream#

Gets TimelineEventStream, emitting TimelineEventType.

Returns:

TimelineEventStream.

get_zoom_end_time(
self: omni.timeline._timeline.Timeline,
) float#

Gets the end time of zoomed animation in seconds.

Returns:

End time of zoomed animation in seconds. When no zoom is set, this function returns get_end_time().

get_zoom_start_time(
self: omni.timeline._timeline.Timeline,
) float#

Gets the start time of zoomed animation in seconds.

Returns:

Start time of zoomed animation in seconds. When no zoom is set, this function returns get_start_time().

is_auto_updating(
self: omni.timeline._timeline.Timeline,
) bool#

Checks if timeline is auto updating.

Returns:

True if timeline is auto updating. False otherwise.

is_looping(self: omni.timeline._timeline.Timeline) bool#

Checks if animation is looping.

Returns:

True if animation is looping. False otherwise.

is_playing(self: omni.timeline._timeline.Timeline) bool#

Checks if animation is playing.

Returns:

True if animation is playing. False otherwise.

is_prerolling(self: omni.timeline._timeline.Timeline) bool#

Checks if timeline is prerolling.

Returns:

True if timeline is prerolling. False otherwise.

is_stopped(self: omni.timeline._timeline.Timeline) bool#

Checks if animation is stopped, as opposed to paused.

Returns:

True if animation is stopped. False otherwise.

is_zoomed(self: omni.timeline._timeline.Timeline) bool#
Returns whether a zoom is set, i.e. whether the zoom range is not the entire

[getStartTime(), getEndTime()] interval.

Returns:

True if get_start_time() < get_zoom_start_time() or get_zoom_end_time() < get_end_time() (note that “<=” always holds). False otherwise.

pause(self: omni.timeline._timeline.Timeline) None#

Pauses animation.

play(
self: omni.timeline._timeline.Timeline,
start_timecode: float = 0,
end_timecode: float = 0,
looping: bool = True,
) None#

Plays animation with current timeCodePerSecond. if not set session start and end timecode, will play from global start time to end time in stage.

Parameters:
  • start_timecode – start timecode of session play, won’t change the global StartTime.

  • end_timecode – start timecode of session play, won’t change the global EndTime.

  • looping – true to enable session play looping, false to disable, won’t change the global Looping.

rewind_one_frame(
self: omni.timeline._timeline.Timeline,
) None#

Rewinds the timeline by one frame.

set_auto_update(
self: omni.timeline._timeline.Timeline,
auto_update: bool,
) None#

Turns on/off auto update.

Parameters:

auto_update – True to enable auto update, False to disable.

set_current_time(
self: omni.timeline._timeline.Timeline,
time_in_seconds: float,
) None#

Sets current time of animation in seconds.

Parameters:

seconds. (time_in_seconds Current time of animation in)

set_director(
self: omni.timeline._timeline.Timeline,
timeline: omni.timeline._timeline.Timeline,
) None#

Sets a director Timeline.

When a director is set, the timeline mimics its behavior and any

state changing call from all other sources are ignored.

Parameters:

timeline – The timeline object to be set as the director. Pass None to clear the current director.

set_end_time(
self: omni.timeline._timeline.Timeline,
end_time: float,
) None#

Sets the end time of animation in seconds. This will write into current opened stage.

The call enforces the time interval defined by start and end times to be at least one frame long.

Parameters:

end_time – End time of animation in seconds.

set_fast_mode(
self: omni.timeline._timeline.Timeline,
fast_mode: bool,
) None#

Turns fast mode on or off. Deprecated, same as set_play_every_frame.

Parameters:
  • mode (fast_mode true to turn on fast)

  • off. (false to turn it)

set_looping(
self: omni.timeline._timeline.Timeline,
looping: bool,
) None#

Sets animation looping mode.

Parameters:

looping – True to enable looping, False to disable.

set_play_every_frame(
self: omni.timeline._timeline.Timeline,
play_every_frame: bool,
) None#

Turns frame skipping off (true) or on (false). Same as set_fast_mode.

Parameters:

off. (play_every_frame true to turn frame skipping)

set_prerolling(
self: omni.timeline._timeline.Timeline,
preroll: bool,
) None#

Turns on/off preroll status.

Parameters:

preroll – True to enable preroll, False to disable.

set_start_time(
self: omni.timeline._timeline.Timeline,
start_time: float,
) None#

Sets the begin time of animation in seconds. This will write into current opened stage.

The call enforces the time interval defined by start and end times to be at least one frame long.

Parameters:

start_time – Begin time of animation in seconds.

set_target_framerate(
self: omni.timeline._timeline.Timeline,
target_framerate: float,
) None#

Sets the target frame rate, which affects the derived FPS of the runloop in play mode. Exact runloop FPS is usually not the same as this value, as it is always a multiple of get_time_codes_per_seconds.

Parameters:

rate. (target_framerate The target frame)

set_tentative_time(
self: omni.timeline._timeline.Timeline,
time_in_seconds: float,
) None#

Sets tentative time of animation in seconds.

Parameters:

seconds. (time_in_seconds Tentative time of animation in)

set_ticks_per_frame(
self: omni.timeline._timeline.Timeline,
ticks_per_frame: int,
) None#

Sets the tick count per frame, i.e. how many times update event is ticked per frame.

Parameters:

ticks_per_frame – The tick per frame count.

set_time_codes_per_second(
self: omni.timeline._timeline.Timeline,
time_codes_per_second: float,
) None#

Sets timeCodePerSecond metadata to currently opened stage. This is equivalent to calling SetTimeCodesPerSecond on UsdStage.

Parameters:

time_codes_per_second – TimeCodePerSecond to set into current stage.

set_zoom_range(
self: omni.timeline._timeline.Timeline,
start_time: float,
end_time: float,
) None#

Sets the zoom range, i.e. the playback interval. Values are truncated to the [get_start_time(), get_end_time()] interval, which is also the default range. A minimum of one frame long range is enforced.

Parameters:
  • start_time – Start time of zoom in seconds. Must be less or equal than end_time.

  • end_time – End time of zoom in seconds. Must be greater or equal than start_time.

stop(self: omni.timeline._timeline.Timeline) None#

Stops animation.

time_code_to_time(
self: omni.timeline._timeline.Timeline,
arg0: float,
) float#

Converts time codes to seconds, w.r.t. the current timeCodesPerSecond setting of the timeline.

Returns:

The converted time code.

time_to_time_code(
self: omni.timeline._timeline.Timeline,
arg0: float,
) float#

Converts time in seconds to time codes, w.r.t. the current timeCodesPerSecond setting of the timeline.

Returns:

The converted time code.