diff --git a/openpype/hosts/maya/plugins/load/load_ass.py b/openpype/hosts/maya/plugins/load/load_ass.py index e4e0b0da84..58abfa964e 100644 --- a/openpype/hosts/maya/plugins/load/load_ass.py +++ b/openpype/hosts/maya/plugins/load/load_ass.py @@ -60,7 +60,7 @@ class AssProxyLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): with maintained_selection(): - groupName = "{}:{}".format(namespace, name) + group_name = "{}:{}".format(namespace, name) path = self.fname proxy_path_base = os.path.splitext(path)[0] @@ -91,13 +91,36 @@ class AssProxyLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): reference=True, returnNewNodes=True, groupReference=True, - groupName=groupName + groupName=group_name ) + # Reset group to world zero. + transform_data = {} + for node in nodes: + if cmds.nodeType(node) != "transform": + continue + + transform_data[node] = {} + attrs = ["translate", "rotate", "scale"] + parameters = ["X", "Y", "Z"] + for attr in attrs: + for parameter in parameters: + transform_data[node][attr + parameter] = cmds.getAttr( + "{}.{}{}".format(node, attr, parameter) + ) + cmds.makeIdentity( - groupName, apply=False, rotate=True, translate=True, scale=True + group_name, + apply=False, + rotate=True, + translate=True, + scale=True ) + for node, data in transform_data.items(): + for attr, value in data.items(): + cmds.setAttr("{}.{}".format(node, attr), value) + # Set attributes proxy_shape = cmds.ls(nodes, type="mesh")[0] @@ -107,7 +130,15 @@ class AssProxyLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): cmds.setAttr(proxy_shape + ".dso", self.fname, type="string") cmds.setAttr(proxy_shape + ".aiOverrideShaders", 0) - set_color(groupName, context) + # Hides all other meshes at render time. + remaining_meshes = cmds.ls(nodes, type="mesh") + remaining_meshes.remove(proxy_shape) + for node in remaining_meshes: + cmds.setAttr( + node + ".aiTranslator", "procedural", type="string" + ) + + set_color(group_name, context) self[:] = nodes diff --git a/openpype/hosts/maya/plugins/publish/collect_ass.py b/openpype/hosts/maya/plugins/publish/collect_ass.py index b5e05d6665..7b5d1a00c7 100644 --- a/openpype/hosts/maya/plugins/publish/collect_ass.py +++ b/openpype/hosts/maya/plugins/publish/collect_ass.py @@ -1,5 +1,4 @@ from maya import cmds -from openpype.pipeline.publish import KnownPublishError import pyblish.api @@ -25,9 +24,6 @@ class CollectAssData(pyblish.api.InstancePlugin): instance.data['setMembers'] = members self.log.debug('content members: {}'.format(members)) elif objset.startswith("proxy_SET"): - if len(members) != 1: - msg = "You have multiple proxy meshes, please only use one" - raise KnownPublishError(msg) instance.data['proxy'] = members self.log.debug('proxy members: {}'.format(members))