I'm following this topic with interest. I'm doing an ugly workaround by
creating a pre-defined set of folders, but ideally I'd like to solve this
the "nice" way.

// Fredrik


On Mon, Jul 7, 2014 at 8:48 AM, Marcus Ottosson <konstrukt...@gmail.com>
wrote:

> Hey Justin,
>
> That would make a lot of sense, but unfortunately it doesn’t seem to work.
> It does create the workspace.mel file but with the following content:
>
> //Maya 2015 Project Definition
>
> workspace -bw "default";
>
> Which effectively silences the “Create new workspace” dialog from the UI,
> but doesn’t provide the default hierarchy of folders that I’m looking for -
> mainly the “scenes” directory, so that when the user hit “Save” he’d be
> taken to it and not to the root of the workspace. Here is some of the
> definitions I’m looking to have it create.
>
> //Maya 2015 Project Definition
>
> workspace -bw "default";
> workspace -fr "images" "images";
> workspace -fr "scripts" "scripts";
> workspace -fr "mayaAscii" "scenes";
> workspace -fr "mayaBinary" "scenes";
> workspace -fr "scene" "scenes";
> workspace -fr "sourceImages" "sourceimages";
>
> Although ideally it’d create whatever defaults there is, as is the case
> when creating it via the UI.
>
> I should re-iterate, that “defaults” is the keyword here. I could of
> course put these commands in and create the hierarchy myself via
> os.makedirs, but that isn’t what I’m looking for here.
> ​
>
>
> On 7 July 2014 03:10, Justin Israel <justinisr...@gmail.com> wrote:
>
>> Hey Marcus,
>>
>> You just want it to create the workspace.mel file that it creates for you
>> when you set a new project from the UI?
>>
>> If so, this seems to work for me:
>>
>> import osimport maya.cmds as cmds
>>
>> root = "~/tmp"
>> name = "maya_test"
>>
>> fullpath = os.path.expanduser(os.path.join(root, name))
>> if not os.path.exists(fullpath):
>>     os.makedirs(fullpath)
>>     cmds.workspace(fullpath, n=True)
>>     cmds.workspace(fullpath, o=True)
>>     cmds.workspace(fullpath, s=True)
>>
>> ​
>> I assume directory creation is part of the Project Manager or other
>> operations that intend to use the directories resolved relative to the
>> workspace root.
>>
>>
>>
>> On Mon, Jul 7, 2014 at 1:03 AM, Marcus Ottosson <konstrukt...@gmail.com>
>> wrote:
>>
>>> Hey,
>>>
>>> I’m doing this:
>>>
>>> $ maya -proj /my/new/project/dir
>>>
>>> But noticed that Maya isn’t creating the default project definition it
>>> otherwise would if I instead launched Maya and went with File->Set Project
>>> upon which it asks if you’d like to create one.
>>>
>>> Is there a better way of starting up Maya to default into a workspace
>>> than the command-line flag? Alternatively, is there a command to establish
>>> a project definition or otherwise ensure that one exists?
>>>
>>> I’ve dabbed my fingers in cmds.workspace, which has the newWorkspace
>>> argument, but with no luck. I had a look at the only command spit out by
>>> Maya upon clicking the “Create Default Workspace” button when setting a new
>>> project, np_getPrimaryProjectFileRules but that seems more a
>>> post-script as it merely queries the already existing definitions.
>>>
>>> The end result I’m looking for is a Maya directory with the expected
>>> directories set up, so that when saving for the first time it brings you to
>>> the /scenes directory.
>>>
>>> Best,
>>> Marcus
>>> ​
>>> --
>>> *Marcus Ottosson*
>>> konstrukt...@gmail.com
>>>
>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBtNu_QUrBHhLrsk_NrH_7JfFC3NLcZHN5q_w%2B87C8%3DgA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBtNu_QUrBHhLrsk_NrH_7JfFC3NLcZHN5q_w%2B87C8%3DgA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3XWXcG64zVJwrdbZgUVPOmkNDAFf7MAABvMOQE22tVLQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3XWXcG64zVJwrdbZgUVPOmkNDAFf7MAABvMOQE22tVLQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Marcus Ottosson*
> konstrukt...@gmail.com
>
> --
> 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+unsubscr...@googlegroups.com.
>  To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCqUZVXikdtyJzGhHKD1oB0ubsDGD0nWVyjp9-VKsz1NQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCqUZVXikdtyJzGhHKD1oB0ubsDGD0nWVyjp9-VKsz1NQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWMxDWhBnoHQN6DMm6JfqXOqxZfR0Le5CnLArGhu3Je2kg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to