mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
fix container id uniqueness for each class instance
This commit is contained in:
parent
af0dd3856f
commit
1263d969e0
2 changed files with 13 additions and 4 deletions
|
|
@ -49,8 +49,11 @@ def get_review_presets_config():
|
|||
|
||||
class NukeLoader(api.Loader):
|
||||
container_id_knob = "containerId"
|
||||
container_id = ''.join(random.choice(
|
||||
string.ascii_uppercase + string.digits) for _ in range(10))
|
||||
container_id = None
|
||||
|
||||
def reset_container_id(self):
|
||||
self.container_id = ''.join(random.choice(
|
||||
string.ascii_uppercase + string.digits) for _ in range(10))
|
||||
|
||||
def get_container_id(self, node):
|
||||
id_knob = node.knobs().get(self.container_id_knob)
|
||||
|
|
@ -67,13 +70,16 @@ class NukeLoader(api.Loader):
|
|||
source_id = self.get_container_id(node)
|
||||
|
||||
if source_id:
|
||||
node[self.container_id_knob].setValue(self.container_id)
|
||||
node[self.container_id_knob].setValue(source_id)
|
||||
else:
|
||||
HIDEN_FLAG = 0x00040000
|
||||
_knob = anlib.Knobby(
|
||||
"String_Knob",
|
||||
self.container_id,
|
||||
flags=[nuke.READ_ONLY, HIDEN_FLAG])
|
||||
flags=[
|
||||
nuke.READ_ONLY,
|
||||
HIDEN_FLAG
|
||||
])
|
||||
knob = _knob.create(self.container_id_knob)
|
||||
node.addKnob(knob)
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ class LoadClip(plugin.NukeLoader):
|
|||
|
||||
def load(self, context, name, namespace, options):
|
||||
|
||||
# reste container id so it is always unique for each instance
|
||||
self.reset_container_id()
|
||||
|
||||
is_sequence = len(context["representation"]["files"]) > 1
|
||||
|
||||
file = self.fname.replace("\\", "/")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue