Hey Matty!
Indeed long time, and too long even. All is well and jolly in London while
the weather is this good I guess since the view out the window can be so much
nicer on days like these, hope life is treating you well and all is well up
North.
Thanks for the verification, no real reason I need to reduce that function
down to a single command just felt strange this feature wasn’t already part of
the API so I thought I was doing something silly.
Given that the folder creation is than nice and sturdy my issue at hand
becomes I feel the scenes directory gets cluttered when I save everything into
the root directory. Or to rephrase;
[Intent]
I wish to have a secondary shortcut that saves into my bespoke secondary
directory a versioned file instead of the root of my scenes directory, but
retain the current scene name once I'm done saving.
[Code]
from maya.cmds import file
from maya.cmds import workspace
def validate_path( filerule='scene' , pathname='brand new folder' ):
"""Creates a path within the current projects scene directory"""
scenepath = ''.join( [ workspace( q=1,rd=1 ) , workspace( filerule ,
q=1 , fre=1 ) ] )
path = '/'.join( [ scenepath , pathname ] )
workspace( create=path )
return path
def save( version='' , type='mayaBinary' , name='' , pathname=’’ ):
"""Places a saved out scene on disk"""
file( rename='%s %s' % ( '/'.join( [ validate_path( pathname=pathname)
, name ] ) , version ) )
file( save=True , type=type )
return True
if __name__ == '__main__':
save( name='Porks Werfect' , version='v002')
Now, if I run file( rename=’Porks Werfect’ ) at this point I see the feedback
in the script editor listing the new name without the version number as I’d
expect but the top of my UI still says Porks Werfect v001.mb
The name at the top of the UI then refreshes when I save the scene once more,
resulting in the scene being saved twice to have the name represented again the
way it was.
Any ideas or thoughts on how to save that scene retaining the current name
but place a backup of the file in my new directory, while using Maya's internal
libraries or built-in python functions alone?
--
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.