Clash Data

Overview

The file clash_data.py defines a class that is designed to manage clash detection data USD layer.

ClashData Class

class ClashData

The ClashData class is designed to manage clash detection data within a USD (Universal Scene Description) stage. It handles serialization of clash data, layer management, and event handling related to sublayers changes.

Constants

CLASH_DATA_LAYER_FILE_EXT

File extension for clash detection layer files. Default value is “.clashDetection”.

CLASH_DATA_FILE_EXT

File extension for clash data files. Default value is “.clashdata”.

CLASH_DATA_LAYER_CUSTOM_CLASH_DB_PATH

Key for custom clash database path in layer metadata. Default value is “clashDbPath”.

CLASH_DATA_LAYER_CUSTOM_MODIFIED

Key indicating if the clash data layer has been modified. Default value is “clashDbModified”.

Constructor

__init__(clash_data_serializer: AbstractClashDataSerializer)

Initializes a new instance of the ClashData class.

Parameters

clash_data_serializer – An instance of AbstractClashDataSerializer implementation used for serializing clash data.

Methods

destroy()

Cleans up resources and subscriptions.

open(stage_id: Optional[int], force_reload_layer: bool = False)

Creates a file or opens an existing one based on the provided stage ID.

Parameters
  • stage_id – Stage ID of the stage to work with.

  • force_reload_layer – Force reload target layer, ensuring it doesn’t come from the stage cache.

save() bool

Saves data to the target file.

Returns

Returns True if successful else False.

save_as(usd_file_path: str) bool

Saves data to a new target file before the stage is finally saved.

Parameters

usd_file_path – The file path of the USD stage.

Returns

Returns True if successful else False.

close()

Closes the opened file.

commit()

Writes any unwritten data to the file.

Properties

stage_id: Optional[int]

Read-only property that returns the associated stage ID.

stage: Optional[Usd.Stage]

Read-only property that returns the associated USD stage.

usd_file_path: str

Read-only property that returns the file path of the USD stage.

serializer_path: str

Read-only property that returns the file path used by the serializer.

data_structures_compatible: bool

Read-only property that returns True if the serializer has no compatibility issues (data structures, tables).

deferred_file_creation_until_first_write_op: bool

Read-only property that returns True if the serializer will postpone file creation until first write op is requested.

The class also implements serializer data operations by calling appropriate methods on provided serializer.