Skip to content

Commit

Permalink
Merge pull request #5 from nfa-vfxim/dev
Browse files Browse the repository at this point in the history
Added USD references to Maya
  • Loading branch information
mervinvb authored Apr 18, 2024
2 parents ac86b67 + caf20aa commit 35fd027
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions hooks/tk-houdini_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def _materialx_folder(self, path, sg_publish_data):
_show_node(image_node)

automatic_texture_add_choice = hou.ui.displayMessage(
"Would you like to automatically add the textures to their correct input?",
"Automatically add the textures to correct input? Note: This might not work for all maps.",
("Yes", "No"),
)

Expand All @@ -519,7 +519,7 @@ def _materialx_folder(self, path, sg_publish_data):
if "Alpha" in image_node.name():
mtlxstandard_surface_node.setNamedInput("opacity", image_node, "out")

if "BaseColor" in image_node.name():
if "BaseColor" in image_node.name() or "Base Color" in image_node.name():
mtlxstandard_surface_node.setNamedInput("base_color", image_node, "out")

if "Displacement" in image_node.name():
Expand Down
21 changes: 14 additions & 7 deletions hooks/tk-maya_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,20 @@ def _create_reference(self, path, sg_publish_data):
namespace = namespace.replace(" ", "_")

# Now create the reference object in Maya.
cmds.file(
path,
reference=True,
loadReferenceDepth="all",
mergeNamespacesOnClash=False,
namespace=namespace,
)
if os.path.splitext(path)[1] == ".usd" or os.path.splitext(path)[1] == ".usda":
new_path = path.replace("\\", "/")
mel.eval(
f'file -r -type "USD Import" -ignoreVersion -gl -mergeNamespacesOnClash false -namespace "{namespace}" -options ";shadingMode=[[useRegistry,MaterialX],[useRegistry,UsdPreviewSurface],[displayColor,none],[none,none]];preferredMaterial=none;primPath=/;readAnimData=1;useCustomFrameRange=0;startTime=0;endTime=0;importUSDZTextures=0" "{new_path}"'
)

else:
cmds.file(
path,
reference=True,
loadReferenceDepth="all",
mergeNamespacesOnClash=False,
namespace=namespace,
)

def _do_import(self, path, sg_publish_data):
"""
Expand Down

0 comments on commit 35fd027

Please sign in to comment.