I believe what you're seeing is a case where setting the default
value/state of certain nodes/knobs is deferred until the Properties panel
is open, which explains the different behaviour of your script when run
interactively in the script editor vs running it in terminal mode, or from
an external IDE.

To validate this difference in behaviour, you can check this (from the
script editor):

t = nuke.createNode("TimeClip", inpanel = False)

t["last"].setValue(20)  # This won't stick, just as you're seeing in your
case

t2 = nuke.createNode("TimeClip")

t2["last"].setValue(20) # This works


I've noticed this on other nodes too, and it's indeed very obscure. The
only way I've found around it is to try to find what knobs are being set
differently, and set them manually in your script.

In the case of TimeClip, it seems like there's a invisible knob ("origset")
that seems to be driving this. So in this particular case, the following
might work both from an interactive and a non-interactive session:


t = nuke.createNode("TimeClip")

t["origset"].setValue(True)

t["last"].setValue(20)


Hope that helps!




On Sun, Dec 20, 2015 at 5:55 AM, Simon Björk <bjork.si...@gmail.com> wrote:

> I guess I could use a Retime node instead, but it seems odd why TimeClip
> doesn't work.
>
> * external, not extranal...*
>
>
>
>
>
> -------------------------------
> Simon Björk
> Compositor/TD
>
> +46 (0)70-2859503
> www.bjorkvisuals.com
>
> 2015-12-20 14:41 GMT+01:00 Simon Björk <bjork.si...@gmail.com>:
>
>> I'm having problems controlling values of a TimeClip node using the Nuke
>> module in an extranal IDE (Sublime Text). The following code works as
>> expected if I run it in the script editor, but if I run it from Sublime the
>> values don't stick (even though they're picked up when printing the value).
>>
>> Is this a bug or am I missing something? I can't see any callbacks
>> related to the TimeClip, but it looks like the root nodes first/last frame
>> are overriding my values.
>>
>> Code:
>>
>> import nuke
>>
>> t = nuke.createNode("TimeClip")
>> t["last"].setValue(20)
>>
>> to = nuke.createNode("TimeOffset")
>> to["time_offset"].setValue(500)
>>
>> nuke.scriptSave("D:/tmp.nk")
>>
>> /Simon
>>
>>
>>
>> -------------------------------
>> Simon Björk
>> Compositor/TD
>>
>> +46 (0)70-2859503
>> www.bjorkvisuals.com
>>
>
>
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to