MaterialXUSD 0.0.1
Utilities for using MaterialX with USD
|
Class that converts a MaterialX file to a USD file with an appropriate scene. More...
Public Member Functions | |
__init__ (self) | |
Constructor for the MaterialxUSDConverter class. | |
validate_stage (self, str file, bool verboseOutput=False) | |
This function validates a USD file using the ComplianceChecker. | |
find_first_valid_prim (self, stage) | |
This function finds the first valid prim in root layer of a stage. | |
set_required_validation_attributes (self, stage) | |
This function sets the required validation attributes for the stage. | |
find_materials (self, stage, bool find_first=True) | |
This function finds the first material in the stage. | |
add_skydome_light (self, Usd.Stage stage, str environment_path, str root_path="/TestScene/Lights", str light_name="EnvironmentLight", xform_scale=Gf.Vec3f(1.3, 1.3, 1.3), xform_rotate=Gf.Vec3f(0, 0, 0)) | |
This function adds a skydome light to the stage. | |
add_geometry_reference (self, Usd.Stage stage, str geometry_path, str root_path="/TestScene/Geometry") | |
This function adds a geometry reference to the stage. | |
find_first_camera (self, Usd.Stage stage) | |
This function finds the first camera in the stage. | |
add_camera (self, Usd.Stage stage, str camera_path, str root_path="/TestScene/Camera", str geometry_path="/TestScene/Geometry") | |
This function adds a camera to the stage. | |
mtlx_to_usd (self, str input_usd_path, str shaderball_path, str environment_path, str material_file_path, str camera_path, use_custom=False) | |
This function reads the input usd file and adds the shaderball geometry and environment light to the scene. | |
get_flattend_layer (self, stage) | |
This function flattens the stage and returns the flattened layer. | |
save_flattened_layer (self, flattened_layer, str output_path) | |
This function saves the flattened stage to a new USD file. | |
create_usdz_package (self, str usdz_file_path, flattened_layer) | |
This function creates a new USDZ package from a flattened layer. | |
Public Attributes | |
logger = logging.getLogger('MX2USD') | |
Class that converts a MaterialX file to a USD file with an appropriate scene.
Definition at line 10 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.__init__ | ( | self | ) |
Constructor for the MaterialxUSDConverter class.
Definition at line 14 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.add_camera | ( | self, | |
Usd.Stage | stage, | ||
str | camera_path, | ||
str | root_path = "/TestScene/Camera", | ||
str | geometry_path = "/TestScene/Geometry" ) |
This function adds a camera to the stage.
stage | The stage to add the camera. |
camera_path | The path to the camera file. |
root_path | The root path to add the camera. |
geometry_path | The path to the geometry file. |
Definition at line 169 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.add_geometry_reference | ( | self, | |
Usd.Stage | stage, | ||
str | geometry_path, | ||
str | root_path = "/TestScene/Geometry" ) |
This function adds a geometry reference to the stage.
stage | The stage to add the geometry reference. |
geometry_path | The path to the geometry file. |
root_path | The root path to add the geometry reference. |
Definition at line 145 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.add_skydome_light | ( | self, | |
Usd.Stage | stage, | ||
str | environment_path, | ||
str | root_path = "/TestScene/Lights", | ||
str | light_name = "EnvironmentLight", | ||
xform_scale = Gf.Vec3f(1.3, 1.3, 1.3), | |||
xform_rotate = Gf.Vec3f(0, 0, 0) ) |
This function adds a skydome light to the stage.
stage | The stage to add the skydome light. |
environment_path | The path to the environment light file. |
root_path | The root path to add the skydome light. |
light_name | The name of the skydome light. |
xform_scale | The scale of the skydome light. |
xform_rotate | The rotation of the skydome light. |
Definition at line 102 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.create_usdz_package | ( | self, | |
str | usdz_file_path, | ||
flattened_layer ) |
This function creates a new USDZ package from a flattened layer.
usdz_file_path | The path to the USDZ package to create. |
flattened_layer | The flattened layer to save to the USDZ package. |
Definition at line 335 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.find_first_camera | ( | self, | |
Usd.Stage | stage ) |
This function finds the first camera in the stage.
stage | The stage to search for the first camera. |
Definition at line 156 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.find_first_valid_prim | ( | self, | |
stage ) |
This function finds the first valid prim in root layer of a stage.
stage | The stage to search for the first valid prim. |
Definition at line 45 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.find_materials | ( | self, | |
stage, | |||
bool | find_first = True ) |
This function finds the first material in the stage.
Assumes MaterialX materials are stored under the "/MaterialX/Materials" scope.
stage | The stage to search for the first material. |
find_first | If True, only the first material found is returned. Default is True. |
Definition at line 73 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.get_flattend_layer | ( | self, | |
stage ) |
This function flattens the stage and returns the flattened layer.
stage | The stage to flatten. |
Definition at line 316 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.mtlx_to_usd | ( | self, | |
str | input_usd_path, | ||
str | shaderball_path, | ||
str | environment_path, | ||
str | material_file_path, | ||
str | camera_path, | ||
use_custom = False ) |
This function reads the input usd file and adds the shaderball geometry and environment light to the scene.
It also binds the first material to the shaderball geometry. The final stage is returned.
input_usd_path | Path to the input usd file |
shaderball_path | Path to the shaderball geometry file |
environment_path | Path to the environment light file |
material_file_path | Path to the material file. If specified will save the material file. |
camera_path | Path to the camera file |
Definition at line 233 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.save_flattened_layer | ( | self, | |
flattened_layer, | |||
str | output_path ) |
This function saves the flattened stage to a new USD file.
flattened_layer | The flattened layer to save. |
output_path | The path to save the flattened stage. |
Definition at line 324 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.set_required_validation_attributes | ( | self, | |
stage ) |
This function sets the required validation attributes for the stage.
For now this function sets the upAxis and metersPerUnit. to Y and 1.0 respectively.
stage | The stage to set the required validation attributes. |
Definition at line 63 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.validate_stage | ( | self, | |
str | file, | ||
bool | verboseOutput = False ) |
This function validates a USD file using the ComplianceChecker.
file | The path to the USD file to validate. |
verboseOutput | If True, the compliance check will output verbose information. Default is False. |
Definition at line 22 of file materialxusd.py.
materialxusd.materialxusd.MaterialxUSDConverter.logger = logging.getLogger('MX2USD') |
Definition at line 19 of file materialxusd.py.