lightspeed.trex.texture_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.texture_replacements.core.shared.TextureReplacementsCore(context_name: str = '')#

Bases: object

destroy()#
async get_expected_texture_material_inputs(
texture_prim_path: str,
texture_type: TextureTypes | str | None = None,
) list[str]#
async get_texture_expected_material_inputs_with_data_models(
material_params: TextureMaterialPathParamModel,
texture_type: TextureTypeNames | str | None = None,
) PrimsResponseModel#
get_texture_material(
texture_prim_path: str,
) str | None#

Get a material prim path from a texture prim attribute’s path

Parameters:

texture_prim_path – The prim path to a shader input attribute

Returns:

the prim path to the associated material or None if no material is found

async get_texture_material_inputs_with_data_models(
params: TextureMaterialPathParamModel,
) PrimsResponseModel#
get_texture_material_with_data_models(
params: TextureMaterialPathParamModel,
) PrimsResponseModel#
get_texture_prims_assets(
asset_hashes: set[str] | None,
texture_types: set[TextureTypeNames] | None,
return_selection: bool = False,
filter_session_prims: bool = True,
layer_id: str | None = None,
exists: bool = True,
) list[tuple[str, str]]#

Get the list of (texture property, asset path) filtered by shader input name for the entire stage or the current selection

Parameters:
  • asset_hashes – A set of asset hashes to keep when filtering material asset paths

  • texture_types – A set of texture types to keep when filtering textures

  • return_selection – Whether to return the current selection or all prims in the stage

  • filter_session_prims – Whether to filter prims defined on the session prim or not

  • layer_id – Look for assets that exists or not on a given layer. Use the exists query parameter to set whether existing or non-existing prims should be returned.

  • exists – Filter an asset if it exists or not on a given layer. Use in conjunction with layer_identifier to filter on a given layer, otherwise this parameter will be ignored.

Returns:

A list of tuples in the format (texture property, asset path) where the texture property will always be a shader input and the asset path will be the absolute path to the texture asset

get_texture_prims_assets_with_data_models(
query: GetTexturesQueryModel,
) TexturesResponseModel#
replace_texture_with_data_models(
body: ReplaceTexturesRequestModel,
)#
replace_textures(
textures: list[tuple[str, str | Path | None]],
force: bool = False,
use_undo_group: bool = True,
)#

Replace a list of textures

Parameters:
  • textures – A list of tuples in the format (texture property, asset path) where the texture property should be a shader input and the asset path should be the absolute path to the texture asset

  • force – Whether to force replace the texture or validate it was ingested correctly

  • use_undo_group – Whether to use an undo group for the texture replacements