mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 22:02:15 +01:00
Support switching between proxy and non-proxy
This commit is contained in:
parent
22046ad5d3
commit
ff63a91864
3 changed files with 31 additions and 14 deletions
|
|
@ -53,10 +53,8 @@ class ArnoldStandinLoader(load.LoaderPlugin):
|
|||
root = cmds.group(name=label, empty=True)
|
||||
|
||||
# Set color.
|
||||
project_name = context["project"]["name"]
|
||||
settings = get_project_settings(project_name)
|
||||
colors = settings['maya']['load']['colors']
|
||||
color = colors.get('ass')
|
||||
settings = get_project_settings(context["project"]["name"])
|
||||
color = settings['maya']['load']['colors'].get('ass')
|
||||
if color is not None:
|
||||
cmds.setAttr(root + ".useOutlinerColor", True)
|
||||
cmds.setAttr(
|
||||
|
|
@ -121,10 +119,6 @@ class ArnoldStandinLoader(load.LoaderPlugin):
|
|||
def _setup_proxy(self, shape, path, namespace):
|
||||
proxy_basename, proxy_path = self._get_proxy_path(path)
|
||||
|
||||
if not os.path.exists(proxy_path):
|
||||
self.log.error("Proxy files do not exist. Skipping proxy setup.")
|
||||
return path, None
|
||||
|
||||
options_node = "defaultArnoldRenderOptions"
|
||||
merge_operator = get_attribute_input(options_node + ".operator")
|
||||
if merge_operator is None:
|
||||
|
|
@ -163,6 +157,12 @@ class ArnoldStandinLoader(load.LoaderPlugin):
|
|||
)
|
||||
)
|
||||
|
||||
# We setup the string operator no matter whether there is a proxy or
|
||||
# not. This makes it easier to update since the string operator will
|
||||
# always be created. Return original path to use for standin.
|
||||
if not os.path.exists(proxy_path):
|
||||
return path, string_replace_operator
|
||||
|
||||
return proxy_path, string_replace_operator
|
||||
|
||||
def update(self, container, representation):
|
||||
|
|
@ -180,6 +180,9 @@ class ArnoldStandinLoader(load.LoaderPlugin):
|
|||
|
||||
path = get_representation_path(representation)
|
||||
proxy_basename, proxy_path = self._get_proxy_path(path)
|
||||
|
||||
# Whether there is proxy or so, we still update the string operator.
|
||||
# If no proxy exists, the string operator wont replace anything.
|
||||
cmds.setAttr(
|
||||
string_replace_operator + ".match",
|
||||
"resources/" + proxy_basename,
|
||||
|
|
@ -190,7 +193,11 @@ class ArnoldStandinLoader(load.LoaderPlugin):
|
|||
os.path.basename(path),
|
||||
type="string"
|
||||
)
|
||||
cmds.setAttr(standin + ".dso", proxy_path, type="string")
|
||||
|
||||
dso_path = path
|
||||
if os.path.exists(proxy_path):
|
||||
dso_path = proxy_path
|
||||
cmds.setAttr(standin + ".dso", dso_path, type="string")
|
||||
|
||||
sequence = is_sequence(os.listdir(os.path.dirname(path)))
|
||||
cmds.setAttr(standin + ".useFrameExtension", sequence)
|
||||
|
|
|
|||
|
|
@ -95,6 +95,9 @@ class ExtractArnoldSceneSource(publish.Extractor):
|
|||
)
|
||||
|
||||
# Extract proxy.
|
||||
if not instance.data.get("proxy", []):
|
||||
return
|
||||
|
||||
kwargs["filename"] = file_path.replace(".ass", "_proxy.ass")
|
||||
filenames = self._extract(
|
||||
instance.data["proxy"], attribute_data, kwargs
|
||||
|
|
@ -132,7 +135,6 @@ class ExtractArnoldSceneSource(publish.Extractor):
|
|||
duplicate_nodes = []
|
||||
for node in nodes:
|
||||
duplicate_transform = cmds.duplicate(node)[0]
|
||||
delete_bin.append(duplicate_transform)
|
||||
|
||||
# Discard the children.
|
||||
shapes = cmds.listRelatives(duplicate_transform, shapes=True)
|
||||
|
|
@ -145,7 +147,11 @@ class ExtractArnoldSceneSource(publish.Extractor):
|
|||
duplicate_transform, world=True
|
||||
)[0]
|
||||
|
||||
cmds.rename(duplicate_transform, node.split("|")[-1])
|
||||
duplicate_transform = "|" + node.split("|")[-1]
|
||||
|
||||
duplicate_nodes.append(duplicate_transform)
|
||||
delete_bin.append(duplicate_transform)
|
||||
|
||||
with attribute_values(attribute_data):
|
||||
with maintained_selection():
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ from openpype.pipeline.publish import (
|
|||
class ValidateArnoldSceneSource(pyblish.api.InstancePlugin):
|
||||
"""Validate Arnold Scene Source.
|
||||
|
||||
We require at least 1 root node/parent for the meshes. This is to ensure we
|
||||
can duplicate the nodes and preserve the names.
|
||||
|
||||
If using proxies we need the nodes to share the same names and not be
|
||||
parent to the world. This ends up needing at least two groups with content
|
||||
nodes and proxy nodes in another.
|
||||
|
|
@ -39,9 +42,6 @@ class ValidateArnoldSceneSource(pyblish.api.InstancePlugin):
|
|||
return ungrouped_nodes, nodes_by_name, parents
|
||||
|
||||
def process(self, instance):
|
||||
if not instance.data["proxy"]:
|
||||
return
|
||||
|
||||
ungrouped_nodes = []
|
||||
|
||||
nodes, content_nodes_by_name, content_parents = self._get_nodes_data(
|
||||
|
|
@ -50,7 +50,7 @@ class ValidateArnoldSceneSource(pyblish.api.InstancePlugin):
|
|||
ungrouped_nodes.extend(nodes)
|
||||
|
||||
nodes, proxy_nodes_by_name, proxy_parents = self._get_nodes_data(
|
||||
instance.data["proxy"]
|
||||
instance.data.get("proxy", [])
|
||||
)
|
||||
ungrouped_nodes.extend(nodes)
|
||||
|
||||
|
|
@ -61,6 +61,10 @@ class ValidateArnoldSceneSource(pyblish.api.InstancePlugin):
|
|||
"All nodes need to be grouped.".format(ungrouped_nodes)
|
||||
)
|
||||
|
||||
# Proxy validation.
|
||||
if not instance.data.get("proxy", []):
|
||||
return
|
||||
|
||||
# Validate for content and proxy nodes amount being the same.
|
||||
if len(instance.data["setMembers"]) != len(instance.data["proxy"]):
|
||||
raise PublishValidationError(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue