Re-implement Nuke imprint#473
Conversation
|
|
||
| instance = [n for n in nodes | ||
| if n["name"].value() in self.name] or None | ||
| nodes = [n for n in nodes |
There was a problem hiding this comment.
Could this be turned into
node = next((n for n in nodes if n["name"].value() in self.name), None)`Also, the fallback to nuke.allNodes() at the top, would you ever want that to accidentally happen? Seems like that could cause crazy things at some point. You might, I'm just not sure what the intended workflow is.
And, line 161 will cause error on nothing selected None[0]. Maybe better to report a decent error message like "Select X or Y"?
There was a problem hiding this comment.
I think this has been taken cared by some of the commits in #438 , a bit hard to tell which's which, but from the full changes could see that's been improved.
Should be shipped in next PR :P
tokejepsen
left a comment
There was a problem hiding this comment.
Nice compacting of the knob logic @davidlatwe !
|
I like it. Certainly cleaner |
| return node | ||
|
|
||
|
|
||
| def get_avalon_knob_data(node, prefix="avalon:"): |
There was a problem hiding this comment.
Would it be possible to turn this into prefix=["avalon:", "ak:"] for backward compatibility with already running productions? it was previously prefix="ak:"
There was a problem hiding this comment.
Ah, okay, but I won't put mutable value as arg's default value, I might hard code it in the for loop below :)
Speaking of which, was there any reason for applying prefix on knobs ?
Would it be okay if we not using prefix in future (with backward compatibility of course) ?
There was a problem hiding this comment.
Would it be okay if we not using prefix in future (with backward compatibility of course) ?
If you found the efficient way to filter only avalon attributes from all knobs then yes. The reason was to separate only avalon metadata attributes, but didn't see other way to do it ;)
There was a problem hiding this comment.
I have found a way to list out all user-defined knobs in any given node, just like other host implementations (lib.read). But noted that user-defined layout knobs like tab or group will be listed too.
Here's the gist for trying:
https://gist.github.com/davidlatwe/519528bb01b4ff816389464ec2709e97
Maybe we could work without prefixing knob name if this works ?
Anyway, I'll try resolving this in another PR, this PR will be merged as is for now.
There was a problem hiding this comment.
Interesting solution!
Listing user defined knobs would definitely be useful.
There was a problem hiding this comment.
@jezscha I end up implementing the backward compatibility in a new method lib.read, instead of changing lib.get_avalon_knob_data. Please let me know how you think of this, it's in PR #476 😃
|
@davidlatwe this PR is awesome! Thanks for help ;) |
This PR is the first step of refactoring #438, for resolving
imprintwhich functionality was a bit rigid.What's changed
lib.imprintlib.imprint:lib.set_avalon_knob_datalib.add_publish_knobpipeline.Creatorlib.get_avalon_knob_datafrom Nuke: storing attributes in separated knobs with backward compatibility #438About
lib.imprintNuke has three categories of knobs, data-stored knob, layout knob and complex data knob, but let's put complex data knob aside for now.
On data-stored knob,
imprintwill create knob which fits to regular data types, likebool,int,float,str,list. Fordict, it will become a group of knobs, or a group of tabs.For example:
Which you will get
And this:
Will looks like this
And if you wish to use other kind of knobs which is not mapped in
lib.create_knob, you could uselib.Knobby, for example:And you have a file path knob
Hope this PR make sense to you, please let me know what you think.☺️