True, that works if your knob is animated... What happens when it’s split but just set to static values? Or a mixture of static and animated components?
-Nathan
From: Nathan Dunsworth
Sent: Wednesday, March 30, 2011 3:27 PM
To: Nuke Python discussion
Cc: Nathan Rusch
Subject: Re: [Nuke-python] more views than actual views
No need to parse Knob::toScript. Just iterator over the knobs Animation
objects.
for v in nuke.views():
print theKnob.animations(view=v)[0].view()
On Wed, Mar 30, 2011 at 3:00 PM, Nathan Rusch <[email protected]> wrote:
I recently posted a little info in this vein on VFXNation
(http://www.vfxnation.com/showthread.php/252-Multiview-setExpression%28%29?p=2196#post2196),
as I found myself dealing with a similar case recently.
Basically the only reliable way to deal with split knobs (to my knowledge)
for the time being is to parse the knob’s .toScript() string. The code I wrote
is for seeing if a given node name is present in any expression links on a
knob, and if so, at which indices and views. Needless to say, it gets pretty
indented .
The rough code to check how many view curves exist for a knob is something
like this:
------------------------------------------
# Assumes the knob in question is assigned to ‘knob’
import re
fullViewsString = r’default\s\{|’ + ‘|’.join([r‘%s\s\{’ % v for v in
nuke.views()])
viewsRE = re.compile(‘(%s)’ % fullViewsString)
knobViews = [match.rstrip(‘ {‘) for match in viewsRE.findall(knob.toScript())]
------------------------------------------
‘knobViews’ will be a nice list of all the view curves that exist on that
knob. Just ignore the ‘default’ and you’ve got all the split views.
Hope this helps.
-Nathan
From: Howard Jones
Sent: Wednesday, March 30, 2011 2:33 PM
To: Nuke Python discussion
Subject: Re: [Nuke-python] more views than actual views
Thanks Nathan (and other Nathan)
One of the other things that is odd is that if you unsplit right it changes
to default rather than take the right's values which is counter intuitive.
I guess the question is if any body bothers splitting to this level. I'm
coding for it but it means things running more often to catch it.
Is there a way of checking if a knob has been split and to how far?
H
------------------------------------------------------------------------------
From: Nathan Rusch <[email protected]>
To: Nuke Python discussion <[email protected]>
Sent: Wed, 30 March, 2011 16:42:41
Subject: Re: [Nuke-python] more views than actual views
Nuke always keeps a ‘default’ knob curve around when you start splitting
knobs. So if you split off your ‘left’ view, you’re creating curves for ‘left’
and ‘default,’ which, as you can imagine, everything else falls through to.
Once you split off ‘right,’ you’re up to 3 curves.
Why they let you split a knob into more components than there are views in
your script is a great question... I imagine there was a reason for it when
they designed it that way, but I have no idea if that reason is still valid or
applicable.
-Nathan
From: Howard Jones
Sent: Wednesday, March 30, 2011 12:56 AM
To: Nuke Python discussion
Subject: [Nuke-python] more views than actual views
Dear All.
Does anybody know why it is possible to end up with more curves per view than
there are views?
That is create a stereo project
split off a knob to left right,
you get 2 curves, knobs etc
knob.le
knob
split it again and you get
knob.le
knob.re
knob.*
the last one is an extra knob beyond the amount of views you have.
I can understand from a code pov why when you split knobs in the first place
you get
knob.le
knob
and not
knob.le
knob.re
but I cant understand the need for the extra view.
Is this a bug or clever behaviour.
It means btw if you want to know how many views are in a project you have to
add 1 to the result.
ie len(nuke.views()) is potentially 1 short unless its safe to ignore the
extra one.
Howard
------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected]
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected]
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected]
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
<<wlEmoticon-openmouthedsmile[1].png>>
_______________________________________________ Nuke-python mailing list [email protected] http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
