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
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.CachedReplacementSkeletons
Bases:
object
Container to cache replacement skeletons for performance
- add_skel_replacement(skel_root: pxr.Usd.Prim, replacement_asset_root: pxr.Usd.Prim)
- get_skel_replacement(skel_root: pxr.Usd.Prim, replacement_asset_root: pxr.Usd.Prim) → lightspeed.trex.asset_replacements.core.shared.skeleton.SkeletonReplacementBinding | None
- 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
- asset_is_in_project_dir(path: str, layer: pxr.Sdf.Layer, include_deps_dir: bool = False) → bool
- 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)
- static 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['_ItemReferenceFile'], parent_items: list[typing.Union[ForwardRef('_ItemInstance'), ForwardRef('_ItemReferenceFile')]], 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['_ItemInstance'], 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, ignore_invalid_paths: bool = True) → bool
- exception lightspeed.trex.asset_replacements.core.shared.SkeletonAutoRemappingError
Bases:
Exception
Skeleton replacement does not have the proper attributes to be remapped as is.
- exception lightspeed.trex.asset_replacements.core.shared.SkeletonDefinitionError
Bases:
Exception
Missing part of SkelRoot, Skeleton or Binding
- class lightspeed.trex.asset_replacements.core.shared.SkeletonReplacementBinding(skel_root: pxr.Usd.Prim, bound_prim: pxr.Usd.Prim)
Bases:
object
- JOINT_ATTR = 'skel:joints'
- REMIX_JOINT_ATTR = 'skel:remix_joints'
- apply(joint_map: list[int])
Apply the remapping to the bound prim
- property bound_prim: pxr.Usd.Prim
- property captured_skeleton: pxr.UsdSkel.Skeleton
- static generate_joint_map(mesh_joints, captured_joints, fallback=False) → list[int]
Use heuristics to generate a map from mesh joint list index to captured joint list index
- get_captured_joints() → list[str]
Return the list of legacy joints in the skeleton that was captured in the runtime
- get_joint_indices() → pxr.Vt.IntArray | None
Return the new joint influences on the replacement mesh
- get_joint_map() → list[int]
Return the authored map from mesh joint list index to captured joint list index
- get_mesh_joints() → list[str]
Return the list of joints that were originally bound to the replacement mesh
- get_original_joint_indices() → pxr.Vt.IntArray | None
Return the originally bound joint influences on the replacement mesh
- get_remapped_joints() → list[str]
Return the list of captured joints that will drive the corresponding mesh joints
- property original_skeleton: pxr.UsdSkel.Skeleton