def addFirstSlash(i_str):
if i_str[0] == '/' and i_str[1] != '/':
return '/' + i_str
return i_str
def mf_MSceneMessage_BeforeSave_CB(*args, **kwargs):
for f in mc.ls(type='file'):
mc.setAttr(f + '.ftn', addFirstSlash(mc.getAttr(f + '.ftn')), type='string')
om.MSceneMessage.addCallback(om.MSceneMessage.kBeforeSave, mf_MSceneMessage_BeforeSave_CB)
I think better approach here would be make use of "dirmap" command, so you could map Linux to Windows and vice versa..
Something like this:
dirmap("//server", "/server");
dirmap("/server", "//server");
Try running above command, and open file, all references and texture paths should remapped automatically by Maya.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d2c24e10-41f8-4b90-a05e-38369c42b8f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CA%2B7MZWtvrU3JSdZQ3v9PJTGu7QE27K9RCD2n1CwTYhK%2BZchL6A%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d2c24e10-41f8-4b90-a05e-38369c42b8f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--Best,
-M
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.