mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
get assets from ref nodes
This commit is contained in:
parent
50c5700f57
commit
f28a1e484a
1 changed files with 24 additions and 16 deletions
|
|
@ -103,12 +103,19 @@ def create_asset_id_hash(nodes):
|
|||
"""
|
||||
node_id_hash = defaultdict(list)
|
||||
for node in nodes:
|
||||
value = lib.get_id(node)
|
||||
if value is None:
|
||||
continue
|
||||
# iterate over content of reference node
|
||||
if cmds.nodeType(node) == "reference":
|
||||
ref_hashes = create_asset_id_hash(
|
||||
cmds.referenceQuery(node, nodes=True))
|
||||
for asset_id, ref_nodes in ref_hashes.items():
|
||||
node_id_hash[asset_id] += ref_nodes
|
||||
else:
|
||||
value = lib.get_id(node)
|
||||
if value is None:
|
||||
continue
|
||||
|
||||
asset_id = value.split(":")[0]
|
||||
node_id_hash[asset_id].append(node)
|
||||
asset_id = value.split(":")[0]
|
||||
node_id_hash[asset_id].append(node)
|
||||
|
||||
return dict(node_id_hash)
|
||||
|
||||
|
|
@ -135,18 +142,19 @@ def create_items_from_nodes(nodes):
|
|||
id_hashes = create_asset_id_hash(nodes)
|
||||
|
||||
# get ids from alembic
|
||||
vray_proxy_nodes = cmds.ls(nodes, type="VRayProxy")
|
||||
for vp in vray_proxy_nodes:
|
||||
path = cmds.getAttr("{}.fileName".format(vp))
|
||||
ids = vray_proxies.get_alembic_ids_cache(path)
|
||||
parent_id = {}
|
||||
for k, _ in ids.items():
|
||||
pid = k.split(":")[0]
|
||||
if not parent_id.get(pid):
|
||||
parent_id.update({pid: [vp]})
|
||||
if cmds.pluginInfo('vrayformaya', query=True, loaded=True):
|
||||
vray_proxy_nodes = cmds.ls(nodes, type="VRayProxy")
|
||||
for vp in vray_proxy_nodes:
|
||||
path = cmds.getAttr("{}.fileName".format(vp))
|
||||
ids = vray_proxies.get_alembic_ids_cache(path)
|
||||
parent_id = {}
|
||||
for k, _ in ids.items():
|
||||
pid = k.split(":")[0]
|
||||
if not parent_id.get(pid):
|
||||
parent_id.update({pid: [vp]})
|
||||
|
||||
print("Adding ids from alembic {}".format(path))
|
||||
id_hashes.update(parent_id)
|
||||
print("Adding ids from alembic {}".format(path))
|
||||
id_hashes.update(parent_id)
|
||||
|
||||
if not id_hashes:
|
||||
return asset_view_items
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue