Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Looks: add basic support for Renderman #3190

Merged
merged 6 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions openpype/hosts/maya/plugins/publish/collect_look.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ def node_uses_image_sequence(node):
node_path = get_file_node_path(node).lower()

# The following tokens imply a sequence
patterns = ["<udim>", "<tile>", "<uvtile>", "u<u>_v<v>", "<frame0"]

return (cmds.getAttr('%s.useFrameExtension' % node) or
patterns = ["<udim>", "<tile>", "<uvtile>",
"u<u>_v<v>", "<frame0", "<f4>"]
try:
extension = cmds.getAttr('%s.useFrameExtension' % node)
except ValueError:
extension = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be extension = False to still return a boolean.
Also, might be better as a variable named use_frame_extension?


return (extension or
any(pattern in node_path for pattern in patterns))


Expand Down Expand Up @@ -165,7 +170,7 @@ def get_file_node_path(node):
if any(pattern in lower for pattern in patterns):
return texture_pattern

if cmds.nodeType(node) == 'aiImage':
if cmds.nodeType(node) in ['aiImage', 'PxrTexture']:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would lookup in set be better?

Suggested change
if cmds.nodeType(node) in ['aiImage', 'PxrTexture']:
if cmds.nodeType(node) in {'aiImage', 'PxrTexture'}:

return cmds.getAttr('{0}.filename'.format(node))
if cmds.nodeType(node) == 'RedshiftNormalMap':
return cmds.getAttr('{}.tex0'.format(node))
Expand Down Expand Up @@ -326,7 +331,10 @@ def collect(self, instance):
"volumeShader",
"displacementShader",
"aiSurfaceShader",
"aiVolumeShader"]
"aiVolumeShader",
"rman__surface",
"rman__displacement"
]
if look_sets:
materials = []

Expand Down Expand Up @@ -376,6 +384,7 @@ def collect(self, instance):

files = cmds.ls(history, type="file", long=True)
files.extend(cmds.ls(history, type="aiImage", long=True))
files.extend(cmds.ls(history, type="PxrTexture", long=True))
files.extend(cmds.ls(history, type="RedshiftNormalMap", long=True))

self.log.info("Collected file nodes:\n{}".format(files))
Expand Down Expand Up @@ -510,23 +519,21 @@ def collect_resource(self, node):
Returns:
dict
"""

self.log.debug("processing: {}".format(node))
if cmds.nodeType(node) not in ["file", "aiImage", "RedshiftNormalMap"]:
if cmds.nodeType(node) not in [
"file", "aiImage", "RedshiftNormalMap", "PxrTexture"]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, lookup in set maybe better?

self.log.error(
"Unsupported file node: {}".format(cmds.nodeType(node)))
raise AssertionError("Unsupported file node")

self.log.debug(" - got {}".format(cmds.nodeType(node)))
if cmds.nodeType(node) == 'file':
self.log.debug(" - file node")
attribute = "{}.fileTextureName".format(node)
computed_attribute = "{}.computedFileTextureNamePattern".format(node)
elif cmds.nodeType(node) == 'aiImage':
self.log.debug("aiImage node")
elif cmds.nodeType(node) in ['aiImage', 'PxrTexture']:
attribute = "{}.filename".format(node)
computed_attribute = attribute
elif cmds.nodeType(node) == 'RedshiftNormalMap':
self.log.debug("RedshiftNormalMap node")
attribute = "{}.tex0".format(node)
computed_attribute = attribute

Expand Down
6 changes: 4 additions & 2 deletions openpype/hosts/maya/plugins/publish/extract_look.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,12 @@ def process_resources(self, instance, staging_dir):

if mode == COPY:
transfers.append((source, destination))
self.log.info('copying')
self.log.info('file will be copied {} -> {}'.format(
source, destination))
elif mode == HARDLINK:
hardlinks.append((source, destination))
self.log.info('hardlinking')
self.log.info('file will be hardlinked {} -> {}'.format(
source, destination))

# Store the hashes from hash to destination to include in the
# database
Expand Down