Batch process

85 views
Skip to first unread message

likage

unread,
Feb 13, 2015, 3:45:02 AM2/13/15
to python_in...@googlegroups.com


I am trying to attempt something where it does the following:
* Open a new Maya Scene
* Imports in a rig
* Apply animation curve onto the rig
* Publish

Meaning, to say, in one Maya scene - there will only be one rig plus its own animation.
Pertaining to the above, I will need to do the same thing over a huge list that I have.

And so, was wondering if this is possible to be done in an automated manner?

I did write up a mock UI, where it allows user to select the rigs they wanted to import, and provide the file location where the animation curve is to be applied against the rig import
So far I have only completed the rig importing part (was a single selection).
Say, if this automatedd process can indeed be done, and I have selected two rigs, are there any ways in which I can test to know there Maya is indeed having 2 maya scenes, each loading in the rig?


Marcus Ottosson

unread,
Feb 13, 2015, 3:58:24 AM2/13/15
to python_in...@googlegroups.com

Sounds simple enough.

def do(rig):
    # Open a new Maya Scene
    cmds.file(newFile=True)

    # Imports in a rig
    cmds.file(rig, i=True)

    # Apply animation curve onto the rig
    apply_my_animation()  # Your custom function for applying animation

    # Publish
    cmds.file(exportAll=True)

Pass this once for every file you’d like to have opened. For example.

import os

for rig in os.listdir("/my_rigs"):
    do(rig)

Job done. :)

are there any ways in which I can test to know there Maya is indeed having 2 maya scenes, each loading in the rig?

Not sure I follow, what is it that you would like to test for?


--
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/f8d367d8-c1cc-469c-9866-4d4a542a8e69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Fredrik Averpil

unread,
Feb 13, 2015, 3:59:29 AM2/13/15
to python_in...@googlegroups.com
In case you want to do it on the commandline, check out `maya -batch -command ...`

// F






Eduardo Grana

unread,
Feb 13, 2015, 7:40:40 AM2/13/15
to python_in...@googlegroups.com
Hello!
You can also try with python standalone for batchs...
Cheers!
Eduardo


For more options, visit https://groups.google.com/d/optout.



--
Message has been deleted

likage

unread,
Feb 15, 2015, 11:12:50 PM2/15/15
to python_in...@googlegroups.com
I apologize in advance if I did not make myself clear, really sorry about that.

Basically, I am trying to source for Rigs in the database (if you see the screenshot below, the UI is still not exactly done but...), User will first source the rigs in the Search Filter, they can select multiple rig versions and the add the rigs by clicking onto the "Add Rig" button which will then display under the QTreeWidget under the Migrate section

Then via the list of rigs in the QTreeWidget in the Migrate section, based on each item in the list, I would like to import each item into a new scene since very much later on, I will need to get this published out based on each new scene. 

Of course before that, I would like to get this importing + new scene thingy settled first before I try advacning to the more complicated stuff... And so that is why I had wanted it to be an automated process..

About the standalone as mentioned by Educardo, I tried:
import maya.standalone as standalone
standalone
.initialize(name='python')
but I gotten this error in my editor:
# Error: initialize() takes no keyword arguments
# Traceback (most recent call last):
#   File "<maya console>", line 2, in <module>
# TypeError: initialize() takes no keyword arguments #

 

Chad Dombrova

unread,
Feb 15, 2015, 11:20:11 PM2/15/15
to python_in...@googlegroups.com, python_in...@googlegroups.com
the name argument to initialize was added in a more recent version of Maya.  you can leave it out.  

One thing to note is that standalone.initialize() does not initialize Maya the same way that Maya is initialized in any other mode  (maya -batch, maya -prompt, Render, or GUI). It does not run any of the root MEL scripts that are run directly by Maya during the startup process, including pluginPrefs.mel and userSetup.mel, so MEL procedures or plugins which you might expect to be available may not be.  If you use PyMEL it will take care of all of this initialization for you: just import pymel.core from mayapy.

-chad






Sent from Mailbox


--
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.

likage

unread,
Feb 16, 2015, 6:24:56 AM2/16/15
to python_in...@googlegroups.com
This is slightly off topic but is it possible to add multiple of the same selection/items, in this case, for example I wanted to add 3 items of the same selection in my search filter into the QTreeWidget under the Migrate section?

Justin Israel

unread,
Feb 16, 2015, 12:30:53 PM2/16/15
to python_in...@googlegroups.com

Sure,  why not just run your add code N times? What's the blocking issue?


On Tue, 17 Feb 2015 12:25 AM likage <dissid...@gmail.com> wrote:
This is slightly off topic but is it possible to add multiple of the same selection/items, in this case, for example I wanted to add 3 items of the same selection in my search filter into the QTreeWidget under the Migrate section?

--
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.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages