file_path
stringlengths 5
148
| content
stringlengths 150
498k
| size
int64 150
498k
|
---|---|---|
omni.kit.usd.collect.Collector.md | # Collector
## Class Definition
```python
class omni.kit.usd.collect.Collector(usd_path: str, collect_dir: str, usd_only: bool = False, flat_collection: bool = False, material_only: bool = False, failure_options=CollectorFailureOptions.SILENT, skip_existing: bool = False)
```
## Description
The Collector class is used to collect assets from a specified USD path into a directory, optionally filtering by USD-only, flat collection, material-only, and handling failures silently. It also allows skipping existing files.
max_concurrent_tasks = 32
texture_option = FlatCollectionTextureOptions.BY_MDL
force_non_read_only = True
exclusion_rules = {}
default_prim_only = False
**kwargs
Bases:
object
Collector provides API to collect USD file with its dependencies that are scattered around different places.
### Methods
| Method | Description |
|--------|-------------|
| `__init__` (usd_path, collect_dir[, usd_only, ...]) | Constructor. |
| `add_copy_task` (source, target[, skip_if_existed]) | Internal. |
| `add_write_task` (target, content) | Internal. |
| `cancel` () | Cancel the collector if it's in progress. |
| `collect` ([progress_callback, finish_callback]) | Collects stage in an asynchronous way. |
| `destroy` () | Destructor to release all resources. |
| `get_source_target_url_mapping` () | Gets the mapping of all source files to target files. |
| `get_status` () | Gets the collector status. |
| `get_target_url` (source_url) | Gets the target url that the source url is collected to. |
| `is_cancelled` () | Collector is cancelled or not. |
| Attribute | Description |
|-----------|-------------|
| `is_copy_skipped` | Checkes if it skips copying source_url during collection. |
| `is_finished` | Collect is done or not. |
| `open_or_create_layer(layer_path[, clear])` | Deprecated. |
| `wait_all_unfinished_tasks([all_completed])` | Internal. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `collect_mapping_file_url` | The mapping file path. |
| `source_stage_url` | The source url to be collected. |
| `target_folder` | The target folder to collect assets into. |
### omni.kit.usd.collect.Collector.__init__
```python
__init__(usd_path: str, collect_dir: str, usd_only: bool = False, flat_collection: bool = False, material_only: bool = False, failure_options = CollectorFailureOptions.SILENT, skip_existing: bool)
```
| Parameter | Type | Default |
|-----------|------|---------|
| `usd_path` | str | None |
| `collect_dir` | str | None |
| `usd_only` | bool | False |
| `flat_collection` | bool | False |
| `material_only` | bool | False |
| `failure_options` | CollectorFailureOptions | CollectorFailureOptions.SILENT |
| `skip_existing` | bool | None |
```
Constructor.
Parameters:
- **usd_path** (str) – The usd stage to be collected.
- **collect_dir** (str) – The target folder to collect the usd stage to.
- **usd_only** (bool, Optional) – Collects usd files only or not. If it’s True, it will ignore all asset types except USD files. Default is False.
- **flat_collection** (bool, Optional) – Collects stage without keeping the original dir structure. Default is False.
- **material_only** (bool, Optional) – Collects material and textures only or not. If it’s True, it will ignore all other asset types. Default is False. If both `usd_only` and `material_only` are true, it will collect all asset types.
- **skip_existing** (bool, Optional) – If files already exist in the target location, don’t copy them again. Default is False.
- **max_concurrent_tasks** (int, Optional) – The maximum concurrent tasks to run at the same time. Default is 32.
- **texture_option** (FlatCollectionTextureOptions, Optional) – Specifies how textures are grouped in flat collection mode. This is to avoid name collision which results in textures overwriting each other in the cases where textures for different assets are not uniquely named.
- **force_non_read_only** (bool, Optional) – If it’s true and source file copied is read-only, it will set the target file writable. By default, it’s true, which means to make all copied files writable. For USD and MDL files, they will always be writable after copy as it needs to be modified during collecting.
- **exclusion_rules** (Dict[str, str], Optional) – Collector will collect and re-map all dependencies if no exclusion rules are given. It allows you to specify the rules to exclude specified URLs so they won’t be collected, and provide options to map them to new locations. Here is an example.
```python
{
"s3://test-path/": "/mount/test-path/",
}
```
{
"s3://test-path/": None,
"s3://another-path/": None
}
Here, it defines two rules to exclude the urls prefixed by the key. The first rule will map those URLs prefixed with “s3://test-path/” into location “/mount/test-path/”, and the second one will keep those URLs untouched in the collected file.
- **default_prim_only** (bool, Optional) – If it’s True, it will only collect the assets under the default prim, and only save default prim in the main usd file. By default, it’s false, which means to collect all the assets. See DefaultPrimOnlyOptions for more customizations.
- **default_prim_option** (DefaultPrimOnlyOptions, Optional) – Specifies how to collect default prims when default_prim_only is True. This option can be used to skip collecting assets that are not used in the stage composition. By default, it only collects default prim for root layer. REMINDER: When the option is to collect default prim only for all layers, it’s likely that non-default prims in a layer are referenced in any layers and they are removed which causes invalid references.
- **convert_usda_to_usdc** (bool, Optional) – If it’s True, it will convert ascii USD files (.usda) to binary format (.usdc). By default, it is False and keeps the original format for all USD files.
### async add_copy_task(source: str, target: str, skip_if_existed=False)
Internal. Adds a copy task that copies file from source to target.
**Parameters:**
- **source** (str) – The source url to copy.
- **target** (str) – The target url to copy source url into.
- **skip_if_existed** (bool, Optional) – If it should skip copy when the target file exists already.
### async add_write_task(target: str, content: Union[str, bytes])
Internal. Adds a write task that writes target file.
### Parameters
- **target** (`str`) – The target url to write.
- **content** – (`Union[str, bytes]`): The content to write. It could be str, or bytes.
### cancel()
- Cancel the collector if it’s in progress.
### collect(progress_callback: Optional[Callable[[int, int], None] = None], finish_callback: Optional[Callable[[], None] = None]) -> Tuple[bool, str]
- Collects stage in an asynchronous way.
- **progress_callback** (`Callable[[int, int], None]`) – The progress callback that notifies the current progress in (current_step, total_steps) style.
- **finish_callback** (`Callable[[], None]`) – Finish callback when task is done or cancelled.
- Returns: The success status and the path of the collected stage root if it exists.
### destroy
Destructor to release all resources.
### get_source_target_url_mapping
Gets the mapping of all source files to target files. It returns valid value when collect task is done. See `get_status()` to query collector status.
#### Returns
A dict that key is the source url of files, and value is the target url of files.
#### Return type
Dict[str, str]
### get_status
Gets the collector status. See `CollectorStatus` for more details.
#### Returns
The current status of the collector.
#### Return type
CollectorStatus
### get_target_url
Gets the target url that the source url is collected to. It returns valid value when collect task is done. See `get_status()` to query collector status.
#### Parameters
- **source_url** (str) – The source url to query.
#### Returns
The corresponding target url that the source url has been collected to.
#### Return type
str
### is_cancelled
Collector is cancelled or not. REMINDER: This function is DEPRECATED. See `get_status()` for more accurate status.
#### Returns
### Collection Methods
#### is_copy_skipped
```python
is_copy_skipped(source_url) -> bool
```
Checkes if it skips copying `source_url` during collection. It returns valid value when collect task is done. See `get_status()` to query collector status.
- **Returns**: Successful or not.
- **Return type**: bool
#### is_finished
```python
is_finished() -> bool
```
Collect is done or not. It returns True no matter it’s cancelled or successfully done. REMINDER: This function is DEPRECATED. See `get_status()` for more accurate status.
- **Returns**: Collection is finished or not.
- **Return type**: bool
#### open_or_create_layer
```python
async open_or_create_layer(layer_path, clear=True) -> None
```
Deprecated.
#### wait_all_unfinished_tasks
```python
async wait_all_unfinished_tasks(all_completed=False) -> None
```
Internal.
### Properties
#### collect_mapping_file_url
```python
property collect_mapping_file_url -> str
```
The mapping file path. Mapping file records the collection history of this collector. It can help avoiding duplication in collection if the target file exists and is not changed.
#### source_stage_url
```python
property source_stage_url : str
```
The source url to be collected.
#### target_folder
```python
property target_folder : str
```
The target folder to collect assets into. | 9,406 |
omni.kit.usd.collect.CollectorException.md | # CollectorException
## CollectorException
```
class omni.kit.usd.collect.CollectorException(error: str)
```
**Bases:** `Exception`
General collector exception. See [CollectorFailureOptions](#) for options to customize exception behaviors.
```
def __init__(error: str)
```
``` | 280 |
omni.kit.usd.collect.CollectorFailureOptions.md | # CollectorFailureOptions
## CollectorFailureOptions
```python
class omni.kit.usd.collect.CollectorFailureOptions(value)
```
Bases: `IntFlag`
Options to customize failure options for collector.
### Attributes
| Attribute | Description |
|-----------|-------------|
| `SILENT` | Silent for all failures except root USD. |
| `EXTERNAL_USD_REFERENCES` | Throws exception if any external USD file is not found. |
| `OTHER_EXTERNAL_REFERENCES` | Throws exception if external references other than all above are missing. |
```python
def __init__(self):
pass
```
```python
EXTERNAL_USD_REFERENCES = 1
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.CollectorFailureOptions.ALL_EXTERNAL_REFERENCES">
<span class="sig-name descname">
<span class="pre">
ALL_EXTERNAL_REFERENCES
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
1
<dd>
<p>
Throws exception if any external USD file is not found.
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.CollectorFailureOptions.OTHER_EXTERNAL_REFERENCES">
<span class="sig-name descname">
<span class="pre">
OTHER_EXTERNAL_REFERENCES
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
4
<dd>
<p>
Throws exception if external references other than all above are missing.
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.CollectorFailureOptions.SILENT">
<span class="sig-name descname">
<span class="pre">
SILENT
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
0
<dd>
<p>
Silent for all failures except root USD.
| 2,192 |
omni.kit.usd.collect.CollectorStatus.md | # CollectorStatus
## CollectorStatus
```python
class omni.kit.usd.collect.CollectorStatus(value)
```
Bases: `Enum`
Collector status.
### Attributes
| Attribute | Description |
|-----------|-------------|
| `NOT_STARTED` | Collection is not started yet. |
| `IN_PROGRESS` | Collection is in progress. |
| `FINISHED` | Collection is sucessfully done. |
| `CANCELLED` | Collection is cancelled. |
```python
def __init__(self):
pass
```
```python
CANCELLED = ...
```
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.CollectorStatus.CANCELLED">
<span class="sig-name descname">
<span class="pre">
CANCELLED
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
3
<dt>
<dd>
<p>
Collection is cancelled.
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.CollectorStatus.FINISHED">
<span class="sig-name descname">
<span class="pre">
FINISHED
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
2
<dt>
<dd>
<p>
Collection is sucessfully done.
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.CollectorStatus.IN_PROGRESS">
<span class="sig-name descname">
<span class="pre">
IN_PROGRESS
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
1
<dt>
<dd>
<p>
Collection is in progress.
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.CollectorStatus.NOT_STARTED">
<span class="sig-name descname">
<span class="pre">
NOT_STARTED
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
0
<dt>
<dd>
<p>
Collection is not started yet.
<footer>
<hr/>
| 2,899 |
omni.kit.usd.collect.CollectorTaskType.md | # CollectorTaskType
## CollectorTaskType
```python
class omni.kit.usd.collect.CollectorTaskType(value)
```
Bases: `Enum`
Internal. Task type of collector.
### Attributes
| Attribute | Description |
|-----------------|-----------------------------------------------------------------------------|
| `READ_TASK` | Read task that reads content of a file. |
| `WRITE_TASK` | Write task that writes content to a target file. |
| `COPY_TASK` | Copy task that copies a file to a target location. |
| `RESOLVE_TASK` | Resolve task that re-maps external references in a USD layer to new locations. |
### `__init__`
```python
__init__()
### COPY_TASK
Copy task that copies a file to a target location.
### READ_TASK
Read task that reads content of a file.
### RESOLVE_TASK
Resolve task that re-maps external references in a USD layer to new locations.
### WRITE_TASK
Write task that writes content to a target file. | 1,080 |
omni.kit.usd.collect.DefaultPrimOnlyOptions.md | # DefaultPrimOnlyOptions
## DefaultPrimOnlyOptions
```python
class omni.kit.usd.collect.DefaultPrimOnlyOptions(value)
```
Bases: `Enum`
Options for collecting USD with 'default prim only' mode.
### Attributes
| Attribute | Description |
|-----------|-------------|
| `ROOT_LAYER_ONLY` | Collects default prim only for root layer. |
| `ALL_LAYERS` | Collects default prim only for all layers. |
### `__init__`
```python
def __init__()
```
### `ALL_LAYERS`
```python
ALL_LAYERS = 1
```
Collects default prim only for all layers.
### `ROOT_LAYER_ONLY`
```python
ROOT_LAYER_ONLY = 0
```
Collects default prim only for root layer.
## 定义标题
### DefaultPrimOnlyOptions.ROOT_LAYER_ONLY
Collects default prim only for root layer. | 728 |
omni.kit.usd.collect.FlatCollectionTextureOptions.md | # FlatCollectionTextureOptions
## FlatCollectionTextureOptions
```python
class omni.kit.usd.collect.FlatCollectionTextureOptions(value)
```
Bases: `Enum`
Collection options for textures under ‘Flat Collection’ mode.
### Attributes
| Attribute | Description |
|-----------|-------------|
| `BY_MDL` | Groups textures by MDL. |
| `BY_USD` | Groups textures by USD. |
| `FLAT` | All textures will be under the same hierarchy, flat. |
```python
def __init__(self):
pass
```
```python
BY_MDL = 0
```
Groups textures by MDL.
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.FlatCollectionTextureOptions.BY_USD">
<span class="sig-name descname">
<span class="pre">
BY_USD
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
1
<dd>
<p>
Groups textures by USD.
<dl class="py attribute">
<dt class="sig sig-object py" id="omni.kit.usd.collect.FlatCollectionTextureOptions.FLAT">
<span class="sig-name descname">
<span class="pre">
FLAT
<em class="property">
<span class="w">
<span class="p">
<span class="pre">
=
<span class="w">
<span class="pre">
2
<dd>
<p>
All textures will be under the same hierarchy, flat.
| 1,514 |
omni.kit.usd.collect.FlatCollectionTextureOptions_omni.kit.usd.collect.FlatCollectionTextureOptions.md | # FlatCollectionTextureOptions
## FlatCollectionTextureOptions
```python
class omni.kit.usd.collect.FlatCollectionTextureOptions(value)
```
Bases: `Enum`
Collection options for textures under ‘Flat Collection’ mode.
### Attributes
| Attribute | Description |
|-----------|-------------|
| `BY_MDL` | Groups textures by MDL. |
| `BY_USD` | Groups textures by USD. |
| `FLAT` | All textures will be under the same hierarchy, flat. |
### `__init__`
```python
def __init__(self)
```
### BY_MDL
```python
BY_MDL = 0
```
Groups textures by MDL.
```
- **BY_USD** = 1
- Groups textures by USD.
- **FLAT** = 2
- All textures will be under the same hierarchy, flat. | 671 |
omni.kit.usd.layers.AbstractLayerCommand.md | # AbstractLayerCommand
## AbstractLayerCommand
```python
class omni.kit.usd.layers.AbstractLayerCommand(context_name_or_instance: Union[str, UsdContext] = '')
```
Bases: `Command`
Abstract base class for layer commands.
It’s mainly responsible to create a common class
to save all states before command execution, and restore them
in the undo function.
### Methods
- `__init__(context_name_or_instance)`:
- `do()`:
- `do_impl()`: Abstract do function to be implemented.
- `get_layers()`:
- `get_specs_linking()`:
| Function Name | Description |
|---------------|-------------|
| get_specs_locking | () |
| undo | () |
| undo_impl | Abstract undo function to be implemented. |
### __init__
```python
__init__(context_name_or_instance: Union[str, UsdContext] = '')
```
### do_impl
```python
do_impl()
```
Abstract do function to be implemented.
### undo_impl
```python
undo_impl()
```
Abstract undo function to be implemented. | 936 |
omni.kit.usd.layers.active_authoring_layer_context.md | # active_authoring_layer_context
## active_authoring_layer_context
```
Gets the edit context for edit target if it’s in non-auto authoring mode,
or edit context for default edit layer if it’s in auto authoring mode.
```
omni.kit.usd.layers.active_authoring_layer_context(usd_context) → EditContext
```
Gets the edit context for edit target if it’s in non-auto authoring mode,
or edit context for default edit layer if it’s in auto authoring mode. | 448 |
omni.kit.usd.layers.AutoAuthoring.md | # AutoAuthoring
## AutoAuthoring
```python
class omni.kit.usd.layers.AutoAuthoring(layers_instance: ILayersInstance, usd_context)
```
(Experimental) USD supports switching edit targets so that all authoring will take place in that specified layer. When it’s working with multiple sublayers, this kind of freedom may cause experience issues. The user has to be aware the changes made are not overridden in any stronger layer. We extend a new mode called Auto Authoring to improve it. In this mode, all changes will firstly go into a middle delegate layer and it will then distribute edits (per frame) into their corresponding layers where the edits have the strongest opinions. So it cannot switch edit targets freely, and users do not need to be aware of the existence of multi-sublayers and how USD will compose the changes.
### Methods
- **`__init__(layers_instance, usd_context)`**
-
- **`get_default_layer()`**
- Gets the default layer.
- **`is_auto_authoring_layer(layer_identifier)`**
- Checks if a layer is an auto authoring layer.
- **`is_enabled()`**
- Checks if UsdContext is in Auto Authoring mode.
```
<p>
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
set_default_layer
(layer_identifier)
<p>
Sets the default layer to receive the newly created opinions.
<p>
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
usd_context
<dl>
<dt>
<span class="pre">
__init__
(layers_instance: ILayersInstance, usd_context) → None
<dl>
<dt>
<span class="pre">
get_default_layer
() → str
<dd>
<p>
Gets the default layer.
<dl>
<dt>
<span class="pre">
is_auto_authoring_layer
(layer_identifier: str) → bool
<dd>
<p>
Checks if a layer is an auto authoring layer.
<dl>
<dt>
<span class="pre">
is_enabled
() → bool
<dd>
<p>
Checks if UsdContext is in Auto Authoring mode.
<dl>
<dt>
<span class="pre">
set_default_layer
(layer_identifier: str)
<dd>
<p>
Sets the default layer to receive the newly created opinions.
| 2,234 |
omni.kit.usd.layers.Classes.md | # omni.kit.usd.layers Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| AbstractLayerCommand | Abstract base class for layer commands. |
| AutoAuthoring | (Experimental) USD supports switching edit targets so that all authoring will take place in that specified layer. When it’s working |
| CreateLayerReferenceCommand | Create reference in specific layer. |
| CreateSublayerCommand | Creates or inserts a sublayer. |
| Extension | Extension Class. |
| FlattenLayersCommand | Flatten Layers. |
| LayerEditMode | Layer edit mode. |
| LayerErrorType | Layer error type. |
| LayerEventPayload | LayerEventPayload is a wrapper to carb.events.IEvent sent from module omni.kit.usd.layers. |
| LayerEventType | Layer event types. |
| LayerUtils | LayerUtils provides utilities for operating layers. |
- **Layers**
Layers is the Python container of ILayersInstance, through which you can access all interfaces. For each UsdContext,
- **LayersState**
- **LinkSpecsCommand**
Links spec paths to layers.
- **LiveSession**
Python instance of ILayersInstance for the convenience of accessing
- **LiveSessionUser**
LiveSessionUser represents an peer client instance that joins
- **LiveSyncing**
Live Syncing includes the interfaces to management Live Sessions of all layers in the bound UsdContext.
- **LockLayerCommand**
Sets lock state for layer.
- **LockSpecsCommand**
Locks spec paths in the UsdContext.
- **MergeLayersCommand**
Merges two layers.
- **MovePrimSpecsToLayerCommand**
Merge prim spec from src layer to dst layer and remove it from src layer.
- **MoveSublayerCommand**
Moves sublayer from one location to the other.
- **RemovePrimSpecCommand**
Removes prim spec from a layer.
- **RemoveSublayerCommand**
Removes a sublayer from parent layer.
- **ReplaceSublayerCommand**
Replaces sublayer with a new layer.
- **SetEditTargetCommand**
Sets layer as Edit Target.
- **SetLayerMutenessCommand**
Sets mute state for layer.
- **SpecsLinking**
- **SpecsLocking**
- **StitchPrimSpecsToLayer**
Flatten specific prims in the stage. It will remove original prim specs after flatten.
- **UnlinkSpecsCommand**
Unlinks spec paths to layers.
- **UnlockSpecsCommand**
Unlocks spec paths in the UsdContext | 2,287 |
omni.kit.usd.layers.CreateLayerReferenceCommand.md | # CreateLayerReferenceCommand
## 概述
```python
class omni.kit.usd.layers.CreateLayerReferenceCommand:
def __init__(self, layer_identifier: str, path_to: Path, asset_path: Optional[str] = None, prim_path: Optional[Path] = None, usd_context: Union[str, UsdContext] = ''):
pass
```
### 参数说明
- `layer_identifier`: 层标识符,类型为 `str`。
- `path_to`: 目标路径,类型为 `Path`。
- `asset_path`: 资产路径,类型为 `Optional[str]`,默认值为 `None`。
- `prim_path`: 基本路径,类型为 `Optional[Path]`,默认值为 `None`。
- `usd_context`: USD上下文,类型为 `Union[str, UsdContext]`,默认值为空字符串。
```
## CreateLayerReferenceCommand
**Bases:** [AbstractLayerCommand](#)
**Create reference in specific layer.**
It creates a new prim and adds the asset and path as references in specific layer.
**Parameters**
- **layer_identifier** – str: Layer identifier to create prim inside.
- **path_to** – Sdf.Path: Path to create a new prim.
- **asset_path** – str: The asset it’s necessary to add to references.
- **prim_path** – Sdf.Path: The prim in asset to reference.
- **usd_context** – Union[str, omni.usd.UsdContext]: Usd context name or instance. It uses default context if it’s empty.
**Methods**
- **__init__(layer_identifier, path_to[, ...])**
- **do_impl()** - Abstract do function to be implemented.
- **undo_impl()** - Abstract undo function to be implemented.
**__init__(layer_identifier: str, path_to: Path, asset_path: Optional[str] = None, prim_path: Optional[Path] = None, usd_context: Union[str, omni.usd.UsdContext] = None)**
## omni.kit.usd.layers.CreateLayerReferenceCommand
### `__init__`
```python
def __init__(self, context: UsdContext):
pass
```
### `do_impl`
```python
def do_impl():
pass
```
Abstract do function to be implemented.
### `undo_impl`
```python
def undo_impl():
pass
```
Abstract undo function to be implemented. | 1,809 |
omni.kit.usd.layers.CreateSublayerCommand.md | # CreateSublayerCommand
## CreateSublayerCommand
```python
class omni.kit.usd.layers.CreateSublayerCommand(layer_identifier: str, sublayer_position: int, new_layer_path: str, transfer_root_content: bool, create_or_insert: bool, layer_name: str = '', usd_context: Union[str, UsdContext] = '')
```
### 参数说明
- `layer_identifier`: str
- `sublayer_position`: int
- `new_layer_path`: str
- `transfer_root_content`: bool
- `create_or_insert`: bool
- `layer_name`: str, 默认值 ''
- `usd_context`: Union[str, UsdContext], 默认值 ''
```
### CreateSublayerCommand
Bases: `AbstractLayerCommand`
Creates or inserts a sublayer.
#### Methods
- `__init__(layer_identifier, sublayer_position, new_layer_path, transfer_root_content, create_or_insert, layer_name='', usd_context='')`
- Constructor.
- Keyword arguments:
- layer_identifier (str): The identifier of layer to create sublayer. It should be found by Sdf.Find.
- sublayer_position (int): Sublayer position that the new sublayer is created before.
- If position_before == -1, it will create layer at the end of sublayer list.
- If position_before >= total_number_of_sublayers, it will create layer at the end of sublayer list.
- new_layer_path (str): Absolute path of new layer. If it’s empty, it will create anonymous layer if create_or_insert == True.
- If create_or_insert == False and it’s empty, it will fail to insert layer.
- transfer_root_content (bool): True if we should move the root contents to the new layer.
- `do_impl()`
- Abstract do function to be implemented.
- `undo_impl()`
- Abstract undo function to be implemented.
<p>
create_or_insert (bool): If it’s true, it will create layer from this path. It’s insert, otherwise.
<p>
layer_name (str, optional): If it’s to create anonymous layer (new_layer_path is empty), this name is used.
<p>
usd_context (Union[str, omni.usd.UsdContext]): Usd context name or instance. It uses default context if it’s empty.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.CreateSublayerCommand.do_impl">
<span class="sig-name descname">
<span class="pre">
do_impl
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Abstract do function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.CreateSublayerCommand.undo_impl">
<span class="sig-name descname">
<span class="pre">
undo_impl
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Abstract undo function to be implemented.
| 2,529 |
omni.kit.usd.layers.Extension.md | # Extension
## Extension Class
Bases: `IExt`
Extension Class.
### Methods
| Method | Description |
|--------------|-------------|
| `on_shutdown()` | |
| `on_startup()` | |
#### `__init__(self: omni.ext._extensions.IExt) -> None`
``` | 269 |
omni.kit.usd.layers.FlattenLayersCommand.md | # FlattenLayersCommand
## Class: omni.kit.usd.layers.FlattenLayersCommand
Constructor.
### Methods
- **__init__(usd_context='')**
- Constructor.
- **do_impl()**
- Abstract do function to be implemented.
- **undo_impl()**
- Abstract undo function to be implemented.
(
usd_context
:
Union
[
str
,
omni.usd.UsdContext
]
=
''
)
Constructor.
**Keyword Arguments**
* **usd_context** (Union[str, omni.usd.UsdContext]) – Usd context name or instance. It uses default context if it’s empty.
**do_impl**()
Abstract do function to be implemented.
**undo_impl**()
Abstract undo function to be implemented. | 610 |
omni.kit.usd.layers.Functions.md | # omni.kit.usd.layers Functions
## Functions Summary
| Function | Description |
|----------|-------------|
| active_authoring_layer_context | Gets the edit context for edit target if it’s in non-auto authoring mode. |
| get_all_locked_specs | |
| get_all_spec_links | |
| get_auto_authoring | Gets the Auto Authoring interface from Layers instance bound to the specified UsdContext. |
| get_last_error_string | Gets the error string of the API call bound to specified UsdContext. |
| get_last_error_type | Gets the error status of the API call bound to specified UsdContext. Any API calls to Layers interface will change. |
| get_layer_event_payload | Gets the payload of layer events by populating them into an instance of LayerEventPayload. |
| get_layers | Gets Layers instance bound to the context. For each UsdContext, it has unique Layers instance. |
| get_layers_state | Gets the Layers State interface from Layers instance bound to the specified UsdContext. |
| get_live_session_name_from_shared_link | Gets the name of Live Session from the url. |
| Method Name | Description |
|-------------|-------------|
| get_live_syncing_interface | Gets the Live Syncing interface from Layers instance bound to the specified UsdContext. |
| get_short_user_name | Gets short name with capitalized first letters of each word. |
| get_spec_layer_links | |
| get_spec_links_for_layers | |
| is_spec_linked | |
| is_spec_locked | |
| link_specs | |
| lock_specs | |
| unlink_all_specs | |
| unlink_specs | |
| unlink_specs_from_all_layers | |
| unlink_specs_to_layers | |
| unlock_all_specs | |
| unlock_specs | | | 1,611 |
omni.kit.usd.layers.get_all_spec_links.md | # get_all_spec_links
## get_all_spec_links
```python
def get_all_spec_links(usd_context) -> Dict[str, List[str]]:
```
This function returns a dictionary where each key is a string and each value is a list of strings.
``` | 223 |
omni.kit.usd.layers.get_auto_authoring.md | # get_auto_authoring
## get_auto_authoring
### get_auto_authoring
Gets the Auto Authoring interface from Layers instance bound to the specified UsdContext.
REMINDER: Auto Authoring interface is still in experimental stage, which is used to reduce the burden of
managing deltas inside multi-sublayers, so authoring to stage will be auto-targeted to the layers that
has its strongest opinions. | 395 |
omni.kit.usd.layers.get_last_error_string.md | # get_last_error_string
## get_last_error_string
```python
omni.kit.usd.layers.get_last_error_string(context_name_or_instance: Union[str, UsdContext] = '') -> str
```
Gets the error string of the API call bound to specified UsdContext.
```
``` | 246 |
omni.kit.usd.layers.get_last_error_type.md | # get_last_error_type
## get_last_error_type
```python
omni.kit.usd.layers.get_last_error_type(context_name_or_instance: Union[str, UsdContext] = '') -> LayerErrorType
```
Gets the error status of the API call bound to specified UsdContext. Any API calls to Layers interface will change the error state. When you want to get the detailed error of your last call, you can use this function to fetch the detailed error type. | 424 |
omni.kit.usd.layers.get_layers.md | # get_layers
## get_layers
```python
omni.kit.usd.layers.get_layers(context_name_or_instance: Union[str, UsdContext] = '') -> Optional[Layers]
```
Gets Layers instance bound to the context. For each UsdContext, it has unique Layers instance, through which, you can access all the interfaces supported.
``` | 307 |
omni.kit.usd.layers.get_layers_state.md | # get_layers_state
## get_layers_state
```python
omni.kit.usd.layers.get_layers_state(context_name_or_instance: Union[str, UsdContext] = '') -> Optional[LayersState]
```
Gets the Layers State interface from Layers instance bound to the specified UsdContext.
Layers State interface extends the USD interfaces to access more states of layers, and provides
utilities for layer operations and event subscription.
``` | 419 |
omni.kit.usd.layers.get_layer_event_payload.md | # get_layer_event_payload
## get_layer_event_payload
```python
def get_layer_event_payload(event: IEvent) -> LayerEventPayload:
```
Gets the payload of layer events by populating them into an instance of LayerEventPayload. | 223 |
omni.kit.usd.layers.get_live_session_name_from_shared_link.md | # get_live_session_name_from_shared_link
## get_live_session_name_from_shared_link
```python
def get_live_session_name_from_shared_link(shared_session_link: str) -> str:
```
Gets the name of Live Session from the url.
``` | 224 |
omni.kit.usd.layers.get_live_syncing.md | # get_live_syncing
## get_live_syncing
```python
omni.kit.usd.layers.get_live_syncing(context_name_or_instance: Union[str, UsdContext] = '') -> Optional[LiveSyncing]
```
Gets the Live Syncing interface from Layers instance bound to the specified UsdContext.
Live Syncing interface is the core of supporting Live Session in Kit, which provides all functionalities to
manage Live Sessions.
``` | 394 |
omni.kit.usd.layers.get_short_user_name.md | # get_short_user_name
## get_short_user_name
```python
def get_short_user_name(user_name: str) -> str:
"""
Gets short name with capitalized first letters of each word.
"""
```
``` | 193 |
omni.kit.usd.layers.get_spec_links_for_layers.md | # get_spec_links_for_layers
## get_spec_links_for_layers
```python
omni.kit.usd.layers.get_spec_links_for_layers(usd_context, layer_identifiers: Union[str, List[str]]) -> Dict[str, List[str]]
```
- **Parameters**:
- `usd_context`
- `layer_identifiers`: Union of `str` or `List[str]`
- **Returns**:
- A dictionary where keys are strings and values are lists of strings. | 377 |
omni.kit.usd.layers.is_spec_linked.md | # is_spec_linked
## is_spec_linked
```python
omni.kit.usd.layers.is_spec_linked(usd_context, spec_path: Union[str, Path], layer_identifier: str = '') -> bool
```
Checks if a specification is linked in a USD layer.
**Parameters:**
- `usd_context`: The USD context.
- `spec_path`: The path of the specification.
- `layer_identifier` (optional): The identifier of the layer. Default is an empty string.
**Returns:**
- `bool`: True if the specification is linked, False otherwise. | 480 |
omni.kit.usd.layers.LayerEditMode.md | # LayerEditMode
## Overview
Layer edit mode.
### Members
- NORMAL : Normal authoring mode.
- AUTO_AUTHORING : Auto authoring mode.
- SPECS_LINKING : Specs Linking mode.
### Methods
- `__init__(self, value)`
### Attributes
- `AUTO_AUTHORING`
- `NORMAL`
- `SPECS_LINKING`
- `name`
- `value`
### omni.kit.usd.layers.LayerEditMode
#### __init__(self, value: int) -> None
- **value**: int
#### name
- **property**: name | 420 |
omni.kit.usd.layers.LayerErrorType.md | # LayerErrorType
## LayerErrorType
```python
class omni.kit.usd.layers.LayerErrorType
```
Bases: `pybind11_object`
Layer error type.
Members:
- SUCCESS : Success.
- NOT_FOUND : Object (layer, file, or session, etc) is not found.
- ALREADY_EXISTS : Object exists already.
- READ_ONLY : File, layer or folder is read-only.
- INVALID_STAGE : No valid stage opened.
- INVALID_PARAM : Invalid parameters passed into function.
- LIVE_SESSION_NOT_JOINED : Live Session is not joined.
- LIVE_SESSOIN_INVALID : Live Session is invalid.
- LIVE_SESSION_JOINED_ALREADY : Live Session is joined already.
- LIVE_SESSION_NO_MERGE_PERMISSION : Live Session cannot be merged due to permission.
- LIVE_SESSION_VERSION_MISMATCH : Live Session version does not match.
- LIVE_SESSION_BASE_LAYER_MISMATCH : Base layer of Live Session does not match.
- LIVE_SESSION_NOT_SUPPORTED : Live Session cannot be created under the domain.
- UNKNOWN : Unknown error.
### Methods
- `__init__(self, value)`
### Attributes
- `ALREADY_EXISTS`
- `INVALID_PARAM`
- `INVALID_STAGE`
- `LIVE_SESSION_BASE_LAYER_MISMATCH`
| LIVE_SESSION_JOINED_ALREADY |
|------------------------------|
| LIVE_SESSION_NOT_JOINED |
|------------------------------|
| LIVE_SESSION_NOT_SUPPORTED |
|------------------------------|
| LIVE_SESSION_NO_MERGE_PERMISSION |
|------------------------------|
| LIVE_SESSION_VERSION_MISMATCH |
|------------------------------|
| LIVE_SESSION_INVALID |
|------------------------------|
| NOT_FOUND |
|------------------------------|
| READ_ONLY |
|------------------------------|
| SUCCESS |
|------------------------------|
| UNKNOWN |
|------------------------------|
| name |
|------------------------------|
| value |
|------------------------------|
__init__(self: omni.kit.usd.layers._omni_kit_usd_layers.LayerErrorType, value: int) -> None
property name | 1,991 |
omni.kit.usd.layers.LayerEventPayload.md | # LayerEventPayload
LayerEventPayload is a wrapper to carb.events.IEvent sent from module omni.kit.usd.layers. Through which, you can query event payload easier with properties.
## Methods
- **`__init__(event)`**
- **`is_layer_influenced(layer_identifier_or_handle)`**
- Checks if specific layer is influenced by the event.
## Attributes
- **`event_type`**
- Layer event type, it's None when the event type is unknown.
- **`identifiers_or_spec_paths`**
- The influenced layers or prim specs if any.
- **`layer_identifier`**
- The identifier of the layer that triggered the event.
| Property | Description |
|----------|-------------|
| layer_identifier | This property is non-empty when any layers are influenced. |
| layer_info_data | It is non-empty if event type is INFO_CHANGED, of which key is the layer identifier that its metadata has changed, and value is the set of strings that represent the metadata tokens that's modified. |
| layer_spec_paths | The influenced spec paths for each layer. |
| success | It's useful if event type is LIVE_SESSION_MERGE_STARTED or LIVE_SESSION_MERGE_ENDED, which means if merge of a Live Session is successful or not. |
| user_id | It's non-empty if event type is LIVE_SESSION_USER_JOINED or LIVE_SESSION_USER_LEFT. |
| user_name | It's non-empty if event type is LIVE_SESSION_USER_JOINED or LIVE_SESSION_USER_LEFT. |
### __init__
- **Parameters**:
- `event : IEvent`
- **Returns**: `None`
### is_layer_influenced
- **Parameters**:
- `layer_identifier_or_handle : Union[str, Layer]`
- **Returns**: `bool`
- **Description**: Checks if specific layer is influenced by the event.
### event_type
- **Type**: `LayerEventType`
- **Description**: Layer event type, it’s None when the event type is unknown.
### identifiers_or_spec_paths
- **Type**: `List[str]`
- **Description**: List of identifiers or spec paths.
### identifiers_or_spec_paths
The influenced layers or prim specs if any. When event type is LayerEventType.SPECS_LOCKING_CHANGED, it hosts all influenced prim specs. Otherwise, it hosts all influenced layers for the event.
### layer_identifier
This property is non-empty when any layers are influenced. If multiple layers are influenced, it’s the first one of identifiers_or_spec_paths to keep compatibility.
### layer_info_data
It is non-empty if event type is INFO_CHANGED, of which key is the layer identifier that its metadata has changed, and value is the set of strings that represent the metadata tokens that’s modified. Currently, only the following tokens are notified when they are modified:
- UsdGeom.Tokens.upAxis
- UsdGeom.Tokens.metersPerUnit
- Sdf.Layer.StartTimeCodeKey
- Sdf.Layer.EndTimeCodeKey
- Sdf.Layer.FramesPerSecond
- Sdf.Layer.TimeCodesPerSecond
- Sdf.Layer.CommentKey
- Sdf.Layer.Documentation
- “subLayerOffsets_offset” # String as there is no python binding from USD.
- “subLayerOffsets_scale”
### layer_spec_paths
The influenced spec paths for each layer. It’s non-empty if event type is PRIM_SPECS_CHANGED or SPECS_LINKING_CHANGED, of which, the key is the layer identifier, and value is the list of spec paths.
### success
It’s useful if event type is LIVE_SESSION_MERGE_STARTED or LIVE_SESSION_MERGE_ENDED, which means if merge of a Live Session is successful or not.
### user_id
It’s non-empty if event type is LIVE_SESSION_USER_JOINED or LIVE_SESSION_USER_LEFT.
### user_name
<section>
<div>
<div>
<div>
<div>
<dl>
<dt>
<em>
<span class="pre">
str
<dd>
<p>
It’s non-empty if event type is LIVE_SESSION_USER_JOINED or LIVE_SESSION_USER_LEFT.
<footer>
<hr/>
| 3,834 |
omni.kit.usd.layers.LayerEventType.md | # LayerEventType
## LayerEventType
```python
class omni.kit.usd.layers.LayerEventType(value)
```
Bases: `IntEnum`
Layer event types.
Members:
- INFO_CHANGED : Layer metadata changed.
- DIRTY_STATE_CHANGED : Layers’ dirty state changed.
- LOCK_STATE_CHANGED : Layers’ lock state changed.
- MUTENESS_SCOPE_CHANGED : Layers’ mute scope changed.
- MUTENESS_STATE_CHANGED : Layers’ mute state changed.
- OUTDATE_STATE_CHANGED : Layers’ outdate state changed.
- PRIM_SPECS_CHANGED : Layers’ prim specs changed.
- SUBLAYERS_CHANGED : Layers’ sublayer list changed.
- EDIT_TARGET_CHANGED : Stage’s edit target changed.
- SPECS_LOCKING_CHANGED : Stage’s locking specs changed.
- SPECS_LINKING_CHANGED : Stage’s linking specs changed.
- EDIT_MODE_CHANGED : Stage’s edit mode changed.
- DEFAULT_LAYER_CHANGED : Stage’s default layer changed when it’s in Auto Authoring mode.
- LIVE_SESSION_STATE_CHANGED : Layers’ Live Session state changed.
- LIVE_SESSION_JOINING : Layers are joining Live Session.
- LIVE_SESSION_LIST_CHANGED : Layers’ Live Session list changed.
- LIVE_SESSION_USER_JOINED : New User joined the Live Session.
- LIVE_SESSION_USER_LEFT : New User left the Live Session.
- LIVE_SESSION_MERGE_STARTED : Merging Live Session started.
- LIVE_SESSION_MERGE_ENDED : Merging Live Session ended.
- USED_LAYERS_CHANGED : Stage’s used layers changed.
- LAYER_FILE_PERMISSION_CHANGED : Layer’s file permisison changed on file system.
### Attributes
- `INFO_CHANGED`
- `DIRTY_STATE_CHANGED`
- `LOCK_STATE_CHANGED`
MUTENESS_SCOPE_CHANGED
MUTENESS_STATE_CHANGED
OUTDATE_STATE_CHANGED
PRIM_SPECS_CHANGED
SUBLAYERS_CHANGED
EDIT_TARGET_CHANGED
SPECS_LOCKING_CHANGED
SPECS_LINKING_CHANGED
EDIT_MODE_CHANGED
DEFAULT_LAYER_CHANGED
LIVE_SESSION_STATE_CHANGED
LIVE_SESSION_JOINING
LIVE_SESSION_LIST_CHANGED
LIVE_SESSION_USER_JOINED
LIVE_SESSION_USER_LEFT
LIVE_SESSION_MERGE_STARTED
LIVE_SESSION_MERGE_ENDED
USED_LAYERS_CHANGED
LAYER_FILE_PERMISSION_CHANGED
AUTO_RELOAD_LAYERS_CHANGED
__init__() | 2,004 |
omni.kit.usd.layers.Layers.get_last_error_string_omni.kit.usd.layers.Layers.md | # Layers
## Layers
Bases: `object`
Layers is the Python container of ILayersInstance, through which you can access all interfaces. For each UsdContext, it has a separate Layers instance.
### Methods
- `__init__(layers_instance, usd_context)`
- `get_auto_authoring()` - Gets AutoAuthoring interface.
- `get_edit_mode()` - Gets the current edit mode.
- `get_event_stream()` - Gets event stream of Layers instance.
- `get_last_error_string()` - Gets the last error string.
| Method | Description |
| ------ | ----------- |
| `get_last_error_type()` | Gets the last error type. |
| `get_layers_state()` | Gets LayersState interface. |
| `get_live_syncing()` | Gets LiveSyncing interface. |
| `get_specs_linking()` | Gets SpecsLinking interface. |
| `get_specs_locking()` | Gets SpecsLocking interface. |
| `set_edit_mode(edit_mode)` | Sets the current edit mode. |
### Attributes
| Attribute | Description |
| --------- | ----------- |
| `usd_context` | The UsdContext this instance is bound to. |
### Methods
```python
__init__(layers_instance, usd_context: UsdContext) -> None
```
```python
get_auto_authoring() -> AutoAuthoring
```
- Gets AutoAuthoring interface.
```python
get_edit_mode() -> LayerEditMode
```
- Gets the current edit mode.
```python
get_event_stream()
```
- Gets event stream of Layers instance.
```python
get_last_error_string()
```
- (Description not provided in the HTML)
```
### get_last_error_string
Gets the last error string.
### get_last_error_type
Gets the last error type.
### get_layers_state
Gets LayersState interface.
### get_live_syncing
Gets LiveSyncing interface.
### get_specs_linking
Gets SpecsLinking interface.
### get_specs_locking
Gets SpecsLocking interface.
### set_edit_mode
Sets the current edit mode.
### usd_context
The UsdContext this instance is bound to. | 1,820 |
omni.kit.usd.layers.LayersState.md | # LayersState
## Methods
- `__init__(layers_instance, usd_context)`
- `add_auto_reload_layer(layer_identifier)`
- Adds layer into auto-reload list.
- `get_all_outdated_layer_identifiers()`
- Gets all layer identifiers in the stage that are outdated currently while skipping any live-sessions
- `get_auto_reload_layers()`
- 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. |
| | `get_outdated_non_sublayer_identifiers` (...) |
| | Ges all layer identifiers except ones in the local layer stack of the stage that are outdated currently. |
| | `get_outdated_sublayer_identifiers` (...) |
| | 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. |
| 方法 | 描述 |
| --- | --- |
| `is_muteness_global()` | 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 outdated layers to fetch latest updates. |
| `reload_outdated_non_sublayers([...])` | Reloads all outdated non-sublayers in the stage to fetch latest changes. |
| `reload_outdated_sublayers([not_in_session, ...])` | Reloads all outdated 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` | |
### Methods
#### `__init__(layers_instance: ILayersInstance, usd_context)`
- Initializes the LayersState object.
#### `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)`
- Retrieves all outdated layer identifiers.
### get_all_outdated_layer_identifiers
Gets all layer identifiers in the stage that are outdated currently while skipping any live-sessions.
### get_auto_reload_layers
Returns a list of layer identifiers that are configured as auto-reload when they are outdated.
### get_dirty_layer_identifiers
Gets all layer identifiers that have pending edits that are not saved.
### get_layer_owner
Gets file owner of layer file. It’s empty if file system does not support it.
### get_local_layer_identifiers
Gets layer identifiers in the local layer stack of the current stage.
### get_outdated_non_sublayer_identifiers
<span class="pre">
not_in_session
<span class="o">
<span class="pre">
=
<span class="default_value">
<span class="pre">
False
,
<em class="sig-param">
<span class="n">
<span class="pre">
not_auto
<span class="o">
<span class="pre">
=
<span class="default_value">
<span class="pre">
False
<span class="sig-paren">
)
<span class="sig-return">
<span class="sig-return-icon">
→
<span class="sig-return-typehint">
<span class="pre">
List
<span class="p">
<span class="pre">
[
<span class="pre">
str
<span class="p">
<span class="pre">
]
<dd>
<p>
Gets 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.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LayersState.get_outdated_sublayer_identifiers">
<span class="sig-name descname">
<span class="pre">
get_outdated_sublayer_identifiers
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
not_in_session
<span class="o">
<span class="pre">
=
<span class="default_value">
<span class="pre">
False
,
<em class="sig-param">
<span class="n">
<span class="pre">
not_auto
<span class="o">
<span class="pre">
=
<span class="default_value">
<span class="pre">
False
<span class="sig-paren">
)
<span class="sig-return">
<span class="sig-return-icon">
→
<span class="sig-return-typehint">
<span class="pre">
List
<span class="p">
<span class="pre">
[
<span class="pre">
str
<span class="p">
<span class="pre">
]
<dd>
<p>
Gets all sublayer identifiers in the local layer stack of the stage that are outdated currently.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LayersState.has_local_layer">
<span class="sig-name descname">
<span class="pre">
has_local_layer
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
layer_identifier
<span class="sig-paren">
)
<span class="sig-return">
<span class="sig-return-icon">
→
<span class="sig-return-typehint">
<span class="pre">
bool
<dd>
<p>
Layer is in the local layer stack of current stage.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LayersState.has_used_layer">
<span class="sig-name descname">
<span class="pre">
has_used_layer
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
layer_identifier
<span class="sig-paren">
)
<span class="sig-return">
<span class="sig-return-icon">
→
<span class="sig-return-typehint">
<span class="pre">
bool
<dd>
<p>
Layer is in the used layers of current stage.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LayersState.is_auto_reload_layer">
<span class="sig-name descname">
<span class="pre">
is_auto_reload_layer
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
layer_identifier
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
str
<span class="sig-paren">
)
<span class="sig-return">
<span class="sig-return-icon">
→
<span class="sig-return-typehint">
<span class="pre">
bool
<dd>
<p>
Whether layer will be auto-reloaded when it’s outdated or not.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LayersState.is_layer_globally_muted">
<span class="sig-name descname">
<span class="pre">
is_layer_globally_muted
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
layer_identifier
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
str
<span class="sig-paren">
)
<span class="sig-return">
<span class="sig-return-icon">
→
<span class="sig-return-typehint">
<span class="pre">
bool
<dd>
<p>
Whether layer will be auto-reloaded when it’s outdated or not.
<dl>
<dt>
<p>
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.
<p>
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 influence layer’s muteness in stage.
<dl class="py method">
<dt>
<span class="pre">is_layer_outdated
(<span class="pre">layer_identifier
→ <span class="pre">bool
<dd>
<p>
If layer is out of sync. This only works for layer inside Nucleus server but not local disk.
<dl class="py method">
<dt>
<span class="pre">is_layer_readonly_on_disk
(<span class="pre">layer_identifier
→ <span class="pre">bool
<dd>
<p>
Checks if this layer is physically read-only on disk.
<dl class="py method">
<dt>
<span class="pre">is_layer_savable
(<span class="pre">layer_identifier
→ <span class="pre">bool
<dd>
<p>
Checks if this layer is savable. If it’s savable means it’s true by checking is_layer_writable and not anonymous.
<dl class="py method">
<dt>
<span class="pre">is_layer_writable
(<span class="pre">layer_identifier
→ <span class="pre">bool
<dd>
<p>
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.
<dl class="py method">
<dt>
<span class="pre">is_muteness_global
()
→ <span class="pre">bool
<dd>
<p>
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.
<dl class="py method">
<dt>
<span class="pre">reload_all_outdated_layers
(<span class="pre">not_in_session
### reload_all_outdated_layers
Reloads all outdated layers to fetch latest updates. We only want to reload layers that are not in session.
### reload_outdated_non_sublayers
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
Reloads all outdated sublayers that are in the stage’s local layer stack to fetch latest changes.
### remove_auto_reload_layer
Remove layer from auto-reload list.
### set_layer_lock_state
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. | 11,389 |
omni.kit.usd.layers.LayersState_omni.kit.usd.layers.LayersState.md | # LayersState
## Class Definition
```python
class omni.kit.usd.layers.LayersState(layers_instance: ILayersInstance, usd_context)
```
### Methods
- **`__init__(layers_instance, usd_context)`**
- No description provided.
- **`add_auto_reload_layer(layer_identifier)`**
- Adds layer into auto-reload list.
- **`get_all_outdated_layer_identifiers()`**
- Gets all layer identifiers in the stage that are outdated currently while skipping any live-sessions.
- **`get_auto_reload_layers()`**
- Returns a list of layer identifiers that are configured as auto-reload when they are outdated.
- **`get_dirty_layer_identifiers(not_in_session=None)`**
- No description provided.
```
| 方法 | 描述 |
| --- | --- |
| get_layer_name(layer_identifier) | 获取层名称 |
| get_layer_owner(layer_identifier) | 获取层文件的所有者 |
| get_local_layer_identifiers(...) | 获取当前阶段本地层堆栈中的层标识符 |
| get_outdated_non_sublayer_identifiers(...) | 获取除当前阶段本地层堆栈中的层标识符外的所有过时的层标识符 |
| get_outdated_sublayer_identifiers(...) | 获取当前阶段本地层堆栈中的所有过时的子层标识符 |
| has_local_layer(layer_identifier) | 层是否在当前阶段的本地层堆栈中 |
| has_used_layer(layer_identifier) | 层是否在当前阶段使用的层中 |
| is_auto_reload_layer(layer_identifier) | 层是否会在过时时自动重新加载 |
| is_layer_globally_muted(layer_identifier) | 检查层是否在此usd上下文中全局静音 |
| is_layer_locally_muted(layer_identifier) | |
| is_layer_locked(layer_identifier) | |
| is_layer_outdated(layer_identifier) | 如果层不同步 |
| is_layer_readonly_on_disk(layer_identifier) | 检查层是否在磁盘上物理只读 |
| is_layer_savable(layer_identifier) | 检查层是否可保存 |
| is_layer_writable(layer_identifier) | 检查层是否可写 |
| Method/Attribute | Description |
| --- | --- |
| `is_muteness_global()` | 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 outdated layers to fetch latest updates. |
| `reload_outdated_non_sublayers([...])` | Reloads all outdated non-sublayers in the stage to fetch latest changes. |
| `reload_outdated_sublayers([not_in_session, ...])` | Reloads all outdated 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)` | |
| `usd_context` | |
### Attributes
| Attribute | Description |
| --- | --- |
| `usd_context` | |
### Methods
#### `__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)`
### get_all_outdated_layer_identifiers
```python
get_all_outdated_layer_identifiers(not_auto=False) -> List[str]
```
Gets all layer identifiers in the stage that are outdated currently while skipping any live-sessions
### get_auto_reload_layers
```python
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
```python
get_dirty_layer_identifiers(not_in_session=False) -> List[str]
```
Gets all layer identifiers that have pending edits that are not saved.
### get_layer_owner
```python
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
```python
get_local_layer_identifiers(include_session_layers=False, include_anonymous_layers=True, include_invalid_layers=False) -> List[str]
```
Gets layer identifiers in the local layer stack of the current stage.
### get_outdated_non_sublayer_identifiers
```python
get_outdated_non_sublayer_identifiers(not_in_session=False, not_auto=False) -> List[str]
```
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
```python
get_outdated_sublayer_identifiers(not_in_session=False, not_auto=False) -> List[str]
```
Ges all sublayer identifiers in the local layer stack of the stage that are outdated currently.
### has_local_layer
```python
has_local_layer(layer_identifier: str) -> bool
```
Layer is in the local layer stack of current stage.
### has_used_layer
```python
has_used_layer(layer_identifier: str) -> bool
```
Layer is in the used layers of current stage.
### is_auto_reload_layer
```python
is_auto_reload_layer(layer_identifier: str) -> bool
```
Whether layer will be auto-reloaded when it’s outdated or not.
### is_layer_globally_muted
```python
is_layer_globally_muted(layer_identifier: str) -> bool
```
Whether layer is globally muted or not.
<dl>
<dt>
<p>
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.
<p>
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 influence layer’s muteness in stage.
<dl class="py method">
<dt>
<span class="pre">
is_layer_outdated
<em>
<span class="pre">
layer_identifier
:
<span class="pre">
str
<span class="pre">
→
<span class="pre">
bool
<dd>
<p>
If layer is out of sync. This only works for layer inside Nucleus server but not local disk.
<dl class="py method">
<dt>
<span class="pre">
is_layer_readonly_on_disk
<em>
<span class="pre">
layer_identifier
:
<span class="pre">
str
<span class="pre">
→
<span class="pre">
bool
<dd>
<p>
Checks if this layer is physically read-only on disk.
<dl class="py method">
<dt>
<span class="pre">
is_layer_savable
<em>
<span class="pre">
layer_identifier
:
<span class="pre">
str
<span class="pre">
→
<span class="pre">
bool
<dd>
<p>
Checks if this layer is savable. If it’s savable means it’s true by checking is_layer_writable and not anonymous.
<dl class="py method">
<dt>
<span class="pre">
is_layer_writable
<em>
<span class="pre">
layer_identifier
:
<span class="pre">
str
<span class="pre">
→
<span class="pre">
bool
<dd>
<p>
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.
<dl class="py method">
<dt>
<span class="pre">
is_muteness_global
<span class="pre">
→
<span class="pre">
bool
<dd>
<p>
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.
<dl class="py method">
<dt>
<span class="pre">
reload_all_outdated_layers
<em>
<span class="pre">
not_in_session
=
<span class="pre">
True
,
<em>
<span class="pre">
not_auto
=
<span class="pre">
True
### reload_all_outdated_layers
Reloads all outdated layers to fetch latest updates. We only want to reload layers that are not in session.
### reload_outdated_non_sublayers
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
Reloads all outdated sublayers that are in the stage’s local layer stack to fetch latest changes.
### remove_auto_reload_layer
Remove layer from auto-reload list.
### set_layer_lock_state
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. | 9,218 |
omni.kit.usd.layers.Layers_omni.kit.usd.layers.Layers.md | # Layers
## Layers
### Class Definition
```python
class omni.kit.usd.layers.Layers(layers_instance, usd_context: UsdContext)
```
**Description:**
Layers is the Python container of ILayersInstance, through which you can access all interfaces. For each UsdContext, it has a separate Layers instance.
### Methods
- **`__init__(layers_instance, usd_context)`**
- No description provided.
- **`get_auto_authoring()`**
- Gets AutoAuthoring interface.
- **`get_edit_mode()`**
- Gets the current edit mode.
- **`get_event_stream()`**
- Gets event stream of Layers instance.
- **`get_last_error_string()`**
- Gets the last error string.
```
| Method | Description |
|--------|-------------|
| `get_last_error_type()` | Gets the last error type. |
| `get_layers_state()` | Gets LayersState interface. |
| `get_live_syncing()` | Gets LiveSyncing interface. |
| `get_specs_linking()` | Gets SpecsLinking interface. |
| `get_specs_locking()` | Gets SpecsLocking interface. |
| `set_edit_mode(edit_mode)` | Sets the current edit mode. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `usd_context` | The UsdContext this instance is bound to. |
### Methods
#### `__init__(layers_instance, usd_context: UsdContext)`
- **Parameters**:
- `layers_instance`
- `usd_context: UsdContext`
- **Returns**: `None`
#### `get_auto_authoring()`
- **Returns**: `AutoAuthoring`
- **Description**: Gets AutoAuthoring interface.
#### `get_edit_mode()`
- **Returns**: `LayerEditMode`
- **Description**: Gets the current edit mode.
#### `get_event_stream()`
- **Description**: Gets event stream of Layers instance.
#### `get_last_error_string()`
- **Description**: Gets the last error string.
## Methods
### get_last_error_string
Gets the last error string.
### get_last_error_type
Gets the last error type.
### get_layers_state
Gets LayersState interface.
### get_live_syncing
Gets LiveSyncing interface.
### get_specs_linking
Gets SpecsLinking interface.
### get_specs_locking
Gets SpecsLocking interface.
### set_edit_mode
Sets the current edit mode.
## Properties
### usd_context
The UsdContext this instance is bound to. | 2,156 |
omni.kit.usd.layers.LayerUtils.md | # LayerUtils
LayerUtils provides utilities for operating layers.
## Methods
- `create_checkpoint(layer_identifier, comment)`
- `create_checkpoint_async(layer_identifier, ...)`
- `create_checkpoint_for_stage_async(stage, comment)`
- `create_sublayer(layer, sublayer_position, ...)` - Creates new sublayer at specific position.
- `get_all_sublayers(stage[, ...])`
- `get_custom_layer_name(layer)` - Gets the custom name of layer.
- `get_dirty_layers(stage[, ...])`
- `get_edit_target(stage)`
```code
get_layer_global_muteness
```
(root_layer, ...)
```code
get_layer_lock_status
```
(root_layer, ...)
```code
get_sublayer_identifier
```
(layer_identifier, ...)
Gets the sublayer identifier at specific postion with validality.
```code
get_sublayer_position_in_parent
```
(...)
Gets the sublayer position in the parent layer.
```code
has_prim_spec
```
(layer_identifier, prim_spec_path)
```code
insert_sublayer
```
(layer, sublayer_position, ...)
Inserts new sublayer at specific position.
```code
is_layer_writable
```
(layer_identifier)
Checks if layer is a writable format or writable on the file system.
```code
move_layer
```
(from_parent_layer_identifier, ...)
Move sublayer from source parent to position of target parent.
```code
reload_all_layers
```
(layer_identifiers)
Reloads all layers in batch.
```code
remove_layer_global_muteness
```
(root_layer, ...)
```code
remove_layer_lock_status
```
(root_layer, ...)
```code
remove_prim_spec
```
(layer, prim_spec_path)
Utility to remove prim spec from layer.
```code
remove_sublayer
```
(layer, position)
```code
replace_sublayer
```
(layer, sublayer_position, ...)
Replaces new sublayer at specific position.
```code
resolve_paths
```
(base_layer, target_layer[, ...])
Resolve all paths from References, Sublayers and AssetPaths of target layer based on source layer.
```code
restore_authoring_layer_from_custom_data
```
(stage)
```code
restore_muteness_from_custom_data
```
(stage)
## Functions
- `save_authoring_layer_to_custom_data` (stage)
- `set_custom_layer_name` (layer, name)
- Sets the custom name of layer, or clear it if name is empty or None.
- `set_edit_target` (stage, layer_identifier)
- `set_layer_global_muteness` (root_layer, ...)
- `set_layer_lock_status` (root_layer, ...)
- `transfer_layer_content` (source_layer, ...[, ...])
- Transfer layer content from source layer to target layer with re-pathing all external dependencies.
## Attributes
- `LAYER_AUTHORING_LAYER_CUSTOM_KEY`
- `LAYER_LOCK_STATUS_CUSTOM_KEY`
- `LAYER_MUTENESS_CUSTOM_KEY`
- `LAYER_NAME_CUSTOM_KEY`
- `LAYER_OMNI_CUSTOM_KEY`
## Methods
### `__init__()`
### `create_sublayer(layer: Layer, sublayer_position: int, layer_identifier: str)`
- Creates new sublayer at specific position.
- Parameters:
- `layer` (Sdf.Layer) – Layer handle.
- `sublayer_position` – Position to create the new layer. Position should be -1 (the last position) or above 0. If position == -1 or position > len(layer.subLayerPaths), it will create the sublayer at the end. Any other position will be treated as invalid index.
- `layer_identifier` – New layer path. If it’s empty or None, it will create anonymous layer.
- Returns:
New sublayer handle or None if sublayer_position is not valid.
### get_custom_layer_name
**static**
`get_custom_layer_name(layer: Layer) -> str`
Gets the custom name of layer. This name is saved inside the custom data of layer.
### get_sublayer_identifier
**static**
`get_sublayer_identifier(layer_identifier: str, sublayer_position: int) -> str`
Gets the sublayer identifier at specific position with validity.
**Parameters:**
- **layer_identifier** (str) – Parent layer identifier.
- **sublayer_position** (int) – Position of sublayer. It must be -1, which means to return the last item. Or it should be equal or above.
**Returns:**
None if sublayer_position is invalid or overflow. Or sublayer identifier otherwise.
### get_sublayer_position_in_parent
**static**
`get_sublayer_position_in_parent(parent_layer_identifier: str, layer_identifier: str) -> int`
Gets the sublayer position in the parent layer.
**Parameters:**
- **parent_layer_identifier** (str) – Parent layer identifier.
- **layer_identifier** (str) – Layer identifier to query.
**Returns:**
Position of layer in the subLayerPaths of the parent, or -1 if it cannot be found.
### insert_sublayer
**static**
`insert_sublayer(layer: Layer, sublayer_position: int) -> None`
Insert a sublayer at a specific position.
**Parameters:**
- **layer** (Layer) – The layer to insert into.
- **sublayer_position** (int) – The position to insert the sublayer.
### insert_sublayer
Inserts new sublayer at specific position.
#### Parameters
- **layer** (`Sdf.Layer`) – Layer handle.
- **sublayer_position** – Position to insert the new layer.
Position should be -1 (the last position) or above 0.
If position == -1 or position > len(layer.subLayerPaths), it will insert the sublayer at the end.
Any other position will be treated as invalid index.
- **layer_identifier** – New layer path.
#### Returns
Sublayer handle or None if sublayer_position is not valid or layer_identifier is empty or inserted layer is not existed.
### is_layer_writable
Checks if layer is a writable format or writable on the file system.
### move_layer
Move sublayer from source parent to position of target parent.
#### Parameters
- **from_parent_layer_identifier** – The parent of source sublayer.
- **from_sublayer_position** – The sublayer position to be moved.
- **to_parent_layer_identifier** – The parent of target sublayer.
- **to_sublayer_position** – The sublayer position in target parent that source moves to.
- **remove_source** – Removes the source sublayer or not from source parent after move.
If from_parent_layer_identifier == to_parent_layer_layer_identifier,
it will always be True.
#### Returns
True if it’s successful, False otherwise.
### reload_all_layers
### LayerUtils.reload_all_layers
Reloads all layers in batch.
### LayerUtils.remove_prim_spec
Utility to remove prim spec from layer.
#### Parameters
- **layer** (`Sdf.Layer`) – Layer handle.
- **prim_spec_path** (`Union[str, Sdf.Path]`) – Path of prim spec.
#### Returns
True if success, or False otherwise.
### LayerUtils.replace_sublayer
Replaces new sublayer at specific position.
#### Parameters
- **layer** (`Sdf.Layer`) – Layer handle.
- **sublayer_position** – Position to insert the new layer. Position should be less than len(layer.subLayerPaths). Any other position will be treated as invalid index.
- **layer_identifier** – New layer path.
#### Returns
Sublayer handle or None if sublayer_position is not valid or layer_identifier is empty or replaced layer is not existed.
### LayerUtils.resolve_paths
### resolve_paths
Resolve all paths from References, Sublayers and AssetPaths of target layer based on source layer.
This function is used normally when you transfer the content from source layer to target layer that
are not in the same directory. So it needs to resolve all references so that they point to correct
location.
#### Parameters
- **base_layer** (`Sdf.Layer`) – Source layer that references in target layer based on.
- **target_layer** (`Sdf.Layer`) – Target layer to resolve.
- **store_relative_path** (`bool`) – True to store relative path, or False to store absolute path.
if relative path cannot be computed (like source layer and
target are not in the same domain), it will save absolute paths.
- **relative_to_base_layer** (`bool`) – True if the relative path is computed against the target_layer.
False otherwise.
- **copy_sublayer_offsets** (`bool`) – True to copy sublayer offsets and scales from base to target.
### set_custom_layer_name
Sets the custom name of layer, or clear it if name is empty or None.
The name is saved inside the custom data of layer and can only be
consumed by Kit application.
#### Parameters
- **layer** (`Layer`)
- **name** (`str`)
### transfer_layer_content
Transfer layer content from source layer to target layer with re-pathing all external
dependencies.
#### Parameters
- **source_layer** (`Layer`)
- **target_layer** (`Layer`)
- **copy_custom_data** (`bool`) – True to copy custom data.
- **skip_sublayers** (`bool`) – True to skip copying sublayers.
- **source_layer** (`Sdf.Layer`) – Source layer handle.
- **target_layer** (`Sdf.Layer`) – Target layer handle.
- **copy_custom_data** (`bool`) – Whether copying layer metadata or not.
- **skip_sublayers** (`bool`) – Whether skipping to copy sublayers or not if copy_custom_data is True. | 8,572 |
omni.kit.usd.layers.LinkSpecsCommand.md | # LinkSpecsCommand
## Overview
The `LinkSpecsCommand` class is a part of the `omni.kit.usd.layers` module. It is used to link specifications to layers in a USD (Universal Scene Description) context.
## Class Definition
```python
class omni.kit.usd.layers.LinkSpecsCommand(
spec_paths: Union[str, List[str]],
layer_identifiers: Union[str, List[str]],
additive: bool = True,
hierarchy: bool = False,
usd_context: bool = False
)
```
### Parameters
- `spec_paths`: A string or a list of strings representing the paths to the specifications.
- `layer_identifiers`: A string or a list of strings identifying the layers.
- `additive`: A boolean indicating whether the linking should be additive. Default is `True`.
- `hierarchy`: A boolean indicating whether to respect the hierarchy. Default is `False`.
- `usd_context`: A boolean indicating the USD context. Default is `False`.
```
### Union
Bases:
```python
AbstractLayerCommand
```
Links spec paths to layers.
#### Methods
| Method | Description |
| --- | --- |
| `__init__(spec_paths, layer_identifiers[, ...])` | Constructor. |
| `do()` | |
| `undo()` | |
#### `__init__(spec_paths, layer_identifiers, additive=True, hierarchy=False, usd_context=None)`
- `spec_paths`: Union[str, List[str]]
- `layer_identifiers`: Union[str, List[str]]
- `additive`: bool = True
- `hierarchy`: bool = False
- `usd_context`: Union[str, UsdContext] = None
Constructor.
**Keyword Arguments**
* **spec_paths** (Union[str, List[str]]) – List of spec paths or single spec path to be linked.
* **layer_identifiers** (Union[str, List[str]]) – List of layer identifiers or single layer identifier.
* **additive** (bool) – Clearing existing links or not.
* **hierarchy** (bool) – Linking descendant specs or not.
* **usd_context** (Union[str, omni.usd.UsdContext]) – Usd context name or instance. It uses default context if it’s empty. | 1,893 |
omni.kit.usd.layers.LiveSession.md | # LiveSession
## Class Definition
```python
class omni.kit.usd.layers.LiveSession(handle, session_channel, live_syncing)
```
Bases: `object`
Python instance of ILayersInstance for the convenience of accessing and querying properties and states of a Live Session.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(handle, session_channel, live_syncing)` | Internal constructor. |
| `get_last_modified_time()` | Gets the last modified time of the Live Session. |
| `get_peer_user_info(user_id)` | Gets the info of peer user by user id if this session is joined. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `base_layer_identifier` | The base layer identifier of the Live Session. |
| `channel_url` | The channel URL of the Live Session. |
| Property | Description |
|----------|-------------|
| channel_url | The channel url of the Live Session that shares by all users to do communication. |
| joined | Returns True if this session is joined locally. |
| logged_user | The user that connects the server of base layer. |
| logged_user_id | The user id that connects the server of base layer. |
| logged_user_name | The user name that connects the server of base layer. |
| merge_permission | Whether local user has permission to merge the Live Session or not. |
| name | The name of the Live Session. |
| owner | The owner name of the Live Session. |
| peer_users | All peer users in the Live Session if the session is joined. |
| root | The url of the root.live layer for the Live Session in the server. |
| shared_link | The session link to be shared. |
| url | The physical url of the Live Session in the server. |
| valid | Returns true if the session is valid. |
### omni.kit.usd.layers.LiveSession.__init__
```python
__init__(handle, session_channel, live_syncing)
```
Internal constructor.
### omni.kit.usd.layers.LiveSession.get_last_modified_time
```python
get_last_modified_time()
```
### get_last_modified_time
Gets the last modified time of the Live Session. The modified time is fetched from the session config file. It can be used to sort the Live Session list in access order.
### get_peer_user_info(user_id)
→ LiveSessionUser
Gets the info of peer user by user id if this session is joined.
### base_layer_identifier
: str
The base layer identifier of the Live Session.
### channel_url
: str
The channel url of the Live Session that shares by all users to do communication.
### joined
: bool
Returns True if this session is joined locally.
### logged_user
: LiveSessionUser
The user that connects the server of base layer. It’s also the user that joins the Live Session, and can be uniquely identified in the Live Session with user id.
### logged_user_id
: str
The user id that connects the server of base layer. And it’s also the user that joins the Live Session.
### logged_user_name
: str
The user name that connects the server of base layer. And it’s also the user that joins the Live Session.
### merge_permission
: bool
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LiveSession.merge_permission">
<em class="property">
<span class="pre">
property
<span class="w">
<span class="sig-name descname">
<span class="pre">
merge_permission
<em class="property">
<span class="p">
<span class="pre">
:
<span class="w">
<span class="pre">
bool
<dd>
<p>
Whether local user has permission to merge the Live Session or not. It’s possible that
the local user is the owner but this returns False as if multiple instances of the same
user join the same session, only one of them will be the runtime owner.
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LiveSession.name">
<em class="property">
<span class="pre">
property
<span class="w">
<span class="sig-name descname">
<span class="pre">
name
<em class="property">
<span class="p">
<span class="pre">
:
<span class="w">
<span class="pre">
str
<dd>
<p>
The name of the Live Session.
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LiveSession.owner">
<em class="property">
<span class="pre">
property
<span class="w">
<span class="sig-name descname">
<span class="pre">
owner
<em class="property">
<span class="p">
<span class="pre">
:
<span class="w">
<span class="pre">
str
<dd>
<p>
The owner name of the Live Session. It returns the static owner name of the session only.
If it has multiple instances of the same user join the same session, only one of the owner
has the real merge_permission.
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LiveSession.peer_users">
<em class="property">
<span class="pre">
property
<span class="w">
<span class="sig-name descname">
<span class="pre">
peer_users
<em class="property">
<span class="p">
<span class="pre">
:
<span class="w">
<span class="pre">
List
<span class="p">
<span class="pre">
[
<span class="pre">
LiveSessionUser
<span class="p">
<span class="pre">
]
<dd>
<p>
All peer users in the Live Session if the session is joined.
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LiveSession.root">
<em class="property">
<span class="pre">
property
<span class="w">
<span class="sig-name descname">
<span class="pre">
root
<em class="property">
<span class="p">
<span class="pre">
:
<span class="w">
<span class="pre">
str
<dd>
<p>
The url of the root.live layer for the Live Session in the server.
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LiveSession.shared_link">
<em class="property">
<span class="pre">
property
<span class="w">
<span class="sig-name descname">
<span class="pre">
shared_link
<em class="property">
<span class="p">
<span class="pre">
:
<span class="w">
<span class="pre">
str
<dd>
<p>
The session link to be shared. Shared link is different as
url, so url points to the physical location of the Live Session
that local user can get access to, while session link is the URL
that you can share to others, and can be launched from Omniverse launcher
and other apps could parse it and decide the action from it. The session
name is passed as the query parameter to the base layer url, for example,
omniverse://localhost/test/stage.usd?live_session_name=my_session.
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LiveSession.url">
<em class="property">
<span class="pre">
property
<span class="w">
<span class="sig-name descname">
<span class="pre">
url
<em class="property">
<span class="p">
<span class="pre">
:
<span class="w">
<span class="pre">
str
<dd>
<p>
The physical url of the Live Session in the server.
<dl class="py property">
<dt class="sig sig-object py" id="omni.kit.usd.layers.LiveSession.valid">
<em class="property">
<span class="pre">
property
<span class="w">
<span class="sig-name descname">
<span class="pre">
valid
<em class="property">
<span class="p">
<span class="pre">
:
<span class="w">
<span class="pre">
bool
<dd>
<p>
Returns true if the session is valid. Or it’s removed.
| 8,507 |
omni.kit.usd.layers.LiveSessionUser.md | # LiveSessionUser
## LiveSessionUser
```python
class omni.kit.usd.layers.LiveSessionUser(user_name, user_id, from_app)
```
Bases: `object`
LiveSessionUser represents an peer client instance that joins the same Live Session.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(user_name, user_id, from_app)` | |
### Attributes
| Attribute | Description |
|-----------|-------------|
| `from_app` | |
| `user_color` | Tuple of RGB color with each channel ranging from [0, 255]. |
| `user_id` | |
| `user_name` | |
```
### LiveSessionUser Class Initialization
```python
def __init__(
self,
user_id,
from_app
):
```
### LiveSessionUser.user_color Property
```python
property user_color: Tuple[int, int, int]
```
- **Description**: Tuple of RGB color with each channel ranging from [0, 255].
``` | 837 |
omni.kit.usd.layers.LiveSyncing.join_live_session_omni.kit.usd.layers.LiveSyncing.md | # LiveSyncing
## LiveSyncing
```
```markdown
Bases: object
Live Syncing includes the interfaces to management Live Sessions of all layers in the bound UsdContext.
A Live Session is a concept that extends non-destructive live workflow for USD layers so all connectors
can join the session to co-work together.
Each Live Session is bound to an USD file with unique URL to be identified. And it has only unique instance
in the same UsdContext for each layer, which means the Live Sessions can be joined multiple times.
User can only join the Live Sessions that belong to the used layers in the bound UsdContext, either those layers
are added as sublayers or references/payloads. If a layer is added as both a local sublayer or reference/payload,
the sublayer and reference/payload cannot join the same Live Session at the same time. However, a Live Session
can be joined multiple times if the corresponding layer is added as multiple references/payloads.
Thread Safety: All interfaces of LiveSyncing are not thread-safe. And It’s recommended to call
those interfaces in the same loop thread as UsdContext.
### Methods
- `__init__(layers_instance, usd_context, ...)`
- `broadcast_merge_done_message_async(...)`
- Broadcasts merge finished message to other peer clients.
- `broadcast_merge_started_message_async(...)`
- Broadcasts merge started message to other peer clients.
Broadcasts merge started message to other peer clients.
create_live_session (name[, layer_identifier])
: Creates a named Live Session.
find_live_session_by_name (layer_identifier, ...)
: Finds the Live Session with name specified by `session_name`.
get_all_current_live_sessions ([prim_path])
: Gets all Live Sessions that are joined for all sublayers of the stage or a specific prim.
get_all_live_sessions ([layer_identifier])
: Gets all existing Live Sessions on disk (including joined and not joined ones) for a specific layer.
get_current_live_session ([layer_identifier])
: Gets the current Live Session of the base layer joined.
get_current_live_session_layers ([...])
: [DEPRECATED] Returns the Live Session layers attached to this Live Session of specific base layer.
get_current_live_session_peer_users ([...])
: [DEPRECATED] Returns the list of users that joined in this Live Session.
get_live_session_by_url (session_url)
: Gets the Live Session by the url.
get_live_session_for_live_layer (...)
: Gets the Live Session that the live layer is attached to.
is_in_live_session ()
: [DEPRECATED] If root layer is in a Live Session.
is_layer_in_live_session ([layer_identifier, ...])
: Checks if the given layer is in a Live Session or not.
is_live_session_layer (layer_identifier)
: Checks if the layer is the live layer (.live layer) of a Live Session.
is_live_session_merge_notice_muted (...)
: Checks if layer identifier is in the mute list.
is_prim_in_live_session
| Function Name | Description |
|---------------|-------------|
| is_prim_in_live_session (prim_path[, ...]) | If the prim is in any Live Session. |
| is_stage_in_live_session () | Checks if any layers that are in the used layers of the current stage are in a Live Session. |
| join_live_session (live_session[, prim_path]) | Joins the Live Session. |
| join_live_session_by_url (layer_identifier, ...) | Joins the Live Session specified by the Live Session URL. |
| merge_and_stop_live_session_async ([...]) | Saves changes of Live Session to their base layer if it's in live mode. |
| merge_changes_to_base_layers (stop_session) | [DEPRECATED] Merges changes of root layer's Live Session to its base layer. |
| merge_changes_to_specific_layer (...) | [DEPRECATED] Merges changes of root layer's Live Session to specified layer. |
| merge_live_session_changes (layer_identifier, ...) | Merge Live Session for base layer. |
| merge_live_session_changes_to_specific_layer (...) | Merge Live Session for base layer to specified target layer. |
| mute_live_session_merge_notice (layer_identifier) | By default, when session owner merges the session, it will notify peer clients to leave the session by showing a prompt. |
| open_stage_with_live_session_async (stage_url) | Opens stage with Live Session joined. |
| register_open_stage_addon (callback) | |
| stop_all_live_sessions () | Stops all the Live Sessions that are enabled for the current stage. |
| stop_live_session ([layer_identifier, prim_path]) | Stops the Live Session for specified layer or prim. |
| try_cancelling_live_session_join | |
| Description | Text |
|-------------|------|
| Try to cancel the Live Session when LayerEventType.LIVE_SESSION_JOINING is received. | Try to cancel the Live Session when LayerEventType.LIVE_SESSION_JOINING is received. |
| Remove layer identifier from mute list. | Remove layer identifier from mute list. |
### Attributes
| Attribute | Description |
|-----------|-------------|
| layers_instance | Native handle of Layers instance that's bound to an UsdContext. |
| permission_to_merge_current_session | [DEPRECATED] Checks to see if it can merge the current Live Session of specified layer. |
| usd_context | Instance of UsdContext. |
### Methods
#### `__init__(layers_instance: ILayersInstance, usd_context, layers_state)`
#### `async broadcast_merge_done_message_async(destroy: bool = True, layer_identifier: Optional[str] = None)`
Broadcasts merge finished message to other peer clients. This is normally called after merging the Live Session to its base layer.
**Args:**
- `destroy (bool): If it needs to destroy the session channel after merging.`
- `layer_identifier (str): The base layer of the Live Session.`
#### `async broadcast_merge_started_message_async(layer_identifier: Optional[str])`
### Broadcasts merge started message to other peer clients. This is normally called before merging the Live Session to its base layer.
### create_live_session
```python
create_live_session(name: str, layer_identifier: Optional[str] = None) -> LiveSession
```
Creates a named Live Session.
**Parameters:**
- **name** (str) – Name of the session. Currently, name should be unique across all Live Sessions.
- **layer_identifier** (str) – The base layer to create a Live Session. If it’s not provided, it will be root layer by default.
**Returns:**
The Live Session handle if it’s success, or None otherwise. See Layers.get_last_error_type to get more details.
### find_live_session_by_name
```python
find_live_session_by_name(layer_identifier: str, session_name: str) -> LiveSession
```
Finds the Live Session with name specified by `session_name`. If it has multiple sessions that has the same name, it will return the first one found.
**Parameters:**
- **layer_identifier** (str) – The base layer to search Live Sessions.
- **session_name** (str) – The session name.
### get_all_current_live_sessions
Gets all Live Sessions that are joined for all sublayers of the stage or a specific prim.
#### Parameters
- **prim_spec** (`Sdf.Path`) – Specified prim to query. If prim_path is not None, it will return all live sessions joined for this prim. If it’s None, it will return the live sessions joined for all sublayers of the current stage.
### get_all_live_sessions
Gets all existing Live Sessions on disk (including joined and not joined ones) for a specific layer. See `get_current_live_session` to query joined session for a specific layer.
#### Parameters
- **layer_identifier** (`str`) – The base layer to query Live Sessions. If it’s empty, it will be root layer by default.
#### Returns
- A list of Live Sessions.
### get_current_live_session
Gets the current Live Session of the base layer joined.
#### Parameters
- **layer_identifier** (`str`) – Base layer identifier. It’s root layer if it’s not provided.
### get_current_live_session_layers
### get_current_live_session_layers
[DEPRECATED] Returns the Live Session layers attached to this Live Session of specific base layer.
### get_current_live_session_peer_users
[DEPRECATED] Returns the list of users that joined in this Live Session.
**Parameters**
- **layer_identifier** (str) – It’s root layer if it’s not provided.
### get_live_session_by_url
Gets the Live Session by the url. It can only get the Live Session belongs to one of the used layers in the current stage.
### get_live_session_for_live_layer
Gets the Live Session that the live layer is attached to.
**Parameters**
- **live_layer_identifier** (str) – The .live layer that’s in the Live Session.
### is_in_live_session
Returns whether the current context is in a Live Session.
[DEPRECATED] If root layer is in a Live Session.
```python
is_layer_in_live_session(layer_identifier: Optional[str] = None, live_prim_only: bool = False) -> bool
```
Checks if the given layer is in a Live Session or not.
Parameters:
- **layer_identifier** (str) – Base layer identifier. Root layer by default.
- **live_prim_only** (bool) – When live_prim_only is True, it will only check the Live Sessions that are bound to reference/payload prims for the base layer. Otherwise, it will check all. False by default.
```python
is_live_session_layer(layer_identifier: str) -> bool
```
Checks if the layer is the live layer (.live layer) of a Live Session.
```python
is_live_session_merge_notice_muted(layer_identifier: str) -> bool
```
Checks if layer identifier is in the mute list.
```python
is_prim_in_live_session(prim_path: Path, layer_identifier: Optional[str] = None) -> bool
```
Checks if the given prim path is in a Live Session.
### is_prim_in_live_session
If the prim is in any Live Session.
#### Parameters
- **prim_path** (Sdf.Path) – Prim path to check.
- **layer_identifier** (str) – If layer identifier is specified, it will check if prim is in the Live Session of that layer only.
- **from_reference_or_payload_only** (bool) – If it’s True, it will check only references and payloads to see if the same Live Session is enabled already. Otherwise, it checks both the prim specified by primPath and its references and payloads. This is normally used to check if the Live Session can be stopped as the prim that is in the Live Session may not own the Live Session, which is owned by its references or payloads, so it cannot stop the Live Session with the specified prim.
### is_stage_in_live_session
Checks if any layers that are in the used layers of the current stage are in a Live Session.
### join_live_session
Joins the Live Session.
#### Parameters
- **live_session** (LiveSession) – The Live Session to join. The base layer of the Live Session must be in the used layers of the current stage.
- **prim_path** (Union[Sdf.Path, str]) – If prim path is provided, it means to join a Live Session for a reference or payload prim.
#### Returns
True if it joins the session successfully. False otherwise. See Layers.get_last_error_type to get more details.
### join_live_session_by_url
**Parameters**
- **layer_identifier** (`str`) – The base layer of the Live Session.
- **live_session_url** (`str`) – The unique URL of the Live Session. The Live Session must be created against with the base layer, otherwise, it will fail to join.
- **create_if_not_existed** (`bool`) – Creates the Live Session if it does not exist.
**Returns**
- `bool` – True if it joins the session successfully. False otherwise. See Layers.get_last_error_type to get more details.
### merge_and_stop_live_session_async
**Parameters**
- **target_layer** (`Optional[str]` = `None`)
- **comment** (`str` = `''`)
- **pre_merge** (`Optional[Callable[[LiveSession], Awaitable]]` = `None`)
- **post_merge** (`Optional[Callable[[bool], Awaitable]]` = `None`)
### merge_and_stop_live_session_async
```python
async def merge_and_stop_live_session_async(
target_layer: str = None,
comment: str = None,
pre_merge: Optional[Callable[[LiveSession], Awaitable]] = None,
post_merge: Optional[Callable[[bool, str], Awaitable]] = None,
layer_identifier: Optional[str] = None
) -> bool
```
Saves changes of Live Session to their base layer if it’s in live mode.
#### Parameters
- **target_layer** (str) – Target layer to merge all live changes to.
- **comment** (str) – The checkpoint comments.
- **pre_merge** (Callable[[LiveSession], Awaitable]) – It will be called before merge.
- **post_merge** (Callable[[bool, str], Awaitable]) – It will be called after merge is done. The first param means if it’s successful, and the second includes the error message if it’s not.
- **layer_identifier** (str) – The base layer of the Live Session. It’s root layer if it’s not provided.
### merge_changes_to_base_layers
```python
def merge_changes_to_base_layers(stop_session: bool) -> bool
```
[DEPRECATED] Merges changes of root layer’s Live Session to its base layer.
### merge_changes_to_specific_layer
```python
def merge_changes_to_specific_layer(
target_layer_identifier: str,
stop_session: bool,
clear_target_layer: bool
) -> bool
```
[DEPRECATED] Merges changes of root layer’s Live Session to specified layer.
```python
merge_live_session_changes(layer_identifier: str, stop_session: bool) -> bool
```
Merge Live Session for base layer.
**Parameters**
- **layer_identifier** (`str`) – The base layer to merge Live Session.
- **stop_session** (`bool`) – Stops the Live Session or not after merging.
**Returns**
- `True` if successful, `False` otherwise. If `False`, it might be due to the layer not being in the used layers of the current stage, having no Live Session joined, or lacking permissions to merge the Live Session. See `Layers.get_last_error_type` for more details.
```python
merge_live_session_changes_to_specific_layer(layer_identifier: str, target_layer_identifier: str, stop_session: bool, clear_target_layer: bool) -> bool
```
Merge Live Session for base layer to specified target layer.
**Parameters**
- **layer_identifier** (`str`) – The base layer to merge Live Session.
- **target_layer_identifier** (`str`) – The target layer to merge the Live Session.
- **stop_session** (`bool`) – Stops the Live Session or not after merging.
- **clear_target_layer** (`bool`) – If it needs to clear the target layer before merging.
**Returns**
- `True` if successful, `False` otherwise. If `False`, it might be due to the layer not being in the used layers of the current stage, having no Live Session joined, or lacking permissions to merge the Live Session. See `Layers.get_last_error_type` for more details.
### mute_live_session_merge_notice
By default, when session owner merges the session, it will notify peer clients to leave the session by showing a prompt. This is used to disable the prompt and stop session directly so it will not be disruptive especially for applications that don’t have layer window and manages all layers’ Live Sessions with scripting and don’t want to receive prompt for leaving sessions.
### open_stage_with_live_session_async
Opens stage with Live Session joined. This function is used to reduce the composition cost of opening a stage, then joining a Live Session by preparing the Live Session in the session layer before opening the stage. It supports to pass the name of Live Session as query string, for example, `omniverse://localhost/test/stage.usd?live_session_name=my_session`.
#### Parameters
- **stage_url** (str) – The stage url to open.
- **session_name** (str) – If the session name is not provided in the stage url, this param will be used. If both stage url and this param don’t include a valid session, it will return false.
#### Returns
A (bool, str) tuple, where the first element means if it’s success, and the error string in the second.
### stop_all_live_sessions
Stops all the Live Sessions that are enabled for the current stage.
### stop_live_session
Stops the Live Session for specified layer or prim.
#### Parameters
- **layer_identifier** (str) – The base layer to stop its current Live Session. If it’s None and prim_path is None, it’s root layer by default.
- **prim_path** (Sdf.Path) – The specified prim to stop the Live Session. If prim_path is given, and layer_identifier is None, it will stop all joined Live Sessions for this prim.
Or if layer_identifier is not None, it will stop only the Live Session for the layer.
### try_cancelling_live_session_join
```python
try_cancelling_live_session_join(layer_identifier: str) -> Optional[LiveSession]
```
Try to cancel the Live Session when LayerEventType.LIVE_SESSION_JOINING is received.
**Parameters:**
- **layer_identifier** (str) – The base layer to cancel.
**Returns:**
- Instance of Live Session if it’s cancelled successfully. Or None otherwise.
### unmute_live_session_merge_notice
```python
unmute_live_session_merge_notice(layer_identifier: str)
```
Remove layer identifier from mute list.
### layers_instance
```python
property layers_instance: ILayersInstance
```
Native handle of Layers instance that’s bound to an UsdContext.
### permission_to_merge_current_session
```python
property permission_to_merge_current_session: bool
```
[DEPRECATED] Checks to see if it can merge the current Live Session of specified layer.
**Parameters:**
- **layer_identifier** (str) – The base layer of the Live Session. It’s root layer if it’s not provided.
### usd_context
```python
property usd_context: UsdContext
```
Instance of UsdContext. | 17,202 |
omni.kit.usd.layers.LockLayerCommand.md | # LockLayerCommand
## Summary
Class `LockLayerCommand` in `omni.kit.usd.layers` sets the lock state for a layer.
### Constructor
`__init__(layer_identifier: str, locked: bool, usd_context: Union[str, UsdContext] = '')`
### Methods
- `__init__(layer_identifier, locked[, usd_context])`: Constructor.
- `do_impl()`: Abstract do function to be implemented.
| Description |
| --- |
| `undo_impl()` |
| Abstract undo function to be implemented. |
| Description |
| --- |
| `__init__(layer_identifier: str, locked: bool, usd_context: Union[str, UsdContext] = '')` |
| Constructor. REMINDER: Locking root layer is not permitted. |
| **Keyword Arguments** |
| - **layer_identifier** (str) – The identifier of layer to be muted/unmuted. |
| - **locked** (bool) – Muted or not of this layer. |
| - **usd_context** (Union[str, UsdContext]) – Usd context name or instance. It uses default context if it’s empty. |
| Description |
| --- |
| `do_impl()` |
| Abstract do function to be implemented. |
| Description |
| --- |
| `undo_impl()` |
| Abstract undo function to be implemented. | | 1,079 |
omni.kit.usd.layers.LockSpecsCommand.md | # LockSpecsCommand
## Class: omni.kit.usd.layers.LockSpecsCommand
### Constructor
```python
__init__(spec_paths: Union[str, List[str]], hierarchy: bool = False, usd_context: Union[str, UsdContext] = '')
```
**Bases:** `AbstractLayerCommand`
**Description:**
Locks spec paths in the UsdContext.
**Methods:**
- `__init__(spec_paths[, hierarchy, usd_context])`
| Constructor. |
| --- |
| `do`() |
| `undo`() |
### __init__
Constructor.
**Keyword Arguments**
- **spec_paths** (Union[str, List[str]]) – List of spec paths or single spec path to be locked.
- **hierarchy** (bool) – Locking descendant specs or not.
- **usd_context** (Union[str, omni.usd.UsdContext]) – Usd context name or instance. It uses default context if it’s empty. | 738 |
omni.kit.usd.layers.lock_specs.md | # lock_specs
## lock_specs
```python
omni.kit.usd.layers.lock_specs(usd_context, spec_paths: Union[str, Path, List[Union[str, Path]]], hierarchy = False) -> List[str]
```
- **usd_context**
- **spec_paths**: Union[str, Path, List[Union[str, Path]]]
- **hierarchy**: default is False
- **Returns**: List[str]
``` | 312 |
omni.kit.usd.layers.MergeLayersCommand.md | # MergeLayersCommand
## MergeLayersCommand
```python
class omni.kit.usd.layers.MergeLayersCommand(
dst_parent_layer_identifier: str,
dst_layer_identifier,
src_parent_layer_identifier: str,
src_layer_identifier: str,
dst_stronger_than_src: bool,
usd_context: Union[str, UsdContext] = '',
src_layer_offset: LayerOffset = Sdf.LayerOffset()
)
```
Bases:
AbstractLayerCommand
Merges two layers.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(dst_parent_layer_identifier, dst_layer_identifier, src_parent_layer_identifier, src_layer_identifier, dst_stronger_than_src: bool = True, usd_context: Union[str, UsdContext] = '', src_layer_offset: LayerOffset = Sdf.LayerOffset())` | Constructor. |
| `do_impl()` | Abstract do function to be implemented. |
| `undo_impl()` | Abstract undo function to be implemented. |
#### `__init__(dst_parent_layer_identifier, dst_layer_identifier, src_parent_layer_identifier, src_layer_identifier, dst_stronger_than_src: bool = True, usd_context: Union[str, UsdContext] = '', src_layer_offset: LayerOffset = Sdf.LayerOffset())`
Constructor.
**Keyword Arguments:**
- **dst_parent_layer_identifier** – The parent of target layer.
- **dst_layer_identifier** – The target layer that source layer is merged to.
- **src_parent_layer_identifier** – The parent of source layer.
- **src_layer_identifier** – The source layer.
- **dst_stronger_than_src** (bool) – If target layer is stronger than source, which will decide how to merge opinions that appear in both layers.
- **usd_context** (Union[str, UsdContext]) –
- **src_layer_offset** (LayerOffset) –
- **context** ([str, omni.usd.UsdContext]) – Usd context name or instance. It uses default context if it’s empty.
- **src_layer_offset** (Sdf.LayerOffset) – The source layer offset to target layer. By default, it’s identity.
### do_impl()
Abstract do function to be implemented.
### undo_impl()
Abstract undo function to be implemented. | 1,975 |
omni.kit.usd.layers.MovePrimSpecsToLayerCommand.md | # MovePrimSpecsToLayerCommand
## MovePrimSpecsToLayerCommand
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
__init__
(dst_layer_identifier, ...[, ...])
<td>
<p>
Constructor.
<tr class="row-even">
<td>
<p>
<a class="reference internal" href="#omni.kit.usd.layers.MovePrimSpecsToLayerCommand.do_impl" title="omni.kit.usd.layers.MovePrimSpecsToLayerCommand.do_impl">
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
do_impl
()
<td>
<p>
Abstract do function to be implemented.
<tr class="row-odd">
<td>
<p>
<a class="reference internal" href="#omni.kit.usd.layers.MovePrimSpecsToLayerCommand.undo_impl" title="omni.kit.usd.layers.MovePrimSpecsToLayerCommand.undo_impl">
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
undo_impl
()
<td>
<p>
Abstract undo function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.MovePrimSpecsToLayerCommand.__init__">
<span class="sig-name descname">
<span class="pre">
__init__
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
dst_layer_identifier
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
str
,
<em class="sig-param">
<span class="n">
<span class="pre">
src_layer_identifier
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
str
,
<em class="sig-param">
<span class="n">
<span class="pre">
prim_spec_path
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
str
,
<em class="sig-param">
<span class="n">
<span class="pre">
dst_stronger_than_src
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
bool
,
<em class="sig-param">
<span class="n">
<span class="pre">
usd_context
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
Union
<span class="p">
<span class="pre">
[
<span class="pre">
str
<span class="p">
<span class="pre">
,
<span class="w">
<span class="pre">
UsdContext
<span class="p">
<span class="pre">
]
<span class="w">
<span class="o">
<span class="pre">
=
<span class="w">
<span class="default_value">
<span class="pre">
''
<span class="sig-paren">
)
<a class="headerlink" href="#omni.kit.usd.layers.MovePrimSpecsToLayerCommand.__init__" title="Permalink to this definition">
<dd>
<p>
Constructor.
<dl class="field-list simple">
<dt class="field-odd">
Keyword Arguments
<dd class="field-odd">
<ul class="simple">
<li>
<p>
<strong>
dst_layer_identifier
(
<em>
str
) – The identifier of target layer.
<li>
<p>
<strong>
src_layer_identifier
(
<em>
str
) – The identifier of source layer.
<li>
<p>
<strong>
prim_spec_path
(
<em>
str
) – The prim spec path to be merged.
<li>
<p>
<strong>
dst_stronger_than_src
(
<em>
bool
) – Target layer is stronger than source layer in stage.
<li>
<p>
<strong>
usd_context
(
<em>
Union
<em>
[
<em>
str
<em>
,
<em>
omni.usd.UsdContext
<em>
]
) – Usd context name or instance. It uses default context if it’s empty.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.MovePrimSpecsToLayerCommand.do_impl">
<span class="sig-name descname">
<span class="pre">
do_impl
<span class="sig-paren">
(
<span class="sig-paren">
)
<a class="headerlink" href="#omni.kit.usd.layers.MovePrimSpecsToLayerCommand.do_impl" title="Permalink to this definition">
<dd>
<p>
Abstract do function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.MovePrimSpecsToLayerCommand.undo_impl">
<span class="sig-name descname">
<span class="pre">
undo_impl
<span class="sig-paren">
(
<span class="sig-paren">
)
<a class="headerlink" href="#omni.kit.usd.layers.MovePrimSpecsToLayerCommand.undo_impl" title="Permalink to this definition">
<dd>
<p>
Abstract undo function to be implemented.
<footer>
<hr/>
```
请注意,上述Markdown代码实际上是无效的,因为它直接复制了HTML的结束标签,这在Markdown中是不被识别的。为了提供一个有效的转换示例,我需要具体的HTML内容。例如,如果HTML中有段落和链接,转换可能如下:
```html
<p>这是一个包含 <a href="http://example.com">链接
```
转换为Markdown:
```markdown
这是一个包含 [链接] 的段落。
```
在这个例子中,链接的URL被删除,但链接文本被保留。如果HTML中有图片,例如:
```html
<img src="image.jpg" alt="描述图片的文本">
```
转换为Markdown时,图片会被删除:
```markdown
描述图片的文本 | 4,406 |
omni.kit.usd.layers.MoveSublayerCommand.md | # MoveSublayerCommand
## MoveSublayerCommand
```python
class omni.kit.usd.layers.MoveSublayerCommand:
def __init__(self, from_parent_layer_identifier: str, from_sublayer_position: int, to_parent_layer_identifier: str, to_sublayer_position: int, remove_source: bool = False, usd_context: Union[str, UsdContext] = ''):
pass
```
This class is a part of the `omni.kit.usd.layers` module.
AbstractLayerCommand
Moves sublayer from one location to the other.
### Methods
| Method | Description |
|--------|-------------|
| `__init__(from_parent_layer_identifier, from_sublayer_position, to_parent_layer_identifier, to_sublayer_position, remove_source=False, usd_context='')` | Constructor. |
| `do_impl()` | Abstract do function to be implemented. |
| `undo_impl()` | Abstract undo function to be implemented. |
#### `__init__(from_parent_layer_identifier, from_sublayer_position, to_parent_layer_identifier, to_sublayer_position, remove_source=False, usd_context='')`
Constructor.
**Keyword Arguments:**
- **from_parent_layer_identifier** (str) – The identifier of source parent layer.
- **from_sublayer_position** (int) – The sublayer position in source parent layer to move.
- **to_parent_layer_identifier** (str) – The identifier of target parent layer.
- **to_sublayer_position** (int) – The sublayer position in target parent layer that layers moves to. If this position is -1, it means the last position of sublayer array. If this position is beyond the end of sublayer array, it means to move this layer to the end of that array. Otherwise, it’s invalid if it’s below 0.
- **remove_source** (bool) – Remove source sublayer after moving to target or not.
**usd_context** (**Union** [**str**, **omni.usd.UsdContext**]) – Usd context name or instance. It uses default context if it’s empty.
### do_impl
Abstract do function to be implemented.
### undo_impl
Abstract undo function to be implemented. | 1,919 |
omni.kit.usd.layers.RemovePrimSpecCommand.md | # RemovePrimSpecCommand
## RemovePrimSpecCommand
```
class omni.kit.usd.layers.RemovePrimSpecCommand(layer_identifier: str, prim_spec_path: Union[Path, List[Path]], usd_context: Union[str, UsdContext] = '')
```
Bases: `Command`
Removes prim spec from a layer.
### Methods
- `__init__(layer_identifier, prim_spec_path[, ...])`
- Constructor.
```
| do |
| --- |
| undo |
### omni.kit.usd.layers.RemovePrimSpecCommand.__init__
__init__(layer_identifier: str, prim_spec_path: Union[Path, List[Path]], usd_context: Union[str, UsdContext] = '')
Constructor.
**Keyword Arguments**
- **layer_identifier** (str) – The identifier of layer to remove prim.
- **prim_spec_path** (Union[Sdf.Path, List[Sdf.Path]]) – The prim paths to be removed.
- **usd_context** (Union[str, omni.usd.UsdContext]) – Usd context name or instance. It uses default context if it’s empty. | 865 |
omni.kit.usd.layers.RemoveSublayerCommand.md | # RemoveSublayerCommand
## RemoveSublayerCommand
```
```markdown
class omni.kit.usd.layers.RemoveSublayerCommand(layer_identifier: str, sublayer_position: int, usd_context: Union[str, UsdContext] = '')
```
```markdown
Bases: AbstractLayerCommand
```
```markdown
Removes a sublayer from parent layer.
```
```markdown
## Methods
```
```markdown
__init__(layer_identifier, sublayer_position)
Constructor.
```
```markdown
do_impl()
Abstract do function to be implemented.
```
<table>
<tbody>
<tr class="row-even">
<td>
<p>
<a class="reference internal" href="#omni.kit.usd.layers.RemoveSublayerCommand.do_impl" title="omni.kit.usd.layers.RemoveSublayerCommand.do_impl">
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
do_impl
()
<td>
<p>
Abstract do function to be implemented.
<tr class="row-odd">
<td>
<p>
<a class="reference internal" href="#omni.kit.usd.layers.RemoveSublayerCommand.undo_impl" title="omni.kit.usd.layers.RemoveSublayerCommand.undo_impl">
<code class="xref py py-obj docutils literal notranslate">
<span class="pre">
undo_impl
()
<td>
<p>
Abstract undo function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.RemoveSublayerCommand.__init__">
<span class="sig-name descname">
<span class="pre">
__init__
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
layer_identifier
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
str
,
<em class="sig-param">
<span class="n">
<span class="pre">
sublayer_position
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
int
,
<em class="sig-param">
<span class="n">
<span class="pre">
usd_context
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
Union
<span class="p">
<span class="pre">
[
<span class="pre">
str
<span class="p">
<span class="pre">
,
<span class="w">
<span class="pre">
UsdContext
<span class="p">
<span class="pre">
]
<span class="w">
<span class="o">
<span class="pre">
=
<span class="w">
<span class="default_value">
<span class="pre">
''
<span class="sig-paren">
)
<dd>
<p>
Constructor.
<dl class="field-list simple">
<dt class="field-odd">
Keyword Arguments
<dd class="field-odd">
<ul class="simple">
<li>
<p>
<strong>
layer_identifier
(
<em>
str
) – The identifier of layer to remove sublayer.
<li>
<p>
<strong>
sublayer_position
(
<em>
int
) – The sublayer position to be removed.
<li>
<p>
<strong>
usd_context
(
<em>
Union
<em>
[
<em>
str
<em>
,
<em>
omni.usd.UsdContext
<em>
]
) – Usd context name or instance. It uses default context if it’s empty.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.RemoveSublayerCommand.do_impl">
<span class="sig-name descname">
<span class="pre">
do_impl
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Abstract do function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.RemoveSublayerCommand.undo_impl">
<span class="sig-name descname">
<span class="pre">
undo_impl
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Abstract undo function to be implemented.
| 5,382 |
omni.kit.usd.layers.ReplaceSublayerCommand.md | # ReplaceSublayerCommand
## Class Definition
```python
class omni.kit.usd.layers.ReplaceSublayerCommand(layer_identifier: str, sublayer_position: int, new_layer_path: str, usd_context: Union[str, UsdContext] = '')
```
**Bases:**
[`AbstractLayerCommand`](omni.kit.usd.layers._impl.layer_commands.AbstractLayerCommand)
**Description:**
Replaces sublayer with a new layer.
## Methods
| Method | Description |
|--------|-------------|
| `__init__(layer_identifier, sublayer_position, new_layer_path, [usd_context])` | Constructor. |
| `do_impl()` | |
```
| Method | Description |
|--------|-------------|
| `do_impl()` | Abstract do function to be implemented. |
| `undo_impl()` | Abstract undo function to be implemented. |
### `__init__(layer_identifier: str, sublayer_position: int, new_layer_path: str, usd_context: Union[str, UsdContext] = '')`
Constructor.
**Keyword Arguments:**
- **layer_identifier** (str) – The identifier of layer to replace sublayer.
- **sublayer_position** (int) – The sublayer position to be replaced.
- **new_layer_path** (str) – The path of new layer.
- **usd_context** (Union[str, UsdContext]) – Usd context name or instance. It uses default context if it’s empty.
### `do_impl()`
Abstract do function to be implemented.
### `undo_impl()`
Abstract undo function to be implemented. | 1,319 |
omni.kit.usd.layers.SetEditTargetCommand.md | # SetEditTargetCommand
## SetEditTargetCommand
```python
class omni.kit.usd.layers.SetEditTargetCommand(layer_identifier: str, usd_context: Union[str, UsdContext] = '')
```
**Bases:**
[AbstractLayerCommand](omni.kit.usd.layers._impl.layer_commands.AbstractLayerCommand)
**Description:**
Sets layer as Edit Target.
### Methods
- **__init__(layer_identifier[, usd_context])**
- **Description:** Constructor.
- **do_impl()**
- **Description:** Abstract do function to be implemented.
- **undo_impl()**
- **Description:** Abstract undo function to be implemented.
```
| Abstract undo function to be implemented. |
| --- |
| Constructor. |
| Keyword Arguments |
| - **layer_identifier** (str) – Layer identifier. |
| - **usd_context** (Union[str, omni.usd.UsdContext]) – Usd context name or instance. It uses default context if it’s empty. |
| Abstract do function to be implemented. |
| Abstract undo function to be implemented. | | 942 |
omni.kit.usd.layers.SetLayerMutenessCommand.md | # SetLayerMutenessCommand
## SetLayerMutenessCommand
```python
class omni.kit.usd.layers.SetLayerMutenessCommand(layer_identifier: str, muted: bool, usd_context: Union[str, UsdContext] = '')
```
Bases: `AbstractLayerCommand`
Sets mute state for layer.
### Methods
| Method | Description |
| --- | --- |
| `__init__(layer_identifier, muted[, usd_context])` | Constructor. |
| `do_impl()` | Abstract do function to be implemented. |
```
<table>
<tbody>
<tr class="row-odd">
<td>
<p>
<code>undo_impl
()
<td>
<p>
Abstract undo function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.SetLayerMutenessCommand.__init__">
<span class="sig-name descname">
<span class="pre">
__init__
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
layer_identifier
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
str
,
<em class="sig-param">
<span class="n">
<span class="pre">
muted
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
bool
,
<em class="sig-param">
<span class="n">
<span class="pre">
usd_context
<span class="p">
<span class="pre">
:
<span class="w">
<span class="n">
<span class="pre">
Union
<span class="p">
<span class="pre">
[
<span class="pre">
str
<span class="p">
<span class="pre">
,
<span class="w">
<span class="pre">
UsdContext
<span class="p">
<span class="pre">
]
<span class="w">
<span class="o">
<span class="pre">
=
<span class="w">
<span class="default_value">
<span class="pre">
''
<span class="sig-paren">
)
<dd>
<p>
Constructor.
<dl class="field-list simple">
<dt class="field-odd">
Keyword Arguments
<dd class="field-odd">
<ul class="simple">
<li>
<p>
<strong>
layer_identifier
(
<em>
str
) – The identifier of layer to be muted/unmuted.
<li>
<p>
<strong>
muted
(
<em>
bool
) – Muted or not of this layer.
<li>
<p>
<strong>
usd_context
(
<em>
Union
<em>
[
<em>
str
<em>
,
<em>
omni.usd.UsdContext
<em>
]
) – Usd context name or instance. It uses default context if it’s empty.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.SetLayerMutenessCommand.do_impl">
<span class="sig-name descname">
<span class="pre">
do_impl
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Abstract do function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.SetLayerMutenessCommand.undo_impl">
<span class="sig-name descname">
<span class="pre">
undo_impl
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Abstract undo function to be implemented.
| 4,520 |
omni.kit.usd.layers.SpecsLinking.md | # SpecsLinking
## Methods
- `__init__(layers_instance, usd_context)`
- `get_all_spec_links()`
- `get_spec_layer_links(spec_path[, hierarchy])`
- `get_spec_links_for_layer(layer_identifier)`
- `is_enabled()`
- `is_spec_linked(spec_path[, layer_identifier])`
- `link_spec(spec_path, layer_identifier[, ...])`
```code
unlink_all_specs
```
```code
unlink_spec
(spec_path, layer_identifier[, ...])
```
```code
unlink_spec_from_all_layers
(spec_path[, ...])
```
```code
unlink_specs_to_layer
(layer_identifier)
```
```code
usd_context
```
```python
__init__(layers_instance: ILayersInstance, usd_context) -> None
``` | 617 |
omni.kit.usd.layers.SpecsLocking.md | # SpecsLocking
## Methods
### `__init__(layers_instance, usd_context)`
### `get_all_locked_specs()`
### `is_spec_locked(spec_path)`
### `lock_spec(spec_path[, hierarchy])`
### `unlock_all_specs()`
### `unlock_spec(spec_path[, hierarchy])`
## Attributes
### `usd_context`
```
__init__
(
layers_instance : ILayersInstance,
usd_context
)
→ None
``` | 351 |
omni.kit.usd.layers.SpecsLocking_omni.kit.usd.layers.SpecsLocking.md | # SpecsLocking
## Methods
- `__init__(layers_instance, usd_context)`
- `get_all_locked_specs()`
- `is_spec_locked(spec_path)`
- `lock_spec(spec_path[, hierarchy])`
- `unlock_all_specs()`
- `unlock_spec(spec_path[, hierarchy])`
## Attributes
- `usd_context` | 260 |
omni.kit.usd.layers.StitchPrimSpecsToLayer.md | # StitchPrimSpecsToLayer
## StitchPrimSpecsToLayer
```python
class omni.kit.usd.layers.StitchPrimSpecsToLayer(prim_paths: List[str], target_layer_identifier: str, usd_context: Union[str, UsdContext] = '')
```
Bases: `AbstractLayerCommand`
Flatten specific prims in the stage. It will remove original prim specs after flatten.
### Methods
- `__init__(prim_paths, target_layer_identifier)`
- Constructor.
- `do_impl()`
- (Method description not provided in HTML)
```
<table>
<tbody>
<tr class="row-even">
<td>
<p>
<code>do_impl
<td>
<p>
Abstract do function to be implemented.
<tr class="row-odd">
<td>
<p>
<code>undo_impl
<td>
<p>
Abstract undo function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.StitchPrimSpecsToLayer.__init__">
<span class="sig-name descname">
<span class="pre">__init__
<span class="sig-paren">(
<em class="sig-param">
<span class="n">prim_paths
<span class="p">:
<span class="n">List[str]
,
<em class="sig-param">
<span class="n">target_layer_identifier
<span class="p">:
<span class="n">str
,
<em class="sig-param">
<span class="n">usd_context
<span class="p">:
<span class="n">Union[str, UsdContext]
<span class="o">=
<span class="default_value">''
<span class="sig-paren">)
<dd>
<p>Constructor.
<dl class="field-list simple">
<dt class="field-odd">Keyword Arguments
<dd class="field-odd">
<ul class="simple">
<li>
<p>
<strong>prim_paths
<li>
<p>
<strong>target_layer_identifier
<li>
<p>
<strong>usd_context
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.StitchPrimSpecsToLayer.do_impl">
<span class="sig-name descname">
<span class="pre">do_impl
<span class="sig-paren">()
<dd>
<p>Abstract do function to be implemented.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.usd.layers.StitchPrimSpecsToLayer.undo_impl">
<span class="sig-name descname">
<span class="pre">undo_impl
<span class="sig-paren">()
<dd>
<p>Abstract undo function to be implemented.
| 2,603 |
omni.kit.usd.layers.UnlinkSpecsCommand.md | # UnlinkSpecsCommand
## UnlinkSpecsCommand
```python
class omni.kit.usd.layers.UnlinkSpecsCommand:
def __init__(self, spec_paths: Union[str, List[str]], layer_identifiers: Union[str, List[str]], hierarchy=False, usd_context: Union[str, UsdContext] = ''):
pass
Bases:
AbstractLayerCommand
```
```markdown
Unlinks spec paths to layers.
```
```markdown
Methods
```
```markdown
| | |
| ---- | --------------------------------------------------------------- |
| __init__ (spec_paths, layer_identifiers[, ...]) | Constructor. |
| do () | |
| undo () | |
```
```markdown
__init__ (spec_paths: Union[str, List[str]], layer_identifiers: Union[str, List[str]], hierarchy: bool = False, usd_context: Union[str, UsdContext] = '')
```
```markdown
Constructor.
```
```markdown
Keyword Arguments
```
```markdown
* spec_paths (Union[str, List[str]]) – List of spec paths or single spec path to be unlinked.
* layer_identifiers (Union[str, List[str]]) – List of layer identifiers or single layer identifier.
```
```markdown
- **hierarchy** (**bool**) – Unlinking descendant specs or not.
- **usd_context** (**Union[str, omni.usd.UsdContext]**) – Usd context name or instance. It uses default context if it’s empty. | 1,396 |
omni.kit.usd.layers.unlink_specs.md | # unlink_specs
## unlink_specs
```
```markdown
omni.kit.usd.layers.unlink_specs(usd_context, spec_paths: Union[str, Path, List[Union[str, Path]]], layer_identifiers: Union[str, List[str]], hierarchy = False) -> Dict[str, List[str]]
```
```markdown
Description:
This function unlinks specified specifications from all layers in the USD context.
Parameters:
- usd_context: The USD context to operate on.
- spec_paths: The paths of the specifications to unlink. Can be a string, a Path object, or a list of strings or Path objects.
- layer_identifiers: The identifiers of the layers to unlink the specifications from. Can be a string or a list of strings.
- hierarchy (optional): If set to True, also unlink the specifications from the parent layers. Default is False.
Returns:
- A dictionary where the keys are the layer identifiers and the values are lists of the paths of the unlinked specifications.
```
```markdown
Example usage:
```
```python
from omni.kit.usd.layers import unlink_specs
# Unlink a single specification
result = unlink_specs("my_usd_context", "/path/to/spec", "layer1")
# Unlink multiple specifications
result = unlink_specs("my_usd_context", ["/path/to/spec1", "/path/to/spec2"], ["layer1", "layer2"])
# Unlink with hierarchy
result = unlink_specs("my_usd_context", "/path/to/spec", "layer1", hierarchy=True)
```
```markdown
Note:
The function operates on the specified USD context and unlinks the specified specifications from the specified layers. If hierarchy is enabled, it also unlinks the specifications from the parent layers.
[str] | 1,571 |
omni.kit.usd.layers.UnlockSpecsCommand.md | # UnlockSpecsCommand
## Class: omni.kit.usd.layers.UnlockSpecsCommand
### Constructor
```python
class omni.kit.usd.layers.UnlockSpecsCommand:
def __init__(spec_paths: Union[str, List[str]], hierarchy=False, usd_context: Union[str, UsdContext] = '')
```
**Bases:** `AbstractLayerCommand`
**Description:**
Unlocks spec paths in the UsdContext
**Methods:**
- `__init__(spec_paths: Union[str, List[str]], hierarchy=False, usd_context: Union[str, UsdContext] = '')`
| Constructor. |
| --- |
| `do`() |
| `undo`() |
### `__init__`
**Keyword Arguments**
- **spec_paths** (`Union`[`str`, `List`[`str`]]) – List of spec paths or single spec path to be unlocked.
- **hierarchy** (`bool`) – Unlocking descendant specs or not.
- **usd_context** (`Union`[`str`, `omni.usd.UsdContext`]) – Usd context name or instance. It uses default context if it’s empty. | 855 |
omni.kit.usd.layers.unlock_specs.md | # unlock_specs
## unlock_specs
```python
omni.kit.usd.layers.unlock_specs(usd_context, spec_paths: Union[str, List[str]], hierarchy=False) -> List[str]
```
- **Parameters**:
- `usd_context`
- `spec_paths`: Union[str, List[str]]
- `hierarchy`: bool = False
- **Returns**: List[str]
``` | 293 |
omni.kit.usd_undo.Classes.md | # omni.kit.usd_undo Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| [UsdEditTargetUndo](#) | A class for managing undo operations on a USD edit target. |
| [UsdLayerUndo](#) | A class for managing undo operations on USD layers. | | 271 |
omni.kit.usd_undo.layer_undo.UsdEditTargetUndo.md | # UsdEditTargetUndo
## UsdEditTargetUndo
```python
class omni.kit.usd_undo.layer_undo.UsdEditTargetUndo(edit_target: EditTarget)
```
Bases: `UsdLayerUndo`
A class for managing undo operations on a USD edit target.
This class provides methods to reserve and undo changes made to a USD layer through an edit target.
**Parameters**
- **edit_target** – Usd.EditTarget
The edit target to be managed for undo operations.
**Methods**
- `__init__(edit_target)`
- Initializes a UsdEditTargetUndo instance with the given edit target.
- `reserve(path[, info])`
- Reserves the specified path and info for undo, mapped to the edit target's namespace.
### UsdEditTargetUndo Class
#### `__init__(edit_target)`
Initializes a UsdEditTargetUndo instance with the given edit target.
**Parameters:**
- **edit_target** (`Usd.EditTarget`) – The edit target to be managed for undo operations.
#### `reserve(path, info=None)`
Reserves the specified path and info for undo, mapped to the edit target’s namespace.
**Parameters:**
- **path** (`Sdf.Path`) – The path to be reserved.
- **info** (`str`, optional) – The info key to be reserved. If None, the entire spec is reserved. | 1,169 |
omni.kit.usd_undo.layer_undo.UsdLayerUndo.md | # UsdLayerUndo
## UsdLayerUndo
```python
class omni.kit.usd_undo.layer_undo.UsdLayerUndo(layer: Layer)
```
A class for managing undo operations on USD layers.
This class encapsulates the functionality to reserve changes, perform undo operations, and reset the undo stack for a USD layer. It is designed to work with Sdf.Layer objects, allowing for precise control over the changes made to the layer.
**Parameters**
- **layer** – Sdf.Layer
The Sdf.Layer object on which the undo operations are performed.
### Methods
- **__init__(layer)**
Initializes the UsdLayerUndo instance.
- **reserve(path[, info])**
Reserves the changes made to the path in the USD layer to allow undo operations.
- **reset()**
Resets the internal state of the UsdLayerUndo instance, clearing any changes reserved.
- **undo()**
Undoes the last reserved change on the USD layer.
```
## UsdLayerUndo Methods
### reserve
Reserves the changes made to the path in the USD layer to allow undo operations.
**Parameters:**
- **path** (Sdf.Path) – The path in the USD layer to reserve.
- **info** (optional) – Additional information about the reservation, default is None.
### reset
Resets the internal state of the UsdLayerUndo instance, clearing any changes reserved.
### undo
Undoes the last set of changes reserved by the reserve method.
**Raises:**
- **Exception** – If the layer cannot be found.
## UsdLayerUndo Class
### __init__
Initializes the UsdLayerUndo instance.
**Parameters:**
- **layer** (Sdf.Layer) – The USD layer to be managed by this undo instance.
### Key
A class to represent a key in the undo system for USD layers.
**Parameters:**
- **path** – Sdf.Path
The path associated with the change to be undone.
- **info** – Any
Optional information associated with the path, such as a specific attribute or metadata key. | 1,829 |
omni.kit.usd_undo.md | # omni.kit.usd_undo
## Submodules
Summary:
- [omni.kit.usd_undo.layer_undo](omni.kit.usd_undo.layer_undo.html)
- Contains the class of UsdLayerUndo and UsdEditTargetUndo
## Classes
Summary:
- [UsdEditTargetUndo](omni.kit.usd_undo/omni.kit.usd_undo.UsdEditTargetUndo.html)
- A class for managing undo operations on a USD edit target.
- [UsdLayerUndo](omni.kit.usd_undo/omni.kit.usd_undo.UsdLayerUndo.html)
- A class for managing undo operations on USD layers. | 468 |
omni.kit.usd_undo.Submodules.md | # omni.kit.usd_undo Submodules
## omni.kit.usd_undo Submodules
### Submodules Summary:
| Module | Description |
|--------|-------------|
| [omni.kit.usd_undo.layer_undo](omni.kit.usd_undo.layer_undo.html) | Contains the class of UsdLayerUndo and UsdEditTargetUndo | | 266 |
omni.kit.usd_undo.UsdEditTargetUndo.md | # UsdEditTargetUndo
## UsdEditTargetUndo
A class for managing undo operations on a USD edit target.
This class provides methods to reserve and undo changes made to a USD layer through an edit target.
### Parameters
- **edit_target** – Usd.EditTarget
The edit target to be managed for undo operations.
### Methods
- **__init__(edit_target)**
Initializes a UsdEditTargetUndo instance with the given edit target.
- **reserve(path[, info])**
Reserves the specified path and info for undo, mapped to the edit target's namespace.
## Parameters
- **edit_target** (`Usd.EditTarget`) – The edit target to be managed for undo operations.
## reserve
Reserves the specified path and info for undo, mapped to the edit target’s namespace.
### Parameters
- **path** (`Sdf.Path`) – The path to be reserved.
- **info** (`str`, optional) – The info key to be reserved. If None, the entire spec is reserved. | 902 |
omni.kit.viewport.docs.Classes.md | # omni.kit.viewport.docs Classes
## Classes Summary
- **ViewportDocsExtension**
- [ViewportDocsExtension Documentation](./omni.kit.viewport.docs/omni.kit.viewport.docs.ViewportDocsExtension.html) | 199 |
omni.kit.viewport.docs.extension.ViewportDocsExtension.md | # ViewportDocsExtension
## ViewportDocsExtension
```
class omni.kit.viewport.docs.extension.ViewportDocsExtension
```
Bases: `IExt`
### Methods
| Method | Description |
|---------------|-------------|
| `on_shutdown()` | |
| `on_startup(ext_id)` | |
```python
def __init__(self: omni.ext._extensions.IExt) -> None:
pass
```
``` | 365 |
omni.kit.viewport.docs.md | # omni.kit.viewport.docs
## Submodules
Summary:
- **omni.kit.viewport.docs.extension**
- No submodule docstring provided
- **omni.kit.viewport.docs.window**
- No submodule docstring provided
## Classes
Summary:
- **ViewportDocsExtension** | 247 |
omni.kit.viewport.docs.Submodules.md | # omni.kit.viewport.docs Submodules
## Submodules Summary
- **omni.kit.viewport.docs.extension**
- No submodule docstring provided
- **omni.kit.viewport.docs.window**
- No submodule docstring provided | 207 |
omni.kit.viewport.docs.window.ViewportDocsWindow.md | # ViewportDocsWindow
## Arguments
- `title: str`
### Attributes
### Methods
- `__init__(title: str, **kwargs)`
- ### Arguments
- `title: str`
<dl>
<dt>
<p>
The title of the window.
<dt>
`filenames: List[str]`
<dt>
`show_catalog: bool`
| 279 |
omni.kit.viewport.legacy_gizmos.md | # omni.kit.viewport.legacy_gizmos
## Module Overview
### omni.kit.viewport.legacy_gizmos
#### Description
This module provides functionalities related to legacy gizmos in the viewport.
#### Documentation Links
- [API (python)](API.html)
- [Modules](Modules.html)
#### Navigation
- [Home](https://docs.omniverse.nvidia.com/kit/docs)
- [Changelog](CHANGELOG.html) (Next)
- [Modules](Modules.html) (Previous)
#### Search
- [Search docs](search.html)
#### Footer
- [Index](genindex.html)
- [Search](search.html) | 514 |
omni.kit.viewport.menubar.display.Classes.md | # omni.kit.viewport.menubar.display Classes
## Classes Summary:
| Class | Description |
|-------|-------------|
| [ViewportDisplayMenuBarExtension](omni.kit.viewport.menubar.display/omni.kit.viewport.menubar.display.ViewportDisplayMenuBarExtension.html) | The Entry Point for the Display Settings in Viewport Menu Bar | | 321 |
omni.kit.viewport.menubar.display.display_menu_container.Classes.md | # omni.kit.viewport.menubar.display.display_menu_container Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| DisplayMenuContainer | The menu with the visibility settings | | 211 |
omni.kit.viewport.menubar.display.display_menu_container.DisplayMenuContainer.md | # DisplayMenuContainer
## DisplayMenuContainer
```
The menu with the visibility settings
### Methods
| Method | Description |
|--------|-------------|
| `__init__(self)` | |
| `build_fn(viewport_context)` | Reimplement it to have own customized item |
| `deregister_custom_category_item(category, item)` | |
| `deregister_custom_setting(text)` | |
| `destroy()` | |
| `register_custom_category_item(category, ...)` | |
```code
register_custom_setting
```
(text, setting_path)
<p>
### Attributes
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.display_menu_container.DisplayMenuContainer.__init__">
```code
__init__
```
(
<em>
<span>
self
<span>
:
<span>
<span>
omni.ui._ui.AbstractItem
)
→
```code
None
```
<dd>
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.display_menu_container.DisplayMenuContainer.build_fn">
```code
build_fn
```
(
<em>
<span>
viewport_context
<span>
:
<span>
<span>
dict
)
<dd>
<p>
Reimplement it to have own customized item
```
---
<footer>
<hr/>
| 1,091 |
omni.kit.viewport.menubar.display.display_menu_container.md | # omni.kit.viewport.menubar.display.display_menu_container
## Classes Summary:
| Class | Description |
|-------|-------------|
| [DisplayMenuContainer](omni.kit.viewport.menubar.display.display_menu_container/omni.kit.viewport.menubar.display.display_menu_container.DisplayMenuContainer.html) | The menu with the visibility settings | | 336 |
omni.kit.viewport.menubar.display.extension.Classes.md | # omni.kit.viewport.menubar.display.extension Classes
## Classes Summary
- **ViewportDisplayMenuBarExtension**
- The Entry Point for the Display Settings in Viewport Menu Bar | 178 |
omni.kit.viewport.menubar.display.extension.Functions.md | # omni.kit.viewport.menubar.display.extension Functions
## Functions Summary
- [get_instance](omni.kit.viewport.menubar.display.extension/omni.kit.viewport.menubar.display.extension.get_instance.html) | 202 |
omni.kit.viewport.menubar.display.extension.ViewportDisplayMenuBarExtension.md | # ViewportDisplayMenuBarExtension
The Entry Point for the Display Settings in Viewport Menu Bar
## Methods
- `deregister_custom_category_item(category, item)`
- Deregister custom display setting in category.
- `deregister_custom_setting(text)`
- Deregister custom display setting.
- `on_shutdown()`
- `on_startup(ext_id)`
- `register_custom_category_item(category, item)`
- Register custom display setting in category.
| Method | Description |
| --- | --- |
| `register_custom_setting(text, setting_path)` | Register custom display setting. |
| `__init__(self: omni.ext._extensions.IExt) -> None` | Initialize the extension. |
| `deregister_custom_category_item(category: str, item: BaseCategoryItem)` | Deregister custom display setting in category. |
| `deregister_custom_setting(text: str)` | Deregister custom display setting. |
| `register_custom_category_item(category: str, item: BaseCategoryItem, section: str = 'default')` | Register custom display setting in category. |
<section name="omni.kit.viewport.menubar.display.extension.ViewportDisplayMenuBarExtension">
<dl class="tableblock frame-all grid-all">
<dt class="tableblock halign-left valign-top">
<em class="sig sig-object docutils container">
<span class="pre">
def
<span class="w">
register_custom_setting
<span class="sig-paren">
(
<span class="n">
<span class="pre">
text
<span class="sig-paren">
:
<span class="n">
<span class="pre">
str
<span class="sig-paren">
)
<dd>
<p>
Register custom display setting.
:param text: Text shown in menu item.
:type text: str
:param setting_path: Setting path for custom display setting (bool value).
:type setting_path: str
| 1,969 |
omni.kit.viewport.menubar.display.Functions.md | # omni.kit.viewport.menubar.display Functions
## Functions Summary:
- [get_instance](omni.kit.viewport.menubar.display/omni.kit.viewport.menubar.display.get_instance.html) | 173 |
omni.kit.viewport.menubar.display.md | # omni.kit.viewport.menubar.display
## Submodules
Summary:
| Module | Description |
| --- | --- |
| omni.kit.viewport.menubar.display.display_menu_container | No submodule docstring provided |
| omni.kit.viewport.menubar.display.extension | No submodule docstring provided |
| omni.kit.viewport.menubar.display.style | No submodule docstring provided |
## Classes
Summary:
| Class | Description |
| --- | --- |
| ViewportDisplayMenuBarExtension | The Entry Point for the Display Settings in Viewport Menu Bar |
## Functions
Summary:
| Function | Description |
| --- | --- |
| get_instance | | | 599 |
omni.kit.viewport.menubar.display.style.Classes.md | # omni.kit.viewport.menubar.display.style Classes
## Classes Summary:
| Class | Description |
|-------|-------------|
| [Path](omni.kit.viewport.menubar.display.style/omni.kit.viewport.menubar.display.style.Path.html) | PurePath subclass that can make system calls. | | 269 |
omni.kit.viewport.menubar.display.style.Path.md | # Path
## Path
### omni.kit.viewport.menubar.display.style.Path(*args, **kwargs)
Bases: `PurePath`
PurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.
#### Methods
- **absolute()**
- Return an absolute version of this path.
- **chmod(mode, [, follow_symlinks])**
- Change the permissions of the path, like os.chmod().
- **cwd()**
- Return a new path pointing to the current working directory (as returned by os.getcwd()).
- **exists**()
- Whether this path exists.
- **expanduser**()
- Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser).
- **glob**(pattern)
- Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
- **group**()
- Return the group name of the file gid.
- **hardlink_to**(target)
- Make this path a hard link pointing to the same file as `target`.
- **home**()
- Return a new path pointing to the user's home directory (as returned by os.path.expanduser('~')).
- **is_block_device**()
- Whether this path is a block device.
- **is_char_device**()
- Whether this path is a character device.
- **is_dir**()
- Whether this path is a directory.
- **is_fifo**()
- Whether this path is a FIFO.
- **is_file**()
- Whether this path is a regular file (also True for symlinks pointing to regular files).
- **is_mount**()
- Check if this path is a POSIX mount point.
- **is_socket**()
- Whether this path is a socket.
- **is_symlink**()
- Whether this path is a symbolic link.
- **iterdir**()
- Iterate over the files in this directory.
- `lchmod` (mode)
- Like chmod(), except if the path points to a symlink, the symlink's permissions are changed, rather than its target's.
- `link_to` (target)
- Make the target path a hard link pointing to this path.
- `lstat` ()
- Like stat(), except if the path points to a symlink, the symlink's status information is returned, rather than its target's.
- `mkdir` ([mode, parents, exist_ok])
- Create a new directory at this given path.
- `open` ([mode, buffering, encoding, errors, ...])
- Open the file pointed by this path and return a file object, as the built-in open() function does.
- `owner` ()
- Return the login name of the file owner.
- `read_bytes` ()
- Open the file in bytes mode, read it, and close the file.
- `read_text` ([encoding, errors])
- Open the file in text mode, read it, and close the file.
- `readlink` ()
- Return the path to which the symbolic link points.
- `rename` (target)
- Rename this path to the target path.
- `replace` (target)
- Rename this path to the target path, overwriting if that path exists.
- `resolve` ([strict])
- Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows).
- `rglob` (pattern)
- Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.
- `rmdir` ()
- Remove this directory.
- `samefile` ()
- (Description not provided in the HTML snippet)
| Method | Description |
|--------|-------------|
| samefile | Return whether other_path is the same or not as this file (as returned by os.path.samefile()). |
| stat (*[, follow_symlinks]) | Return the result of the stat() system call on this path, like os.stat() does. |
| symlink_to (target[, target_is_directory]) | Make this path a symlink pointing to the target path. |
| touch ([mode, exist_ok]) | Create this file with the given access mode, if it doesn't exist. |
| unlink ([missing_ok]) | Remove this file or link. |
| write_bytes (data) | Open the file in bytes mode, write to it, and close the file. |
| write_text (data[, encoding, errors, newline]) | Open the file in text mode, write to it, and close the file. |
### Attributes
#### `__init__()`
#### `absolute()`
Return an absolute version of this path. This function works even if the path doesn’t point to anything.
No normalization is done, i.e. all ‘.’ and ‘..’ will be kept along. Use resolve() to get the canonical path to a file.
#### `chmod(mode, *[, follow_symlinks=True])`
Change the permissions of the path, like os.chmod().
#### `cwd()`
classmethod
Return a new path pointing to the current working directory (as returned by os.getcwd()).
#### `exists()`
Check if the path exists.
## Methods
### expanduser
```python
expanduser()
```
Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)
### glob
```python
glob(pattern)
```
Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
### group
```python
group()
```
Return the group name of the file gid.
### hardlink_to
```python
hardlink_to(target)
```
Make this path a hard link pointing to the same file as `target`.
Note the order of arguments (self, target) is the reverse of os.link’s.
### home
```python
home()
```
Return a new path pointing to the user’s home directory (as returned by os.path.expanduser(‘~’)).
### is_block_device
```python
is_block_device()
```
Whether this path is a block device.
### is_char_device
```python
is_char_device()
```
Whether this path is a character device.
### is_dir
```python
is_dir()
```
Whether this path is a directory.
### is_fifo
```python
is_fifo()
```
Whether this path is a FIFO.
### is_file
```python
is_file()
```
Whether this path is a regular file (also True for symlinks pointing to regular files).
### is_mount
```python
is_mount()
```
Check if this path is a POSIX mount point
### is_socket
```python
is_socket()
```
Whether this path is a socket.
### is_socket
Whether this path is a socket.
### is_symlink
Whether this path is a symbolic link.
### iterdir
Iterate over the files in this directory. Does not yield any result for the special paths ‘.’ and ‘..’.
### lchmod
Like chmod(), except if the path points to a symlink, the symlink’s permissions are changed, rather than its target’s.
### link_to
Make the target path a hard link pointing to this path.
Note this function does not make this path a hard link to target, despite the implication of the function and argument names. The order of arguments (target, link) is the reverse of Path.symlink_to, but matches that of os.link.
Deprecated since Python 3.10 and scheduled for removal in Python 3.12. Use `hardlink_to()` instead.
### lstat
Like stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.
### mkdir
Create a new directory at this given path.
### open
Open this path for reading or writing.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.open">
<span class="sig-name descname">
<span class="pre">
open
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Open the file pointed by this path and return a file object, as the built-in open() function does.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.owner">
<span class="sig-name descname">
<span class="pre">
owner
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Return the login name of the file owner.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.read_bytes">
<span class="sig-name descname">
<span class="pre">
read_bytes
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Open the file in bytes mode, read it, and close the file.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.read_text">
<span class="sig-name descname">
<span class="pre">
read_text
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
encoding
<span class="o">
<span class="pre">
=
<span class="default_value">
<span class="pre">
None
,
<em class="sig-param">
<span class="n">
<span class="pre">
errors
<span class="o">
<span class="pre">
=
<span class="default_value">
<span class="pre">
None
<dd>
<p>
Open the file in text mode, read it, and close the file.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.readlink">
<span class="sig-name descname">
<span class="pre">
readlink
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Return the path to which the symbolic link points.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.rename">
<span class="sig-name descname">
<span class="pre">
rename
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
target
<dd>
<p>
Rename this path to the target path.
<p>
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
<p>
Returns the new Path instance pointing to the target path.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.replace">
<span class="sig-name descname">
<span class="pre">
replace
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
target
<dd>
<p>
Rename this path to the target path, overwriting if that path exists.
<p>
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
<p>
Returns the new Path instance pointing to the target path.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.resolve">
<span class="sig-name descname">
<span class="pre">
resolve
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
strict
<span class="o">
<span class="pre">
=
<span class="default_value">
<span class="pre">
False
<dd>
<p>
Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows).
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.rglob">
<span class="sig-name descname">
<span class="pre">
rglob
<span class="sig-paren">
(
<em class="sig-param">
<span class="n">
<span class="pre">
pattern
<dd>
<p>
Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.
<dl class="py method">
<dt class="sig sig-object py" id="omni.kit.viewport.menubar.display.style.Path.rmdir">
<span class="sig-name descname">
<span class="pre">
rmdir
<span class="sig-paren">
(
<span class="sig-paren">
)
<dd>
<p>
Remove the directory at this path.
### Remove this directory. The directory must be empty.
### Return whether other_path is the same or not as this file (as returned by os.path.samefile()).
### Return the result of the stat() system call on this path, like os.stat() does.
### Make this path a symlink pointing to the target path. Note the order of arguments (link, target) is the reverse of os.symlink.
### Create this file with the given access mode, if it doesn’t exist.
### Remove this file or link. If the path is a directory, use rmdir() instead.
### Open the file in bytes mode, write to it, and close the file.
### Open the file in text mode, write to it, and close the file.
Open the file in text mode, write to it, and close the file. | 13,333 |
omni.kit.viewport.menubar.display.Submodules.md | # omni.kit.viewport.menubar.display Submodules
## Submodules Summary
- **omni.kit.viewport.menubar.display.display_menu_container**
- No submodule docstring provided
- **omni.kit.viewport.menubar.display.extension**
- No submodule docstring provided
- **omni.kit.viewport.menubar.display.style**
- No submodule docstring provided | 339 |
omni.kit.viewport.menubar.display.ViewportDisplayMenuBarExtension.md | # ViewportDisplayMenuBarExtension
## Class: omni.kit.viewport.menubar.display.ViewportDisplayMenuBarExtension
**Bases:** `IExt`
**Description:**
The Entry Point for the Display Settings in Viewport Menu Bar
### Methods
- **deregister_custom_category_item(category, item)**
- Deregister custom display setting in category.
- **deregister_custom_setting(text)**
- Deregister custom display setting.
- **on_shutdown()**
- (No description provided)
- **on_startup(ext_id)**
- (No description provided)
- **register_custom_category_item(category, item)**
- Register custom display setting in category.
- **register_custom_setting(text)**
- Register custom display setting.
| Method Name | Description |
|-------------|-------------|
| (text, setting_path) | Register custom display setting. |
### __init__(self: omni.ext._extensions.IExt) -> None
- Initializes the ViewportDisplayMenuBarExtension.
### deregister_custom_category_item(category: str, item: BaseCategoryItem)
- Deregister custom display setting in category.
- :param category: Category to remove menu item. Can be an existing category e.g. “Heads Up Display” or a new one.
- :type category: str
- :param item (item: BaseCategoryItem): Item to remove.
### deregister_custom_setting(text: str)
- Deregister custom display setting.
- :param text: Text shown in menu item.
- :type text: str
### register_custom_category_item(category: str, item: BaseCategoryItem, section: str = 'default')
- Register custom display setting in category.
- :param category: Category to add menu item. Can be an existing category e.g. “Heads Up Display” or a new one.
- :type category: str
- :param item (item: BaseCategoryItem): Item to append.
- :param section: Optional section to organise category, default no section.
- :type section: str
### register_custom_setting(text: str, setting_path: str)
- Register custom display setting.
- :param text: Text shown in menu item.
- :type text: str
- :param setting_path: Path to the setting.
- :type setting_path: str
## Register custom display setting.
:param text: Text shown in menu item.
:type text: str
:param setting_path: Setting path for custom display setting (bool value).
:type setting_path: str | 2,245 |
omni.kit.viewport.ready.extension.ViewportReadyExtension.md | # ViewportReadyExtension
## ViewportReadyExtension
```python
class omni.kit.viewport.ready.extension.ViewportReadyExtension
```
Bases: `IExt`
### Methods
| Method | Description |
|---------------|-------------|
| `on_shutdown()` | |
| `on_startup(ext_id)` | |
```python
def __init__(self: omni.ext._extensions.IExt) -> None:
```
``` | 366 |
omni.kit.viewport.ready.md | # omni.kit.viewport.ready
## Submodules Summary:
- [omni.kit.viewport.ready.extension](omni.kit.viewport.ready.extension.html)
- No submodule docstring provided
## Classes Summary:
- [ViewportReadyExtension](omni.kit.viewport.ready/omni.kit.viewport.ready.ViewportReadyExtension.html) | 288 |
omni.kit.viewport.ready.Submodules.md | # omni.kit.viewport.ready Submodules
## Submodules Summary
- [omni.kit.viewport.ready.extension](omni.kit.viewport.ready.extension.html)
- No submodule docstring provided | 174 |
omni.kit.viewport.ready.ViewportReadyExtension.md | # ViewportReadyExtension
## ViewportReadyExtension
Bases: `IExt`
### Methods
| Method | Description |
|--------------|-------------|
| `on_shutdown`() | |
| `on_startup`(ext_id) | |
### `__init__`
```python
__init__(self: omni.ext._extensions.IExt) -> None
``` | 293 |
omni.kit.viewport.registry.Classes.md | # omni.kit.viewport.registry Classes
## Classes Summary:
| Class Name | Description |
|------------|-------------|
| RegisterScene | A class to manage the registration and deregistration of viewport factories. |
| RegisterViewportLayer | A class to manage the registration and deregistration of viewport factories. | | 318 |
omni.kit.viewport.registry.md | # omni.kit.viewport.registry
## Classes Summary
- **RegisterScene**
- A class to manage the registration and deregistration of viewport factories.
- **RegisterViewportLayer**
- A class to manage the registration and deregistration of viewport factories. | 260 |
omni.kit.viewport.utility.capture_viewport_to_buffer.md | # capture_viewport_to_buffer
## capture_viewport_to_buffer
Captures the current viewport and sends the image to a callback function.
### Parameters
- **viewport_api** (`ViewportAPI`) – The viewport API instance to capture.
- **on_capture_fn** (`Callable`) – The callback function that will receive the image.
- **is_hdr** (`bool`, optional) – If True, captures the HDR buffer; otherwise, captures the LDR buffer. Defaults to False.
### Returns
A future-like object that can be awaited to ensure the capture completes. | 521 |
omni.kit.viewport.utility.capture_viewport_to_file.md | # capture_viewport_to_file
## capture_viewport_to_file
```
```python
def capture_viewport_to_file(viewport_api, file_path: Optional[str] = None, is_hdr: bool = False, render_product_path: Optional[str] = None, format_desc: Optional[dict] = None):
"""
Capture the provided viewport to a file.
"""
## Parameters
- **viewport_api** (`ViewportAPI`) – The viewport API instance to capture.
- **file_path** (`str`, optional) – The file path where the captured image will be saved. If not specified, a default path is used.
- **is_hdr** (`bool`, optional) – If True, captures the HDR buffer; otherwise, captures the LDR buffer. Defaults to False.
- **render_product_path** (`str`, optional) – Render product path to use for capturing. Defaults to None.
- **format_desc** (`dict`, optional) – A dictionary describing the format in which to save the captured image. Defaults to None.
## Returns
A future-like object that can be awaited to ensure the capture completes. | 974 |
omni.kit.viewport.utility.create_drop_helper.md | # create_drop_helper
## create_drop_helper
```python
omni.kit.viewport.utility.create_drop_helper(*args, **kwargs)
```
Creates a helper object to handle drag-and-drop operations in a viewport.
### Parameters
- **\*args** – Variable length argument list.
- **\*\*kwargs** – Arbitrary keyword arguments.
### Returns
The drop helper object that can be used to manage drag-and-drop events.
### Return type
Any | 410 |
omni.kit.viewport.utility.disable_selection.md | # disable_selection
## disable_selection
Disables selection for a given viewport.
Disable selection rect and possible the single click selection on a Viewport or ViewportWindow.
Returns an object that resets selection when it goes out of scope.
### Parameters
- **viewport_or_window** – The viewport API instance or viewport window to which the selection disabling will be applied.
- **disable_click** (bool, optional) – If set to True, disables single click selection. Defaults to True.
### Returns
An object that, upon deletion, will reset the selection capability to its original state.
### Return type
object | 617 |
omni.kit.viewport.utility.frame_viewport_prims.md | # frame_viewport_prims
Frames the view of the viewport to include the specified prims.
## Parameters
- **viewport_api** (`ViewportAPI`, optional) – The viewport API instance to operate on. If not provided, the active viewport is used.
- **prims** (`List[str]`, optional) – A list of USD prim paths to frame in the viewport. If not provided or empty, no action is taken.
## Returns
- True if the operation was successful, False otherwise.
## Return type
- bool | 463 |
omni.kit.viewport.utility.frame_viewport_selection.md | # frame_viewport_selection
## frame_viewport_selection
Frames the camera in the viewport to include the current selection.
This function adjusts the camera in the viewport to frame the currently selected objects. If no objects are selected, it adjusts the camera to show the entire scene.
### Parameters
- **viewport_api** (`ViewportAPI`, optional) – The viewport API instance to operate on. If not provided, the active viewport is used.
- **force_legacy_api** (`bool`, optional) – If set to True, forces the use of the legacy viewport API. Defaults to False.
### Returns
- True if the operation was successful, False otherwise.
### Return type
- `bool` | 659 |
omni.kit.viewport.utility.Functions.md | # omni.kit.viewport.utility Functions
## Functions Summary:
- **capture_viewport_to_buffer**: Captures the current viewport and sends the image to a callback function.
- **capture_viewport_to_file**: Capture the provided viewport to a file.
- **create_drop_helper**: Creates a helper object to handle drag-and-drop operations in a viewport.
- **disable_selection**: Disables selection for a given viewport.
- **frame_viewport_prims**: Frames the view of the viewport to include the specified prims.
- **frame_viewport_selection**: Frames the camera in the viewport to include the current selection.
- **get_active_viewport**: Retrieves the active viewport API instance for a given USD context.
- **get_active_viewport_and_window**: Retrieves the active viewport and its window for a given USD context and window name.
- **get_active_viewport_camera_path**: Retrieves the camera Sdf.Path for the active viewport within a specified USD context.
- **get_active_viewport_camera_string**: Retrieves the camera path string for the active viewport within a specified USD context.
| 奇数行 | 偶数行 |
| --- | --- |
| get_ground_plane_info | Retrieves the ground plane information including its normal and the planes it occupies. |
| get_num_viewports | Returns the number of active viewports within an optional USD context. |
| get_viewport_from_window_name | Retrieves the first viewport API instance from a specified window name. |
| get_viewport_window_camera_path | Retrieves the camera path for the viewport in the specified window. |
| get_viewport_window_camera_string | Retrieves the camera path string for the viewport in the specified window. |
| post_viewport_message | Posts a message as a toast notification to the viewport or viewport window. |
| toggle_global_visibility | Deprecated since version 1.0.15. | | 1,810 |
omni.kit.viewport.utility.get_active_viewport.md | # get_active_viewport
## get_active_viewport
Retrieves the active viewport API instance for a given USD context.
If no USD context name is provided, the current USD context is used.
### Parameters
**usd_context_name** (str, optional) – The name of the USD context to query. Defaults to an empty string, which indicates the current USD context.
### Returns
The active viewport API instance, or None if not found.
### Return type
Optional[ViewportAPI] | 455 |
Subsets and Splits