lightspeed.trex.asset_replacements.core.shared

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class lightspeed.trex.asset_replacements.core.shared.Setup(context_name: str)

Bases: object

add_attribute(paths: list[str], attribute_name: str, value=None, prev_val=None, val_type=None)
add_new_reference(stage: pxr.Usd.Stage, prim_path: pxr.Sdf.Path, asset_path: str, new_ref_prim_path: str, layer: pxr.Sdf.Layer, create_if_remix_ref: bool = True) tuple[pxr.Sdf.Reference, str]
append_reference_with_data_model(params: lightspeed.trex.asset_replacements.core.shared.data_models.models.PrimReferencePathParamModel, body: lightspeed.trex.asset_replacements.core.shared.data_models.models.AppendReferenceRequestModel) lightspeed.trex.asset_replacements.core.shared.data_models.models.ReferenceResponseModel
delete_prim(paths: list[str])
destroy()
filter_imageable_prims(prims: list[pxr.Usd.Prim]) list[pxr.Usd.Prim]
filter_scope_prims(prims: list[pxr.Usd.Prim]) list[pxr.Usd.Prim]
filter_transformable_prims(paths: Optional[list[pxr.Sdf.Path]]) list[str]

Filter a list of prim paths to those that can be transformed.

Instanced mesh prim paths will be replaced with their corresponding prototype prim paths so that transformations will act on all instances.

filter_xformable_prims(prims: list[pxr.Usd.Prim]) list[pxr.Usd.Prim]
get_children_from_prim(prim, from_reference_layer_path: Optional[str] = None, level: Optional[int] = None, skip_remix_ref: bool = False, only_prim_not_from_ref: bool = False)
get_corresponding_prototype_prims(prims) list[str]

Give a list of instance prims (inst_123456789/), and get the corresponding prims inside the prototypes (mesh_123456789/)

get_corresponding_prototype_prims_from_path(paths) list[str]

Give a list of instance prims (inst_123456789/), and get the corresponding prims inside the prototypes (mesh_123456789/)

get_default_output_directory_with_data_model() lightspeed.trex.asset_replacements.core.shared.data_models.models.AssetPathResponseModel
static get_instance_from_mesh(mesh_paths: list[str], instance_paths: list[str]) list[str]
get_instances_from_mesh_path(prim_path: str) set[str]
get_instances_with_data_model(params: lightspeed.trex.asset_replacements.core.shared.data_models.models.PrimInstancesPathParamModel) lightspeed.trex.asset_replacements.core.shared.data_models.models.PrimsResponseModel
get_next_xform_children(prim, from_reference_layer_path: Optional[str] = None) list[pxr.Usd.Prim]
get_prim_from_ref_items(ref_items: list['_ItemReferenceFileMesh'], parent_items: list[typing.Union[ForwardRef('_ItemInstanceMesh'), ForwardRef('_ItemReferenceFileMesh')]], only_xformable: bool = False, only_imageable: bool = False, level: Optional[int] = None, skip_remix_ref: bool = False) list[pxr.Usd.Prim]

Get xformables prim that comes from the reference item and are children of the parent items.

static get_prim_hash(prim_path) str
get_prim_paths_with_data_model(query: lightspeed.trex.asset_replacements.core.shared.data_models.models.GetPrimsQueryModel) lightspeed.trex.asset_replacements.core.shared.data_models.models.PrimsResponseModel
static get_ref_default_prim_tag() str
static get_reference_prim_path_from_asset_path(new_asset_path: str, layer: pxr.Sdf.Layer, edit_target_layer: pxr.Sdf.Layer, ref: pxr.Sdf.Reference, can_return_default=True) str
get_reference_with_data_model(params: lightspeed.trex.asset_replacements.core.shared.data_models.models.PrimReferencePathParamModel) lightspeed.trex.asset_replacements.core.shared.data_models.models.ReferenceResponseModel
get_scope_prims_without_imageable_children(prims) list[pxr.Usd.Prim]
get_selected_prim_paths() list[str]
get_selected_prim_paths_with_data_model() lightspeed.trex.asset_replacements.core.shared.data_models.models.PrimsResponseModel
get_textures_from_material_path(prim_path: str, texture_types: Optional[set[omni.flux.asset_importer.core.data_models.enums.TextureTypes]]) list[tuple[str, str]]
get_textures_with_data_model(params: lightspeed.trex.asset_replacements.core.shared.data_models.models.PrimTexturesPathParamModel, query: lightspeed.trex.asset_replacements.core.shared.data_models.models.GetTexturesQueryModel) lightspeed.trex.asset_replacements.core.shared.data_models.models.TexturesResponseModel
static is_absolute_path(path: str) bool
static is_file_path_valid(path: str, layer: pxr.Sdf.Layer, log_error: bool = True) bool
static is_ref_prim_path_valid(asset_path: str, prim_path: str, layer: pxr.Sdf.Layer, log_error=True) bool
on_reference_edited(stage: pxr.Usd.Stage, prim_path: pxr.Sdf.Path, ref: pxr.Sdf.Reference, new_ref_asset_path: str, new_ref_prim_path: str, intro_layer: pxr.Sdf.Layer) pxr.Sdf.Reference
static prim_is_from_a_capture_reference(prim) bool
static ref_path_is_from_capture(path: str) bool
static ref_prim_path_is_default_prim(prim_path: str) bool
remove_prim_overrides(prim_path: Union[pxr.Sdf.Path, str])
remove_reference(stage: pxr.Usd.Stage, prim_path: pxr.Sdf.Path, ref: pxr.Sdf.Reference, intro_layer: pxr.Sdf.Layer, remove_if_remix_ref: bool = True)
replace_reference_with_data_model(params: lightspeed.trex.asset_replacements.core.shared.data_models.models.PrimReferencePathParamModel, body: lightspeed.trex.asset_replacements.core.shared.data_models.models.ReplaceReferenceRequestModel) lightspeed.trex.asset_replacements.core.shared.data_models.models.ReferenceResponseModel
select_child_from_instance_item_and_ref(stage, from_prim, from_reference_layer_path, instance_items: list['_ItemInstanceMesh'], only_xformable: bool = False, only_imageable: bool = False, filter_scope_prim_without_imageable: bool = False)

Select the first prim of a ref corresponding to the selected instance items

select_prim_paths(paths: list[str], current_selection: Optional[list[str]] = None)
select_prim_paths_with_data_model(body: lightspeed.trex.asset_replacements.core.shared.data_models.models.SetSelectionPathParamModel)
static switch_ref_abs_to_rel_path(stage: pxr.Usd.Stage, path: str) str
static switch_ref_rel_to_abs_path(stage: pxr.Usd.Stage, path: str) str
static texture_path_is_from_capture(path: str) bool
static was_the_asset_ingested(path: str) bool