Yes, the jargon here is terrible. Likely for legacy reasons. (Although I can’t think of which ones exactly? I remember this being fuzzy way back in Maya 4.0)
But, it isn’t true that the s
hotkey puts a key on non-keyable attributes, can you confirm?
s
You should find all attributes in the channel box have a key, except for those three.
But, as far as I know, only the s
key respects this attribute. And the s
key is mostly a wasted keyboard shortcut. (How often do you intend on keying every single keyable attribute?) More usable means disregards the non-keyable state (perhaps for the better).
Shift + w
still keys translateY and translateZ, regardless of their non-keyable stateKey Selected
still produces a key, again regardless of their non-keyable state.Some tools do respect the non-keyable state, like Edit -> Bake Simulation
and creating a new animation layer.
So, unlike the locked state the non-keyable state is more of a hint. Some metadata that tools may choose whether or not to respect, with a slight hint in the channel box for the animator that the attribute isn’t intended to be keyed. With that in mind, one way of making a channel 100% unkeyable is by making it locked, although that typically isn’t a practical use for the locked state. Another is by making it un-connectable, since a keyed channel is merely one that is connected to a keyframe node, like animCurveTL
.
I wasn’t able to find a way of doing this via cmds, maybe someone else knows?
from maya.api import OpenMaya as om
cmds.file(new=True, force=True)
cube, _ = cmds.polyCube()
sl = om.MSelectionList()
sl.add(cube)
mobj = sl.getDependNode(0)
fn = om.MFnDependencyNode(mobj)
plug = fn.findPlug("translateX", False)
plug.name()
fna = om.MFnAttribute(plug.attribute())
fna.connectable = False
cmds.setKeyframe(v=10, at="translateX") # Fail!
The API does sometime allow metadata like this to be edited without actually being able to save it with the scene (e.g. MFnAttribute.setNiceNameOverride
), especially not for native plugs like this one. But this does appear to save and load fine. This would make an attribute truly non-keyable, whilst still allowing it to be edited (unlike a locked attribute).
--
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/b210fbff-2a8f-4c63-a914-da9eb7547d5cn%40googlegroups.com.
The solution whould be set connectable to False, but the problem is that if you close maya and open a new session it reverts it to keyable, so it doesn’t really save if you close your session.
Ah that’s a bummer. Now that I think of it, that’s what happens to setNiceNameOverride
too, even when editing your own custom attributes. Quite misleading. I expect those properties are solely meant for creating new attributes rather than editing existing ones. The translate attributes are probably special since they are native and not plug-in based, but the closest similarity might be to extension attributes. Which I understand as a kind of “instanced” attribute.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0e791617-80fb-4b8a-ad85-ed83e071ec50n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBtvHC1eV3L6JqvcgzwzYHDTwjbjKt13dfb-Uxk8gpnFg%40mail.gmail.com.
It would be fickle, because what does “keyable” mean?
In Maya, an attribute of one node can connect to an attribute of another node. Sometimes, that other node is a animCurveTL
which we then perceive as being “keyed”. But there’s nothing differentiating the animCurveTL.output
attribute from a someTransform.translateX
attribute. So, it would have to be completely unconnectable. But that means it also cannot be simply driven by another attribute, like an animation control. It would be very limiting.
What maybe could happen though, is for that right-click menu and Shift + w to respect the non-keyable state. And that may be doable. Ideally by Autodesk, but even by us as both of those are (probably?) MEL commands that can be overridden post-launch. Anyone care to take a crack at it?
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAASZO1fhbLHYRmitYdDNN-J_s1Z6ObbEux%3D-%2B4znE9rMqJedjA%40mail.gmail.com.