Hey Michael,

For the knobDefault part, you should give it the default value for the
whole knob, not just one of the fields.

So, considering that Defocus.scale already defaults to 1, you might do:

nuke.knobDefault('Defocus.scale', '1 {scale.w*2}')

For the second part, the problem is that the knob defaults to a "single
value" state. Instead of "nudging" it, you could do the following:


n['scale'].setSingleValue(False)

n['scale'].setExpression('scale.w*2',1)

Hope that helps.

Cheers,
Ivan

On Tue, Feb 7, 2012 at 6:15 PM, Michael Garrett <[email protected]>wrote:

> I want to do something like knobDefault('Defocus.scale.h',
> '{scale.w*2'}')  , which doesn't work....
>
> If I do this in the script editor, I found I even need to "nudge" the
> scale.h knob first before it will take the expression, but it works (6.3v6
> Linux):
>
>   n=nuke.selectedNode() # a Defocus
>
> n['scale'].setValue(1,1) # nudge it by forcing a value into the second
> tuple value
>
> n['scale'].setExpression('scale.w*2',1) # now add the expression
>
> I assume that if it's really necessary, there is some method for expanding
> the tuple value fields of a usually collapsed XY_Knob but I'm not sure what
> that would be.
>
> Thanks,
> Michael
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to