Hi

From the looks of it it mimics the filename filter callback ?!

http://docs.thefoundry.co.uk/nuke/70/pythondevguide/callbacks.html#filenamefilter

We use this in our win/linux environment and sofar there have not been problems...

Cheers
johannes

Am 12/15/12 2:18 AM, schrieb Jesse Kretschmer:
Howdy,
I was hoping to wire up a little script to help our single linux user safely operate on windows files.

For the most part we are using network drive letters. Any network drive letter has also been mapped to the linux box in a predictable way. On windows we have Z: on linux we have /Z

I kicked out a little menu.py script for the linux user, then I realized the flaw in my plan. The addOnScriptSave function is executed before the file is save. The saved file works perfectly in windows. However, now I need a callback to happen after the save completes. I really want an addAfterScriptSaved(). At the moment the user would have to reopen the script or manually execute the function.

For the moment, I've made a little menu to manually translate the files. Actually, I only need to offer the a command to put the script back in unix mode.

At this point, it's just academic. What else could I do to make this translation process smooth for my artist?

Thanks for looking.
Cheers,
Jesse

PS Here's my code:
import nuke
import re

def unix2windows():
    convertPaths(towin)
    pass

def windows2unix():
    convertPaths(tonix)
    pass

def convertPaths(func):
    nodes = []
    nodes = nuke.allNodes("Write")
    nodes.extend(nuke.allNodes("Read"))
    for n in nodes:
n.knobs()["file"].setValue(func(n.knobs()["file"].getValue()))

def tonix(path):
    newPath = re.sub(r'^([A-Z]):',r'/\1',path)
    return newPath.replace("\\","/")
def towin(path):
    return re.sub(r'^/([A-Z])',r'\1:',path)

nuke.addOnScriptSave(unix2windows)
nuke.addOnScriptLoad(windows2unix)


_______________________________________________
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