I don’t think you can prevent the script from closing from within the 
onScriptClose callback.

-Nathan

From: Holger Hummel|Celluloid VFX<mailto:hol...@celluloid-vfx.com>
Sent: Friday, June 17, 2016 1:44 AM
To: Nuke Python discussion<mailto:nuke-python@support.thefoundry.co.uk>
Subject: Re: [Nuke-python] Cancel Nuke Closing with onScriptClose-Callback


Hi Dominic,

i think this should work for what you're after.
Instead of nuke.scriptSave() you can of course do whatever you want.

Cheers,
Holger

def closeCallback():
     n = nuke.thisNode()
     if n.name() == 'Root':
         close = nuke.ask('really close?')
         if close == True:
             pass
         else:
             nuke.scriptSave()

nuke.addOnDestroy(closeCallback)


On 16.06.2016 12:00, Dominic Platz wrote:
>
> Hi there,
>
> does anybody know if I can add a custom onScriptClose-Callback that
> interrupts the nuke-closing?
>
> (e.g. like being asked for saving at closing and then clicking cancel)
>
> So I want something like:
>
> def function():
>
> if nuke.ask(“Really wanna close?”):
>
>             pass     #close it
>
> else:
>
>                         #do something and don’t close nuke
>
> Or is this anyway not possible, because the onScriptClose-Callback
> acts after all the node onDestory-Callbacks? And I won’t get a full
> intact script at that point?
>
> Cheers,
>
> Dominic
>
> ---
> Dominic Platz
> Lead Artist Compositing
>
> Mackevision Medien Design GmbH
> Forststraße 7
> 70174 Stuttgart
>
> T +49 711 93 30 48 639
> F +49 711 93 30 48 90
>
> dominic.pl...@mackevision.com
> www.mackevision.com
> <http://www.mackevision.com/?utm_source=E-Mail-Signatur&utm_medium=E-Mail&utm_campaign=Mackevision-Link>
>
> Geschäftsführer: Armin Pohl, Joachim Lincke, Jens Pohl
> HRB 243735 Amtsgericht Stuttgart
>
> ---
> *NEW PRODUCT:* Innovation in moving images - Motionbox
> <http://www.mackevision.com/motionbox/?utm_source=E-Mail-Signatur&utm_medium=E-Mail&utm_campaign=Motionbox-Signatur>
> *VFX:* Game of Thrones, Season 5 – VFX making of reel
> <http://www.mackevision.com/references/got-5-making-of/?utm_source=E-Mail-Signatur&utm_medium=E-Mail&utm_campaign=GoT-S5-making-of-Signatur>.
> *SOCIAL:* Follow us on Facebook
> <https://www.facebook.com/mackevision.global>, Twitter
> <https://twitter.com/Mackevision>, Behance
> <https://www.behance.net/mackevision> and Vimeo
> <https://vimeo.com/mackevision>
>
>
>
> _______________________________________________
> 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

--
Holger Hummel  -  hol...@celluloid-vfx.com

Celluloid Visual Effects GmbH & Co. KG
Paul-Lincke-Ufer 39/40, 10999 Berlin
phone +49 (0)30 / 54 735 220  -  m...@celluloid-vfx.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