clash_detect_layer_utils#

This module provides helper utilities for managing clash detection layers in USD.

Classes#

ClashDetectLayerHelper#

class omni.physxclashdetectioncore.clash_detect_layer_utils.ClashDetectLayerHelper#

Static class with clash detect layer helper methods.

This class provides methods for creating, removing, reloading, and managing clash detection layers within a USD stage.

Class Constants:

CLASH_DETECT_FORMAT: str = "clashDetection"#

Format identifier for clash detection layers.

CLASH_DETECT_LAYER_PREFIX: str = "clashdata:"#

Prefix for clash detection layer identifiers.

CLASH_LAYER_IDENTIFIER: str = "clashdata:clashDetection"#

Full identifier for clash detection layers.

Methods:

classmethod create_new_clash_detect_layer(
stage: Usd.Stage,
layer_path_name: str,
) Sdf.Layer | None#

Creates a new clash detection layer.

Parameters:
  • stage (Usd.Stage) – The USD stage to which the layer is added.

  • layer_path_name (str) – The path name for the new layer.

Returns:

The created clash detection layer, or None on failure.

Return type:

Optional[Sdf.Layer]

classmethod get_sublayer_position_in_parent(
parent_layer_identifier,
layer_identifier,
) int#

Returns the position of a sublayer within its parent layer.

Parameters:
  • parent_layer_identifier (str) – The identifier of the parent layer.

  • layer_identifier (str) – The identifier of the sublayer.

Returns:

Position of the sublayer, or -1 if not found.

Return type:

int

static remove_sublayer(layer: Sdf.Layer, position: int) str | None#

Removes a sublayer from a specified position.

Parameters:
  • layer (Sdf.Layer) – The layer from which to remove the sublayer.

  • position (int) – The position of the sublayer to remove.

Returns:

Identifier of the removed sublayer, or None if removal failed.

Return type:

Optional[str]

classmethod remove_layer(root_layer, layer_identifier) bool#

Removes a layer identified by layer_identifier from the root layer.

Parameters:
  • root_layer (Sdf.Layer) – The root layer from which to remove the layer.

  • layer_identifier (str) – The identifier of the layer to remove.

Returns:

True if the layer was removed, False otherwise.

Return type:

bool

classmethod reload_layer(layer: Sdf.Layer) bool#

Reloads the specified layer.

Parameters:

layer (Sdf.Layer) – The layer to reload.

Returns:

True if the layer was successfully reloaded, False otherwise.

Return type:

bool

classmethod find_clash_detect_layer(layer_path_name: str) Sdf.Layer | None#

Returns the clash detection layer identified by path.

Parameters:

layer_path_name (str) – The path name of the clash detection layer.

Returns:

The found clash detection layer, or None if not found.

Return type:

Optional[Sdf.Layer]

classmethod get_custom_layer_data(layer) Dict[Any, Any] | None#

Returns custom data of a layer as a dictionary.

Parameters:

layer (Sdf.Layer) – The layer from which to get custom data.

Returns:

The custom data of the layer, or None if not found.

Return type:

Optional[Dict[Any, Any]]

classmethod set_custom_layer_data(
layer: Sdf.Layer,
d: Dict[Any, Any] | None,
) None#

Sets custom data for a layer using a dictionary.

Parameters:
  • layer (Sdf.Layer) – The layer for which to set custom data.

  • d (Optional[Dict[Any, Any]]) – The custom data to set.

classmethod kit_remove_layer(stage: Usd.Stage, layer_identifier: str) bool#

Removes a layer using a Kit command, ensuring the Layer Widget is aware.

Parameters:
  • stage (Usd.Stage) – The USD stage from which to remove the layer.

  • layer_identifier (str) – The identifier of the layer to remove.

Returns:

True if the layer was successfully removed, False otherwise.

Return type:

bool