I think I understand what you're trying to do.

Generally in Nuke you monitor rendering by binding callbacks to the
Executable-type Nodes, such as Writes.

Are you able to edit your init.py? If so, you should be able to listen for
the onScriptLoad() and onCreate() callbacks and add the onRender*()
callbacks to all Executable (write) Nodes you want - indirectly touching
the Write Nodes. This should be fine as you're just extending the Nodes,
and not changing them (i.e. all other functionality should remain the same.
You can determine which Nodes are Executable either by looking at the type
(with isinstance) or by looking for the afterRender knob (and related) -
milage may vary.

hth

F.

On 27 April 2015 at 23:11, Sam Cole <[email protected]> wrote:

> Hi Frank,
>
> I have to admit I scanned that super quickly just now, but it looks like
> I'd have to touch the Write node to add beforeRender callbacks? If that's
> the case and I get a moment this afternoon I will try stashing a disabled
> dummy Write node in a group and see if I can run anything.
>
> On Mon, Apr 27, 2015 at 8:29 PM, Frank Harrison <[email protected]>
> wrote:
>
>> Does this callback solve your "right before render" problem?
>>
>>
>> http://docs.thefoundry.co.uk/nuke/90/pythondevguide/callbacks.html?highlight=beforerender
>>
>>
>> As for calling something during render, well Nuke provides the
>> executeInMainThread() set of functions, NOTE: these only work in GUI mode:
>>
>>
>> http://docs.thefoundry.co.uk/nuke/90/pythondevguide/threading.html?highlight=executeinmainthread
>>
>>
>> Otherwise, the problem is a standard threading issue, i.e. you could
>> spawn a thread when you receive beforeRender() to do some tertiary work and
>> kill it on afterRender(). However, if you want to communicate with Nuke
>> from a custom thread whilst in render/terminal mode you may experience some
>> problems calling non-thread safe interfaces (e.g. nuke.createNode()), which
>> is something we hope to fix in the not to distant future.
>>
>> Does that answer you question? :)
>>
>> On 26 April 2015 at 04:16, Sam Cole <[email protected]> wrote:
>>
>>> In the same vein, what's the easiest way to call something during a
>>> render without touching write nodes? e.g. If I want to call a pyscript
>>> buttons execute right before a render but not mess with any of the facility
>>> preflight etc.
>>>
>>>
>>>
>>> On Sat, Apr 25, 2015 at 1:44 AM, Frank Harrison <[email protected]>
>>> wrote:
>>>
>>>> Just saying that you don't want to rely on having a valid nuke module,
>>>> Root_Node, DDImage infrastructure, etc..
>>>>
>>>> If it's a gui-only thing you could connect a slot to the aboutToQuit()
>>>> signal
>>>>
>>>> http://doc.qt.io/qt-4.8/qcoreapplication.html#aboutToQuit
>>>>
>>>>
>>>> On 24 April 2015 at 14:19, Fredrik Averpil <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Frank,
>>>>>
>>>>> I just ran a test here with atExit, and that worked fine. Are you
>>>>> saying I shouldn't rely on it?
>>>>> If so, any other ideas?
>>>>>
>>>>> Regards,
>>>>> Fredrik
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Apr 23, 2015 at 3:07 PM Frank Harrison <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Just to let you know that by the time atExit callbacks are called
>>>>>> Nuke will have shut down most of its systems :)
>>>>>>
>>>>>> On 23 April 2015 at 09:05, Ben Dickson <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> You can run code when the python interpreter exits with the 'atexit'
>>>>>>> module:
>>>>>>>
>>>>>>> https://docs.python.org/2/library/atexit.html
>>>>>>>
>>>>>>>
>>>>>>> On 23/04/15 17:27, Fredrik Averpil wrote:
>>>>>>>
>>>>>>>> Does anyone know if it is possible to tell Nuke to execute a
>>>>>>>> function
>>>>>>>> when it exits?
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Fredrik
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Nuke-python mailing list
>>>>>>>> [email protected],
>>>>>>>> http://forums.thefoundry.co.uk/
>>>>>>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> ben dickson
>>>>>>> 2D TD | [email protected]
>>>>>>> rising sun pictures | www.rsp.com.au
>>>>>>> _______________________________________________
>>>>>>> Nuke-python mailing list
>>>>>>> [email protected],
>>>>>>> http://forums.thefoundry.co.uk/
>>>>>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Frank Harrison
>>>>>> Senior Nuke Software Engineer
>>>>>> The Foundry
>>>>>> Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
>>>>>> Web: www.thefoundry.co.uk
>>>>>> Email: [email protected]
>>>>>>  _______________________________________________
>>>>>> 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
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Frank Harrison
>>>> Senior Nuke Software Engineer
>>>> The Foundry
>>>> Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
>>>> Web: www.thefoundry.co.uk
>>>> Email: [email protected]
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>>
>> --
>> Frank Harrison
>> Senior Nuke Software Engineer
>> The Foundry
>> Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
>> Web: www.thefoundry.co.uk
>> Email: [email protected]
>>
>> _______________________________________________
>> 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
>
>


-- 
Frank Harrison
Senior Nuke Software Engineer
The Foundry
Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
Web: www.thefoundry.co.uk
Email: [email protected]
_______________________________________________
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