Clash Detection Anim API#

The Clash Detection Anim extension (included in the Clash Detection Bundle extension) is an API that provides functionality for recording animation curves within a USD stage. It captures transform animations (translate, rotate, scale) from animated prims and saves them as time samples in a USD session layer (by default “ClashStageRecordedData” layer).

AnimRecorder#

class AnimRecorder#

A class for recording animation curves within a USD stage.

This class utilizes the ICurveAnimRecorder interface to record animation curves over a specified time range for a given set of USD prims. It supports functionalities such as starting and stopping recordings, resetting session properties, and configuring recording attributes.

Methods#

destroy()#

Releases the stage recorder interface and cleans up the recorder API.

reset_overridden_session_prim_props()#

Resets overridden session prim properties.

get_recoding_session_layer_name() str#

Gets the name of the recording session layer.

Returns:

The name of the recording session layer.

Return type:

str

run(
stage: Usd.Stage,
prims_int_path: List[int],
start_time: float,
end_time: float,
fps: float,
) Generator[float, None, None]#

Records animation curves for the given prims from start_time to end_time at the specified fps. The recording is saved to a session layer that can be accessed via get_recoding_session_layer_name(). Yields the current timeline time in seconds as recording progresses.

Parameters:
  • stage (Usd.Stage) – The USD stage containing the prims to record.

  • prims_int_path (List[int]) – List of integer prim paths to record.

  • start_time (float) – Start time in seconds.

  • end_time (float) – End time in seconds.

  • fps (float) – Frames per second for the recording.

Returns:

Yields the current time in seconds as recording progresses.

Return type:

Generator[float, None, None]

Attributes#

copy_also_unrecorded_usd_attribs_on_save#

Gets or sets whether to copy unrecorded USD attributes on save.

  • Getter: Returns True if unrecorded attributes will be copied.

  • Setter: Sets whether to copy unrecorded USD attributes on save.

Parameters:

value (bool) – If True, copies unrecorded attributes.

Usage Example#

from pxr import Usd
from omni.physxclashdetectionanim.scripts.anim_recorder import AnimRecorder

# Create a USD stage (assuming you have a valid USD file path)
stage = Usd.Stage.Open("path/to/your.usd")

# Initialize the AnimRecorder
anim_recorder = AnimRecorder()

# Define the prims to record (using integer paths)
prims_int_path = [0, 0, 0]  # Example integer paths

# Define the recording parameters
start_time = 0.0  # Start time in seconds
end_time = 10.0   # End time in seconds
fps = 24.0        # Frames per second

# Run the recording
for current_time in anim_recorder.run(stage, prims_int_path, start_time, end_time, fps):
    print(f"Recording at time: {current_time} seconds")

# Get the name of the recording session layer
session_layer_name = anim_recorder.get_recoding_session_layer_name()
print(f"Recording session layer name: {session_layer_name}")

# Clean up the recorder
anim_recorder.destroy()