I just bought myself a brand new laptop and figured with such a clean slate
to have a little play with the maya.cmds file and workspace commands. All in
good fun and all that but I'm having troubles wrapping my head around one
seemingly simple thing.
I wish to create a folder within my scenes folder.
Sounds simple enough, but this is what I wrote:
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
Which does the following :
--[ Accepts an input filerule to return whatever the scenes directory is set to
in the workspace.mel file or the project settings.
--[ Lets you name your folder as it gets created.
--[ Is not dependant on any modules other than Maya's own
--[ Creates the directory if it doesn't exist.
--[ Returns the path
Now for the seemingly overcomplicated part, In order to get the path to my
scenes directory I'm querying the root directory of my project then joining the
name of the scenes file rule, but isn't there an elusive flag somewhere that I
can use to query the path to the scenes filerule directly, something like:
maya.cmds.workspace( query=True ,filerule='scene' , path=True )
But this line naturally doesn't work.
Any ideas ?
--
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.