Clash Detect Layer Helper Utils
Overview
The file clash_detect_layer_utils.py contains a static class ClashDetectLayerHelper with helper methods for clash detection layers.
ClashDetectLayerHelper Class
- class ClashDetectLayerHelper
A static class with helper methods for clash detection layers.
Constants
- CLASH_DETECT_FORMAT
The file format for clash detection layers.
- CLASH_DETECT_LAYER_PREFIX
The prefix for clash detection layer identifiers.
- CLASH_LAYER_IDENTIFIER
The full identifier for clash detection layers.
Methods
- create_new_clash_detect_layer(stage: Usd.Stage, layer_path_name: str) Optional[Sdf.Layer]
Creates a new clash detection layer.
- Parameters
stage (Usd.Stage) – The USD stage where the layer will be created.
layer_path_name (str) – The path name for the layer. If None, the layer is created only in memory.
- Returns
The newly created layer, or None on failure.
- get_sublayer_position_in_parent(parent_layer_identifier, layer_identifier) int
Returns the position of a layer within its parent.
- Parameters
parent_layer_identifier (str) – The identifier of the parent layer.
layer_identifier (str) – The identifier of the layer to find.
- Returns
The position of the layer, or -1 if not found.
- remove_sublayer(layer: Sdf.Layer, position: int) Optional[str]
Removes a sublayer from the specified position.
- Parameters
layer (Sdf.Layer) – The layer from which to remove the sublayer.
position (int) – The position of the sublayer to remove.
- Returns
The identifier of the removed layer, or None if the operation fails.
- remove_layer(root_layer, layer_identifier) bool
Removes a layer identified by layer_identifier from root_layer.
- Parameters
root_layer (Sdf.Layer) – The root layer from which to remove the sublayer.
layer_identifier (str) – The identifier of the layer to remove.
- Returns
True if the layer was removed successfully, False otherwise.
- reload_layer(layer: Sdf.Layer) bool
Reloads the specified layer.
- Parameters
layer (Sdf.Layer) – The layer to reload.
- Returns
True if the layer was reloaded successfully, False otherwise.
- find_clash_detect_layer(layer_path_name: str) Optional[Sdf.Layer]
Finds a clash detection layer by its path.
- Parameters
layer_path_name (str) – The path name of the layer to find.
- Returns
The layer if found, None otherwise.
- get_custom_layer_data(layer) Optional[Dict[Any, Any]]
Returns the custom data of a layer as a dictionary.
- Parameters
layer (Sdf.Layer) – The layer from which to get the custom data.
- Returns
The custom data dictionary, or None if the layer is invalid.
- set_custom_layer_data(layer: Sdf.Layer, d: Optional[Dict[Any, Any]]) None
Sets the custom data of a layer using a dictionary.
- Parameters
layer (Sdf.Layer) – The layer for which to set the custom data.
d (Dict[Any, Any]) – The dictionary containing the custom data.
- Returns
None
- kit_remove_layer(stage: Usd.Stage, layer_identifier: str) bool
Removes a layer using a Kit command so that 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 removed successfully, False otherwise.