From c1aedd3078dd53c8e028785f6e5d5a14788d11e6 Mon Sep 17 00:00:00 2001 From: Ben Souchet Date: Wed, 11 Sep 2024 17:11:27 +0200 Subject: [PATCH] Houdini: Ability to properly duplicate ROP --- openpype/hosts/houdini/api/plugin.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/houdini/api/plugin.py b/openpype/hosts/houdini/api/plugin.py index e162d0e4614..d72da9a80fb 100644 --- a/openpype/hosts/houdini/api/plugin.py +++ b/openpype/hosts/houdini/api/plugin.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- """Houdini specific Avalon/Pyblish plugin definitions.""" import sys +from uuid import uuid4 from abc import ( ABCMeta ) @@ -118,15 +119,27 @@ def cache_subsets(shared_data): if shared_data.get("houdini_cached_subsets") is None: cache = dict() cache_legacy = dict() + instance_id_list = [] for node in lsattr("id", "pyblish.avalon.instance"): creator_identifier_parm = node.parm("creator_identifier") + instance_id_parm = node.parm("instance_id") if creator_identifier_parm: # creator instance creator_id = creator_identifier_parm.eval() + instance_id = instance_id_parm.eval() + # Regenerating instance in case of identical values between nodes + if instance_id in instance_id_list or node.path() != node.parm("instance_node").eval(): + new_data = { + "instance_node": node.path(), + "instance_id": str(uuid4()), + "subset": node.name() + } + # Refreshing node values + imprint(hou.node(node.path()), new_data, update=True) cache.setdefault(creator_id, []).append(node) - + instance_id_list.append(instance_id) else: # legacy instance family_parm = node.parm("family")