Thursday, September 30, 2010

Maya 2011 Subscription Pack now available

Autodesk have just made the Maya2011 Subscription Advantage Pack available on the Subscription Center for download. Great another bug fix build and a few new toys to play with, then never use again.

BE WARNED: point release 2011.5
They've made this a full point release so it now makes a ...docs/maya/Maya2011.5 for your prefs. Ok, this is fine, our pipelines can easily cope with this but what they've also done is had the program install into:

\Autodesk\Maya 2011 Subscription Advantage Pack

Not only not following their own naming conventions, but also filling the path with WHITE SPACES! How the hell are large scale studio pipelines which need to support multiple versions of Apps meant to deal with that one in a consistent manner? We can no longer guarantee any naming conventions and that's going to make life really tough. Our pipeline installer adds a python sitecustomize.py file into the Python\lib\site-packages dir so we need to be able to find it.

Oh, and to make it even better `getApplicationVersionAsFloat` returns 2011 not 2011.5! Great, thanks guys not that really has scuppered us.

WHY... and if somebody from Autodesk uses the word "Interoperability" again to try and persuade me that moving between apps is a good idea, just because they own them all, I'm going to kill them then dance over their still burning embers!

Friday, September 10, 2010

Relative Namespaces in Maya2011

I just wanted to add a quick pointer to the namespace -rel flag in Maya 2011 and how it can make managing namespaces a whole lot easier. By default this is set to false, meaning that all namespaces are treated from the root space (":") When you look in the Reference editor what you see as the namespace is the actual ns that the file was imported into.

Lets say you had imported a file 3 times on itself, so ended up with nested namespaces:

THIS:IS:ATEST:Myfile.ma

Now if you look in the ref editor you'll see the namespace as ATEST. If you try and change it it'll say the namespace doesn't exist. This is because your by default in root (":") space. This is where the rel flag can really help, it makes the namespace handling RELATIVE to the current space your in.

So mel:
namespace -set "THIS:IS";
namespace -rel true;
file -e -ns "FIXED" "C:/Test_Rig.ma";
namespace -rel false; 
namespace -set ":";

So here were setting ourself into the namespace THIS:IS, making all namespace actions relative to this, setting the new namespace to FIXED and then returning ourselves to root sapce and tuirning off the rel falg. The result is you've now changed the namespace that it said couldn't be changed, ending up with

THIS:IS:FIXED

Mark

Monday, September 6, 2010

fileBrowserDialog is no more! Thankyou Pymel!

Anybody who's used the Maya fileBrowserDialog command will know what a pain in the arse it is, having to always pass in a function for it to use on the returned selection. Why the hell couldn't it just give you back the path.
import pymel.core as pCore
print 'Folder Selected : %s' % (pCore.promptForFolder())
import pymel.core as pCore
print 'File Selected : %s' % (pCore.promptForPath())
Well, no more, I might have guessed that Chad would have simplified this and bingo Pymel promptForFolder() and promptForPath() functions. At last, it opens the file prompt window and just gives you back the return.

Chad,Pymel thankyou!

Thursday, September 2, 2010

Exporting Simple Skeleton and Mesh data via FBX in Maya

Its something that you think should be really easy, taking your animated rig data and spitting out an nice clean fbx containing just the animated skeleton and mesh data, but in practice Fbx is such a beast it needs a little pre-setup to achieve. What you need to do is to first select the nodes you want to output. FBX has no concept of what it should, or shouldn't output, so use the export selected option from Maya.

If like most rigs you have a master bind skeleton, select it's root, then run something like this to select any joint and mesh data under it, you may need to shift select your skin, the key is to get what you want selected and nothing else:

import maya.cmds as cmds
meshes=[]
joints=cmds.ls(sl=True)

#find all joints
joints.extend(cmds.listRelatives(type='joint',allDescendents=True))

#find your Skinned Geo
for skin in cmds.listConnections(joints,type='skinCluster'):
    if skin:
        shape=cmds.skinCluster(skin,query=True,geometry=True)
        meshTransform=cmds.listRelatives(shape,parent=True)[0]
        if meshTransform not in meshes:
            meshes.append(meshTransform)

cmds.select(joints,meshes)

Right, now you have the nodes you actually want to go through for export. I should point out here that this only works from Maya2010 onwards, there was an FBX bug in older versions of the export selected.

Here's the key, in the FBX output options (use fbs not fbx_dae) you need to go to the Animation Options block and make sure that these 2 flags are set.

Bake-Animations = ON, InputConnections= OFF




That's it. You should end up with a nice clean fbx with JUST the data you wanted in it.