Maya Script: Select all object with keyframes
Click on the top node of your rig, then hit that tool, and it selects all controllers (or whatever) that have keyframes on them- below this top node.
If nothing is selected. It will select all the objects with keyframes.
>> So it’s a quick «select all» if you don’t have a body picker and that way it let’s you move all the keyframes in your scene.
Thank you Jean-Denis Haas for the script idea.
Donate if you find it useful.
Select objects based on hierarchy
-
Click the Select by hierarchy and combinations icon in the Status Line (toolbar).
To set the selection mask to only select only nodes without children (leaves)
-
Click the Select by hierarchy and combinations icon in the Status Line (toolbar).
To select all nodes under the selected node
- Select Edit > Select Hierarchy .
Related topics
- Select objects or components
- Edit > Select All
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Selection script for maya
I’m noob in script but good in animation, I need some help to create a script selection. I found an exemple :
import maya.cmds as cmds # Get selected objects curSel = maya.cmds.ls(sl=True) # Or, you can also specify a type in the listRelatives command nurbsNodes = maya.cmds.listRelatives(curSel, allDescendents=True, noIntermediate=True, fullPath=True, type="nurbsCurve", path=True) cmds.select(nurbsNodes)
But It doesn’t select all the character’s controlers. I would like If I select a character controler curve or locator and I run the script, the result is all controls who can be keyed should be selected. Without the referenced character name. Thanks a lot for the one who can help
Couple more Maya questions.
1. Selecting a parent highlights all children
How can I make it so that when I select a Joint (or any other object with children, for that matter), Maya doesn’t shade all the child objects in bright green and display the wireframe, even though they’re not selected?
Basically I want Maya to only highlight/wireframe my CURRENTLY SELECTED OBJECT, not its whole heirarchy too. It keeps making me think I have a bunch of objects selected even though I only have one.
It’s also pretty annoying if you have a lot of small objects parented to one large object (say, a bunch of rivet meshes parented to a crate mesh). if you select the crate mesh and hit Smooth to subdivide it, instead of subdividing the selected object, it subdivides the LAST CHILD. What the hell. This is annoying and useless. I had to un-parent all my child objects, do a Smooth operation on the parent, then re-link all the child objects again.
I’ve looked through all the preferences and cannot find anything that seems like it’d turn off this «feature».
2. Auto Key doesn’t work unless you set at least one key manually
How to make «Auto Key» work properly? In Max when I turn on «Auto Key», it will actually keyframe anything using frame 0 as a base if no keys already exist. In Maya it seems that I actually have to manually set keys at frame 0 on anything I want to Auto Key, otherwise it just doesn’t key anything.
So basically, using Auto Key on an object with no existing keyframes, will make no keyframes at any time, unless you manually set a key first.
3. .mayaSwatches folders popping up everywhere
I asked it before and people said it wasn’t possible, but I’m still trying to find a way to stop Maya creating «.mayaSwatches» folders every bloody where. You can stop it creating material previews, but it still makes the folder. It’s not exactly a showstopper, but it is annoying, and unnecessary.
Seems like no way to turn it off. Maybe someone knows a way?
Replies
1. Create an empty group, then put all your objects into it. Now you can select, and nothing in the hierarchy is selected at the same time, unless you open outliner and select the group you made. This won’t work for joint hierarchies.
2. No current way around that just yet.
‘Auto Key automatically sets keys on attributes when you change the current time and attribute value. A key must already exist for an attribute before you use Auto Key. ‘
3. Did you try the ‘export all’ route (I know — convoluted) rather than save ?
ivars polycounter lvl 15
1. I think Maya always displays the child objects like that.
When selecting an object you can tap the down key. That will select the shape-node instead of the transform-node, so any operation will only affect that object. Joints doesn’t have shape nodes though.
2. Don’t think there’s a way around that. I actually like it that way. Otherwise vertecies and objects might get keyframed while modelling if not on frame 0. Not that hard to just tap s to set a key before animating.
3. Asked a Maya support guy, and he didn’t know either 😛 And I agree it’s very annoying.
thomasp hero character
can you maybe somehow set the folders to invisible in explorer? never tried but perhaps there’s a way to define a rule somewhere? filenames with a leading «.» are by default invisible in a unix environment and that’s where maya came from originally.
(1.) Pressing the down key, never came across that before, thanks for the tip.
Actually, ivars, just booted up Maya and tested that, it will leave you with a singular selected object based on it’s shape node, so a smooth function can be applied, but as you move into edits or translations, your back into hierarchy selection mode. I think best bets are empty groups, and every object as a child of the empty group that is required.
ivars polycounter lvl 15
SUNCHIRP : If you use the F9-F12 keys rather than right-klick to go in to component mode, it will still only highlight the selected object. All poly tools and actions should be usable without it selecting the child-nodes. When moving objects you have to select the transform nodes, so the hierarchy will be highlighted. If you want to move a parent without affecting it’s child objects there’s a check box called «preserve child position» in the tool settings for the move tool.
SUNCHIRP : If you use the F9-F12 keys rather than right-klick to go in to component mode, it will still only highlight the selected object. All poly tools and actions should be usable without it selecting the child-nodes. When moving objects you have to select the transform nodes, so the hierarchy will be highlighted. If you want to move a parent without affecting it’s child objects there’s a check box called «preserve child position» in the tool settings for the move tool.
Yeah, good call. Was just messing around with the same stuff here. Breaks workflow though a little for me, I suppose it’s down to individual requirements.
MoP polycounter lvl 18
Nice tips guys. I should probably set a different hotkey for Set Key, currently I use «s» as a toggle for showing the «high quality display» (smoothing) on and off.
Still wish Maya wouldn’t highlight the children though, it’s kinda confusing, makes me think more stuff is selected, or sometimes appears like the many objects are just one object. I will try the «empty group» method.
I’m still not impressed that the F9-F12 hotkeys and the right-click «vertex/edge/face/uv» menus don’t actually work the same way!
managed to put something together for your other problem.
After faffing about with a convoluted way of getting rid of the .mayaSwatches folder, I eventually hit the nail on the head with the following bit of code : —
system("rmdir /s /q .mayaSwatches" );
so, as a mel you can create : —
file -save; system("rmdir /s /q .mayaSwatches" );
and save this to your shelf and execute,
or add that first line as an additional line of code to your save hotkey via the editor.
The system commands calls the dos function to remove the directory (it is always in the current directory), it does not prompt for yes or no answers on the directory deletion, so it shouldn’t affect workflow at all.
tested this in various directories and locations, and seems to work so far, not tested across a network, but I’m sure it will be fine.
Hope this helps, it’s been a bane to me too this one, nice to have finally found a way to get rid of the folders.
Apologies, you can’t edit the default Save hotkey, to get round this, go under File, then SaveScene and then remove the current hotkey, now create a new command, I called mine Save, add your instructions and accept, then assign it to your normal save hotkeys, i.e. CTRL + s, that should do it.
MoP polycounter lvl 18
Nice one, thanks!
MoP polycounter lvl 18
Another few questions, this time related to Smooth Bind skinning:
1. Smooth Bind weight gradient shading is not useful
In Max, when you rig stuff, you get a nice gradient of red (fully weighted to current joint) down to blue (very low weight on current joint) and then verts which aren’t weighted to the selected joint are not coloured, so it’s very easy to tell at a glance if any verts have bad weighting.
In Maya, the default shading is black to white, and it completely overrides the texture (Max’s blends on top of the texture, and shows the verts as coloured points). This means I can’t see how the texture is warping/stretching in various poses without toggling «Color feedback» on and off.
Is there any way to make Maya’s weight shading «semitransparent» over the texture, and any way to make the vertices highlighted with the appropriate colour, instead of this black-to-white stuff?
2. Component editor hides useful columns for joints in Smooth Skins tab
This is also annoying — say I have a Smooth Bind which contains 5 joints in the Influence list, and I have vertex which is weighted onto 2 of these joints, and I use the Component Editor to set the weight to «1.0» on one of these joints.
Since «hide zero columns» is turned on in the Component Editor, the other joint’s column immediately disappears since it has 0 weight. However I still want it around in case I need to set the weight back to 0.25 on that joint or something.
If I turn off «hide zero columns», then it shows ALL JOINTS in the scene, which is useless, since there are only 5 i’m interested in.
Is there any way to get the Component Editor to only show the joints listed in the current bind cluster’s «Influence» list, even if their value is zero? This would save a ton of time and hassle.
3. Any way to get the gradients for smooth bind showing, without being in the Paint Weights tool?
Basically I want to see the Smooth Bind gradients for various influence joints, without having to use the Paint Weights tool. I want to be able to select verts while still seeing the gradient and still having access to the influence list, but I haven’t found a way to do this yet. Maybe I’m looking in the wrong places?
Hmm.
I’m thinking I’ll write a skin weighting tool more like Max’s, since the gradient shading mode is quite poor (and «Multi-color feedback» is even worse), and the Component Editor is so picky about which columns it shows, it’s really hard to get it to list only useful joints.
Again, any help would be appreciated, since I really don’t want to have to write my own script, but Highend3d doesn’t seem to have any Maya scripts which meet my needs (I found one which contains a good vert-weighting feature, but it’s a big bloaty tool which I don’t want to use — I will probably just use their vert weighting thing in my own custom floating window for skinning).