Hi Ron,

Set the onCreate knob with a script that checks for a checkbox value and if
none gets the input width and height and sets the knob you want and then
toggles that checkbox to prevent this callback from being "evaluated" again.

Something like this:

k = """node = nuke.thisNode()

w = node.width()*0.5

h = node.height()*0.5

if not node.knob('set').value():

    node.knob('pos').setValue((w,h))

    node.knob('set').setValue(True)"""


 nuke.selectedNode().knob('onCreate').setValue(k)


Where the knob "set" is a checkbox knob that is hidden. I believe this is
what I've done in the past and it used to work.


Hope it helps.


Merry Christmas!



Cheers,

Diogo


On Tue, Dec 24, 2013 at 7:58 PM, Ron Ganbar <[email protected]> wrote:

> Ho, ho, ho, Randy.
> :-D
>
>
>
> Ron Ganbar
> email: [email protected]
> tel: +44 (0)7968 007 309 [UK]
>      +972 (0)54 255 9765 [Israel]
> url: http://ronganbar.wordpress.com/
>
>
> On Tue, Dec 24, 2013 at 10:10 PM, Randy Little <[email protected]>wrote:
>
>> That % method that fusion uses doesn't look so bad now I bet.
>>
>> Randy S. Little
>> http://www.rslittle.com/
>> http://www.imdb.com/name/nm2325729/
>>
>>
>>
>>
>> On Tue, Dec 24, 2013 at 11:58 AM, Ron Ganbar <[email protected]> wrote:
>>
>>> Yeah, that's a callback. If the callback is really simple (one simple
>>> line), than maybe. Otherwise, not possible.
>>>
>>> Thanks,
>>> R
>>>
>>>
>>>
>>> Ron Ganbar
>>> email: [email protected]
>>> tel: +44 (0)7968 007 309 [UK]
>>>      +972 (0)54 255 9765 [Israel]
>>> url: http://ronganbar.wordpress.com/
>>>
>>>
>>> On Tue, Dec 24, 2013 at 6:52 PM, Elias Ericsson Rydberg <
>>> [email protected]> wrote:
>>>
>>>> Is there some onCreate function you could use? If so, you could set the
>>>> expressions when it's created.
>>>>
>>>> Cheers,
>>>> Elias
>>>>
>>>> 24 dec 2013 kl. 17:23 skrev Ron Ganbar <[email protected]>:
>>>>
>>>> Hi all,
>>>> Merry Christmas everyone who celebrates it. You keep on enjoying your
>>>> holiday and disregard this email.
>>>>
>>>> Hi everyone else,
>>>> I'm making a little Gizmo and I want the default 2D position knob to
>>>> default at the center of whatever resolution there is when the gizmo is
>>>> created. If, before wrapping it all up as a Gizmo, I type width/2 in the
>>>> input field of the position knob, the expression evaluates and I'm left
>>>> with just a value, which won't change once the Group is a Gizmo. If I add
>>>> this as an expression, I get left with an expression. Is there a way to
>>>> make it dynamic, but without leaving the expression there?
>>>> And for what I'm doing, callbacks aren't really an option.
>>>>
>>>> Cheers,
>>>> Ron Ganbar
>>>> email: [email protected]
>>>> tel: +44 (0)7968 007 309 [UK]
>>>>      +972 (0)54 255 9765 [Israel]
>>>> url: http://ronganbar.wordpress.com/
>>>>
>>>> _______________________________________________
>>>> Nuke-users mailing list
>>>> [email protected], http://forums.thefoundry.co.uk/
>>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>>>
>>>>
>>>> _______________________________________________
>>>> Nuke-users mailing list
>>>> [email protected], http://forums.thefoundry.co.uk/
>>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>>>
>>>
>>>
>>> _______________________________________________
>>> Nuke-users mailing list
>>> [email protected], http://forums.thefoundry.co.uk/
>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>>
>>
>>
>> _______________________________________________
>> Nuke-users mailing list
>> [email protected], http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>
>
>
> _______________________________________________
> Nuke-users mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to