Thanks for responding Justin.  What you're talking about is how to get the
attributes associated with an "Anim Layer".  My question is how do you
select an Anim Layer?  I've found the soluction though.

source "C:/Program
Files/Autodesk/Maya2011/scripts/startup/buildSetAnimLayerMenu.mel";

selectLayer("AnimLayer1");

On Wed, Aug 22, 2012 at 10:33 PM, Justin Israel <[email protected]>wrote:

> Since I didn't know the answer to the Animation Layer question
> immediately, I can tell you what my process was for finding the solution...
>
> First, I will turn on Echo All Command for the Script Editor, and do the
> actual Select Objects for the Anim Layer. The print out tells me that it
> uses a MEL command: layerEditorSelectObjectAnimLayer
> This takes a []string array of anim layers, and selects them. From here,
> you could use maya.mel.eval() and call it with an array format like
>  "{AnimLayer1}".
> But if you want to get a more programmatic way to get the objects, I would
> then type the mel command:
>     whatIs layerEditorSelectObjectAnimLayer
>
> This shows me the mel file that contains this definition. When I open the
> mel script up and read the code, I see that it recursively calls that same
> function on the layers, looking for the root layer, to which is then uses
> the python equivalent:
>
>     cmds.animLayer("AnimLayer1", q=True, attribute=True)
>
> This will dump out all the attributes of that Anim Layer, like:
>
>  # Result: [u'pSphere1.visibility',
>  u'pSphere1.translateX',
>  u'pSphere1.translateY',
>  u'pSphere1.translateZ',
>  u'pSphere1.rotateX',
>  u'pSphere1.rotateY',
>  u'pSphere1.rotateZ',
>  u'pSphere1.scaleX',
>  u'pSphere1.scaleY',
>  u'pSphere1.scaleZ'] #
>
> But I would suppose what we want really is the object list. So I would
> loop over those results, and split out the object name into a set, so that
> the results are unique:
>
>  objs = set(attr.split('.')[0] for attr in cmds.animLayer("AnimLayer1",
> q=True, attribute=True))
>  # Result: set([u'pSphere1']) #
>
> Hope that helps!
>
>
>  On Aug 22, 2012, at 8:37 AM, Long Phan wrote:
>
>  I'm using Maya 2011. I'm trying to get the command to select (hi-lite)
> an "Animation Layer". I also need the command to set the "Key in Selected
> Layer(s)" option. Maya 2011 doesn't seem to document this very well either
> in "mel" or "Python". Does anyone have any advice?
>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to