BigRoy feedback

This commit is contained in:
Toke Stuart Jepsen 2023-03-29 16:06:27 +01:00
parent 57bbf946fd
commit dea30d2f68
5 changed files with 23 additions and 30 deletions

View file

@ -22,9 +22,10 @@ class CollectArnoldSceneSource(pyblish.api.InstancePlugin):
self.log.warning("Skipped empty instance: \"%s\" " % objset)
continue
if objset.endswith("content_SET"):
set_members = get_all_children(cmds.ls(members, long=True))
instance.data["contentMembers"] = set_members
self.log.debug("content members: {}".format(set_members))
members = cmds.ls(members, long=True)
children = get_all_children(members)
instance.data["contentMembers"] = children
self.log.debug("content members: {}".format(children))
elif objset.endswith("proxy_SET"):
set_members = get_all_children(cmds.ls(members, long=True))
instance.data["proxy"] = set_members

View file

@ -126,18 +126,12 @@ class ExtractArnoldSceneSource(publish.Extractor):
# Only interested in transforms with shapes.
shapes = cmds.listRelatives(
node, shapes=True, fullPath=True
node, shapes=True, noIntermediate=True
) or []
if not shapes:
continue
parent = cmds.listRelatives(
node, parent=True, fullPath=True
)[0]
duplicate_transform = cmds.duplicate(node)[0]
duplicate_transform = "{}|{}".format(
parent, duplicate_transform
)
if cmds.listRelatives(duplicate_transform, parent=True):
duplicate_transform = cmds.parent(

View file

@ -58,17 +58,17 @@ def calculate_visibility_mask(attributes):
return mask
def get_cbid_by_node(path):
"""Get cbid from Arnold Scene Source.
def get_id_by_node(path):
"""Get node id from Arnold Scene Source.
Args:
path (string): Path to Arnold Scene Source.
Returns:
(dict): Dictionary with node full name/path and CBID.
(dict): Dictionary with node full name/path and id.
"""
import arnold
results = {}
results = defaultdict(list)
arnold.AiBegin()
@ -82,10 +82,7 @@ def get_cbid_by_node(path):
node = arnold.AiNodeIteratorGetNext(iter)
if arnold.AiNodeIs(node, "polymesh"):
node_name = arnold.AiNodeGetName(node)
try:
results[arnold.AiNodeGetStr(node, "cbId")].append(node_name)
except KeyError:
results[arnold.AiNodeGetStr(node, "cbId")] = [node_name]
results[arnold.AiNodeGetStr(node, "cbId")].append(node_name)
arnold.AiNodeIteratorDestroy(iter)
arnold.AiEnd()
@ -139,7 +136,7 @@ def shading_engine_assignments(shading_engine, attribute, nodes, assignments):
def assign_look(standin, subset):
log.info("Assigning {} to {}.".format(subset, standin))
nodes_by_id = get_cbid_by_node(get_standin_path(standin))
nodes_by_id = get_id_by_node(get_standin_path(standin))
# Group by asset id so we run over the look per asset
node_ids_by_asset_id = defaultdict(set)
@ -164,7 +161,8 @@ def assign_look(standin, subset):
continue
relationships = lib.get_look_relationships(version["_id"])
shader_nodes, container_node = lib.load_look(version["_id"])
shader_nodes, container_nodes = lib.load_look(version["_id"])
container_node = container_nodes[0]
namespace = shader_nodes[0].split(":")[0]
# Get only the node ids and paths related to this asset

View file

@ -121,15 +121,13 @@ def create_asset_id_hash(nodes):
path = cmds.getAttr("{}.fileName".format(node))
ids = get_alembic_ids_cache(path)
for k, _ in ids.items():
pid = k.split(":")[0]
if node not in node_id_hash[pid]:
node_id_hash[pid].append(node)
id = k.split(":")[0]
node_id_hash[id].append(node)
elif shapes and cmds.nodeType(shapes[0]) == "aiStandIn":
path = arnold_standin.get_standin_path(shapes[0])
for id, _ in arnold_standin.get_cbid_by_node(path).items():
pid = id.split(":")[0]
if shapes[0] not in node_id_hash[pid]:
node_id_hash[pid].append(shapes[0])
for id, _ in arnold_standin.get_id_by_node(path).items():
id = id.split(":")[0]
node_id_hash[id].append(shapes[0])
else:
value = lib.get_id(node)
if value is None:

View file

@ -11,7 +11,7 @@ from maya import cmds
from openpype.client import get_last_version_by_subset_name
from openpype.pipeline import legacy_io
from openpype.hosts.maya import api
import openpype.hosts.maya.lib as maya_lib
from . import lib
@ -189,8 +189,10 @@ def vrayproxy_assign_look(vrayproxy, subset="lookDefault"):
node_id: nodes_by_id[node_id] for node_id in node_ids
}
edits = list(
api.lib.iter_shader_edits(
relationships, shadernodes, asset_nodes_by_id))
maya_lib.iter_shader_edits(
relationships, shadernodes, asset_nodes_by_id
)
)
# Create assignments
assignments = {}