Skip to content
This repository was archived by the owner on Oct 10, 2024. It is now read-only.

Commit f23f538

Browse files
authored
Merge pull request #87 from pypeclub/hotfix/nuke-get-set-avalon-attr
nuke avalon knobs were spreding to all write/read nodes
2 parents 12be07f + daa3c59 commit f23f538

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

avalon/nuke/lib.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def add_publish_knob(node):
8181
return node
8282

8383

84-
def set_avalon_knob_data(node, data={}, prefix="ak:"):
84+
def set_avalon_knob_data(node, data={}, prefix="avalon:"):
8585
""" Sets a data into nodes's avalon knob
8686
8787
Arguments:
@@ -99,10 +99,6 @@ def set_avalon_knob_data(node, data={}, prefix="ak:"):
9999
'subset': 'subsetMain'
100100
}
101101
"""
102-
# fix prefix back compatibility
103-
if not isinstance(prefix, list):
104-
prefix = [prefix]
105-
106102
# definition of knobs
107103
knobs = [
108104
{"name": 'AvalonTab', "value": '', "type": "Tab_Knob"},
@@ -136,7 +132,8 @@ def set_avalon_knob_data(node, data={}, prefix="ak:"):
136132
try:
137133
knob.setValue(k['value'])
138134
except TypeError as E:
139-
log.info("{} - Not correct knob (`{}`) value (`{}`). Error: `{}`".format(__name__, k["name"], k['value'], E))
135+
log.info("{} - Not correct knob value. "
136+
"Error: `{}`".format(__name__, E))
140137
else:
141138
if k["name"] not in node.knobs().keys():
142139
n_knob = getattr(nuke, k["type"])
@@ -145,7 +142,7 @@ def set_avalon_knob_data(node, data={}, prefix="ak:"):
145142

146143
# add avalon knobs for imprinting data
147144
for key, value in data.items():
148-
name = prefix[-1] + key
145+
name = prefix + key
149146
value = str(value)
150147

151148
try:
@@ -172,7 +169,7 @@ def set_avalon_knob_data(node, data={}, prefix="ak:"):
172169
return False
173170

174171

175-
def get_avalon_knob_data(node, prefix="ak:"):
172+
def get_avalon_knob_data(node, prefix="avalon:"):
176173
""" Gets a data from nodes's avalon knob
177174
178175
Arguments:
@@ -187,10 +184,12 @@ def get_avalon_knob_data(node, prefix="ak:"):
187184
prefix = list([prefix])
188185

189186
data = dict()
190-
log.debug("___> prefix: `{}`".format(prefix))
187+
191188
# loop prefix
192189
for p in prefix:
193-
190+
# check if the node is avalon tracked
191+
if "AvalonTab" not in node.knobs():
192+
continue
194193
try:
195194
# check if data available on the node
196195
test = node['avalon_data'].value()

0 commit comments

Comments
 (0)