LayersState#
- class omni.kit.usd.layers.LayersState(
- layers_instance: ILayersInstance,
- usd_context,
Bases:
object
Methods
__init__
(layers_instance, usd_context)add_auto_reload_layer
(layer_identifier)Adds layer into auto-reload list.
Gets all layer identifiers in the stage that are outdated currently while skipping any live-sessions
Returns a list of layer identifiers that are configured as auto-reload when they are outdated.
get_dirty_layer_identifiers
([not_in_session])Gets all layer identifiers that have pending edits that are not saved.
get_layer_name
(layer_identifier)get_layer_owner
(layer_identifier)Gets file owner of layer file.
get_local_layer_identifiers
([...])Gets layer identifiers in the local layer stack of the current stage.
Ges all layer identifiers except ones in the local layer stack of the stage that are outdated currently.
Ges all sublayer identifiers in the local layer stack of the stage that are outdated currently.
has_local_layer
(layer_identifier)Layer is in the local layer stack of current stage.
has_used_layer
(layer_identifier)Layer is in the used layers of current stage.
is_auto_reload_layer
(layer_identifier)Whether layer will be auto-reloaded when it's outdated or not.
is_layer_globally_muted
(layer_identifier)Checks if layer is globally muted or not in this usd context.
is_layer_locally_muted
(layer_identifier)is_layer_locked
(layer_identifier)is_layer_outdated
(layer_identifier)If layer is out of sync.
is_layer_readonly_on_disk
(layer_identifier)Checks if this layer is physically read-only on disk.
is_layer_savable
(layer_identifier)Checks if this layer is savable.
is_layer_writable
(layer_identifier)Checks if layer is writable.
Global muteness is an extended concept for Omniverse so muteness can be authored into USD for persistence.
reload_all_outdated_layers
([not_in_session, ...])Reloads all oudated layers to fetch latest updates.
Reloads all outdated non-sublayers in the stage to fetch latest changes.
reload_outdated_sublayers
([not_in_session, ...])Reloads all oudated sublayers that are in the stage's local layer stack to fetch latest changes.
remove_auto_reload_layer
(layer_identifier)Remove layer from auto-reload list.
set_layer_lock_state
(layer_identifier, locked)Layer lock is an extended concept in Omniverse that works for lock this layer temporarily without real change the file permission of this layer.
set_layer_name
(layer_identifier, name)set_muteness_scope
(global_scope)Attributes
usd_context
- __init__(
- layers_instance: ILayersInstance,
- usd_context,
- add_auto_reload_layer(layer_identifier: str)#
Adds layer into auto-reload list. So if layer is outdated, it will be auto-reloaded.
- get_all_outdated_layer_identifiers(
- not_in_session=False,
- not_auto=False,
Gets all layer identifiers in the stage that are outdated currently while skipping any live-sessions
- get_auto_reload_layers() List[str] #
Returns a list of layer identifiers that are configured as auto-reload when they are outdated.
- get_dirty_layer_identifiers(
- not_in_session=False,
Gets all layer identifiers that have pending edits that are not saved.
- get_layer_owner(layer_identifier: str) str #
Gets file owner of layer file. It’s empty if file system does not support it.
- get_local_layer_identifiers(
- include_session_layers=False,
- include_anonymous_layers=True,
- include_invalid_layers=False,
Gets layer identifiers in the local layer stack of the current stage.
- get_outdated_non_sublayer_identifiers(
- not_in_session=False,
- not_auto=False,
Ges all layer identifiers except ones in the local layer stack of the stage that are outdated currently. Those layers include ones that are inserted as references or payloads.
- get_outdated_sublayer_identifiers(
- not_in_session=False,
- not_auto=False,
Ges all sublayer identifiers in the local layer stack of the stage that are outdated currently.
- has_local_layer(layer_identifier) bool #
Layer is in the local layer stack of current stage.
- has_used_layer(layer_identifier) bool #
Layer is in the used layers of current stage.
- is_auto_reload_layer(layer_identifier: str) bool #
Whether layer will be auto-reloaded when it’s outdated or not.
- is_layer_globally_muted(layer_identifier: str) bool #
Checks if layer is globally muted or not in this usd context. Global muteness is a customize concept in Kit that’s not from USD. It’s used for complement the USD muteness, that works for two purposes: 1. It’s stage bound. So a layer is globally muted in this stage will not influence others. 2. It’s persistent. Right now, it’s saved inside the custom data of root layer.
After stage load, it will be read to initialize the muteness of layers. Also, global muteness only takes effective when it’s in global state mode. See omni.usd.UsdContext.set_layer_muteness_scope about how to switch muteness scope. When it’s not in global state mode, authoring global muteness will not incluence layer’s muteness in stage.
- is_layer_outdated(layer_identifier: str) bool #
If layer is out of sync. This only works for layer inside Nucleus server but not local disk.
- is_layer_readonly_on_disk(layer_identifier: str) bool #
Checks if this layer is physically read-only on disk.
- is_layer_savable(layer_identifier: str) bool #
Checks if this layer is savable. If it’s savable means it’s true by checking is_layer_writable and not anonymous.
- is_layer_writable(layer_identifier: str) bool #
Checks if layer is writable. A layer is writable means it can be set as edit target, which should satisfy: 1. It’s not read-only on disk. 2. It’s not locked by set_layer_lock_state. 3. It’s not muted. It still can be set as edit target with scripts, while this can be used for guardrails.
- is_muteness_global() bool #
Global muteness is an extended concept for Omniverse so muteness can be authored into USD for persistence. When you set muteness scope as global with set_muteness_scope, all muteness of sublayers will be stored to root layer’s custom data and it will be loaded for next stage open.
- reload_all_outdated_layers(
- not_in_session=True,
- not_auto=False,
Reloads all oudated layers to fetch latest updates. We only want to reload layers that are not in session
- reload_outdated_non_sublayers(
- not_in_session=True,
- not_auto=False,
Reloads all outdated non-sublayers in the stage to fetch latest changes. If a layer is both inserted as sublayer and reference, it will be treated as sublayer only and will not be reloaded in this function.
- reload_outdated_sublayers(
- not_in_session=True,
- not_auto=False,
Reloads all oudated sublayers that are in the stage’s local layer stack to fetch latest changes.
- remove_auto_reload_layer(layer_identifier: str)#
Remove layer from auto-reload list.
- set_layer_lock_state(
- layer_identifier: str,
- locked: bool,
Layer lock is an extended concept in Omniverse that works for lock this layer temporarily without real change the file permission of this layer. It’s just authored as a meta inside layer’s custom data section, and read by UI.