MaterialXUSD 0.0.1
Utilities for using MaterialX with USD
|
A collection of support utilities for working with MaterialX and USD. More...
Public Member Functions | |
__init__ (self) | |
Constructor. | |
load_standard_libraries (self) | |
Load standard MaierialX libraries. | |
get_standard_libraries (self) | |
Get standard MaierialX libraries. | |
create_document (self, str path) | |
Create a MaterialX document from a file path. | |
write_document (self, mx.Document doc, str path) | |
Write a MaterialX document to a file. | |
create_FileSearchPath (self, list search_paths) | |
Create a MaterialX file search path from a list of string paths. | |
resolve_image_file_paths (self, mx.Document doc, mx.FileSearchPath search_paths) | |
Resolve image file paths in a MaterialX document. | |
add_nodegraph_output_qualifier_on_shaders (self, mx.Document doc) | |
Add nodegraph output qualifier on shaders in the MaterialX document if not already set. | |
add_materials_for_shaders (self, mx.Document doc) | |
Add materials for shaders at the root level of a MaterialX document. | |
add_downstream_materials (self, mx.Document doc, logger=None) | |
Add downstream materials to the MaterialX graph. | |
add_explicit_geometry_stream (self, mx.GraphElement graph) | |
Add explicit geometry stream nodes for inputs with defaultgeomprop specified in nodes definition. | |
encapsulate_top_level_nodes (self, mx.Document doc, str nodegraph_name="top_level_nodes", bool remove_original=True) | |
Encapsulate top level nodes in a nodegraph. | |
encapsulate_top_level_nodes_file (self, str input_path, str new_input_path, str nodegraph_name='top_level_nodes', bool remove_original_nodes=True) | |
Encapsulate top level nodes in a nodegraph. | |
Public Attributes | |
logger = logging.getLogger('MXUSDUTIL') | |
Protected Attributes | |
_stdlib | |
_libFiles = self.load_standard_libraries() | |
A collection of support utilities for working with MaterialX and USD.
Definition at line 10 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.__init__ | ( | self | ) |
Constructor.
Definition at line 15 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.add_downstream_materials | ( | self, | |
mx.Document | doc, | ||
logger = None ) |
Add downstream materials to the MaterialX graph.
doc | The MaterialX document. |
Definition at line 144 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.add_explicit_geometry_stream | ( | self, | |
mx.GraphElement | graph ) |
Add explicit geometry stream nodes for inputs with defaultgeomprop specified in nodes definition.
Do this for unconnected inputs only.
graph | The MaterialX graph element. |
Definition at line 361 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.add_materials_for_shaders | ( | self, | |
mx.Document | doc ) |
Add materials for shaders at the root level of a MaterialX document.
Nodegraphs are not considered as this is not supported by USD.
doc | The MaterialX document. |
logger | The logger to use for output. |
Definition at line 114 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.add_nodegraph_output_qualifier_on_shaders | ( | self, | |
mx.Document | doc ) |
Add nodegraph output qualifier on shaders in the MaterialX document if not already set.
USD appears to require this for shader inputs to be connected to outputs on a nodegraph sometimes – when the output name is not "out" ?
doc | The MaterialX document. |
Definition at line 83 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.create_document | ( | self, | |
str | path ) |
Create a MaterialX document from a file path.
path | The path to the MaterialX document. |
Definition at line 41 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.create_FileSearchPath | ( | self, | |
list | search_paths ) |
Create a MaterialX file search path from a list of string paths.
search_paths | A list of string paths. |
Definition at line 62 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.encapsulate_top_level_nodes | ( | self, | |
mx.Document | doc, | ||
str | nodegraph_name = "top_level_nodes", | ||
bool | remove_original = True ) |
Encapsulate top level nodes in a nodegraph.
Remap any connections to the top level nodes to outputs on a new nodegraph.
doc | The MaterialX document. |
nodegraph_name | The name of the new nodegraph to encapsulate the top level nodes. Default is 'top_level_nodes'. |
remove_original | If True, remove the original top level nodes from the document. Default is True. |
Definition at line 440 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.encapsulate_top_level_nodes_file | ( | self, | |
str | input_path, | ||
str | new_input_path, | ||
str | nodegraph_name = 'top_level_nodes', | ||
bool | remove_original_nodes = True ) |
Encapsulate top level nodes in a nodegraph.
Remap any connections to the top level nodes to outputs on a new nodegraph.
input_path | The path to the MaterialX document. |
new_input_path | The path to write the modified MaterialX document. |
nodegraph_name | The name of the new nodegraph to encapsulate the top level nodes. Default is 'top_level_nodes'. |
remove_original_nodes | If True, remove the original top level nodes from the document. Default is True. |
Definition at line 531 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.get_standard_libraries | ( | self | ) |
Get standard MaierialX libraries.
Definition at line 31 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.load_standard_libraries | ( | self | ) |
Load standard MaierialX libraries.
Definition at line 23 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.resolve_image_file_paths | ( | self, | |
mx.Document | doc, | ||
mx.FileSearchPath | search_paths ) |
Resolve image file paths in a MaterialX document.
doc | The MaterialX document. |
search_paths | The MaterialX file search path. |
Definition at line 75 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.write_document | ( | self, | |
mx.Document | doc, | ||
str | path ) |
Write a MaterialX document to a file.
doc | The MaterialX document. |
path | The path to write the MaterialX document. |
Definition at line 52 of file materialxusd_utils.py.
|
protected |
Definition at line 19 of file materialxusd_utils.py.
|
protected |
Definition at line 19 of file materialxusd_utils.py.
materialxusd.materialxusd_utils.MaterialXUsdUtilities.logger = logging.getLogger('MXUSDUTIL') |
Definition at line 21 of file materialxusd_utils.py.