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

Commit

Permalink
Merge pull request #5561 from BigRoy/enhancement/maya_yeti_include_pr…
Browse files Browse the repository at this point in the history
…eview_attributes
  • Loading branch information
antirotor authored Sep 6, 2023
2 parents 1c667f9 + 26ef581 commit c428a60
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
16 changes: 15 additions & 1 deletion openpype/hosts/maya/plugins/load/load_yeti_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
from openpype.hosts.maya.api.pipeline import containerise


# Do not reset these values on update but only apply on first load
# to preserve any potential local overrides
SKIP_UPDATE_ATTRS = {
"displayOutput",
"viewportDensity",
"viewportWidth",
"viewportLength",
}


def set_attribute(node, attr, value):
"""Wrapper of set attribute which ignores None values"""
if value is None:
Expand Down Expand Up @@ -205,6 +215,8 @@ def update(self, container, representation):
yeti_node = yeti_nodes[0]

for attr, value in node_settings["attrs"].items():
if attr in SKIP_UPDATE_ATTRS:
continue
set_attribute(attr, value, yeti_node)

cmds.setAttr("{}.representation".format(container_node),
Expand Down Expand Up @@ -311,7 +323,6 @@ def create_node(self, namespace, node_settings):
# Update attributes with defaults
attributes = node_settings["attrs"]
attributes.update({
"viewportDensity": 0.1,
"verbosity": 2,
"fileMode": 1,

Expand All @@ -321,6 +332,9 @@ def create_node(self, namespace, node_settings):
"visibleInRefractions": True
})

if "viewportDensity" not in attributes:
attributes["viewportDensity"] = 0.1

# Apply attributes to pgYetiMaya node
for attr, value in attributes.items():
set_attribute(attr, value, yeti_node)
Expand Down
36 changes: 23 additions & 13 deletions openpype/hosts/maya/plugins/publish/collect_yeti_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@

from openpype.hosts.maya.api import lib

SETTINGS = {"renderDensity",
"renderWidth",
"renderLength",
"increaseRenderBounds",
"imageSearchPath",
"cbId"}

SETTINGS = {
# Preview
"displayOutput",
"colorR", "colorG", "colorB",
"viewportDensity",
"viewportWidth",
"viewportLength",
# Render attributes
"renderDensity",
"renderWidth",
"renderLength",
"increaseRenderBounds",
"imageSearchPath",
# Pipeline specific
"cbId"
}


class CollectYetiCache(pyblish.api.InstancePlugin):
Expand Down Expand Up @@ -39,10 +50,6 @@ def process(self, instance):
# Get yeti nodes and their transforms
yeti_shapes = cmds.ls(instance, type="pgYetiMaya")
for shape in yeti_shapes:
shape_data = {"transform": None,
"name": shape,
"cbId": lib.get_id(shape),
"attrs": None}

# Get specific node attributes
attr_data = {}
Expand All @@ -58,9 +65,12 @@ def process(self, instance):
parent = cmds.listRelatives(shape, parent=True)[0]
transform_data = {"name": parent, "cbId": lib.get_id(parent)}

# Store collected data
shape_data["attrs"] = attr_data
shape_data["transform"] = transform_data
shape_data = {
"transform": transform_data,
"name": shape,
"cbId": lib.get_id(shape),
"attrs": attr_data,
}

settings["nodes"].append(shape_data)

Expand Down

0 comments on commit c428a60

Please sign in to comment.