Hi,

put your backupPath into your saveBackup module and have your global init.py like this:

import saveBackup
saveBackup.backupPath = "D:/nuke_backup/"
nuke.addBeforeRender(saveBackup.saveBackup)

You have to directly call the backupPath in the saveBackup function because if you give it as an argument to the callback creation it keeps the value it has on creation.

In your show specific init.py set the new path:

import saveBackup
saveBackup.backupPath = "D:/MyShow/"

best regards,
Michael

Am 22.08.2014 11:55, schrieb Simon Björk:
Thanks for your suggestion. However, the problem I'm having isn't really
of the specific backup script. It's more what approach to use when using
a layered setup of init.py (global, show specific) where one should
override the other (just like gizmos).

Best regards,
Simon

Skickat från min iPhone

21 aug 2014 kl. 17:12 skrev José Alejandro Enríquez <zaban...@gmail.com
<mailto:zaban...@gmail.com>>:

Haven't you tried to create a post render backup using the override
for executeMultiple? It works perfectly for me, and the advantage is
that if something went wrong with the render it won't save the .nk
until is fixed so you keep a good file.


2014-08-21 7:18 GMT-05:00 Simon Björk <si...@bjorkvisuals.com
<mailto:si...@bjorkvisuals.com>>:

    Hi all,

    I have a script that saves a backup of the current script before
    rendering, using the nuke.addBeforeRender callback. Example (temp)
    script:

    def saveBackup(path):
     print path

    In my global init.py:

    import saveBackup
    backupPath = "D:/nuke_backup/"
    nuke.addBeforeRender(saveBackup.saveBackup, (backupPath) )

    This all works as expected, but what if I want to override the
    backupPath in a show specific init.py (loaded after the global)?
    If I add the callback again to my show init.py (using a different
    path)  I end up with a script that is run twice. What is the best
    way to get around this?

    I tried setting the backupPath as an environment variable, and
    then just changing the environment variable in the show specific
    init.py, and also removing the callback before adding it again,
    but none of those seems to work.

    Best regards,
    Simon




    -------------------------------
    Simon Björk
    Compositor/TD

    +46 (0)70-2859503 <tel:%2B46%20%280%2970-2859503>
    www.bjorkvisuals.com <http://www.bjorkvisuals.com>

    _______________________________________________
    Nuke-python mailing list
    Nuke-python@support.thefoundry.co.uk
    <mailto: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
<mailto: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

_______________________________________________
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