edited

"Right-click on rotateX to Key Selected still produces a key, again 
regardless of their non-keyable state."

Yes, sorry, that is what I meant. The "s"  doesn't create the key, but 
right-click and key creates a key. That is what was bugging me.
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.

By the way, after running your code, since connectable was set to False, 
any new dag node you create will have the translateX not connectable. Is 
that a static variable and that's 
why it propagates through each new node that is created? we'll need to be 
careful to set back to True.

Interesting stuff...


El domingo, 25 de julio de 2021 a las 20:41:15 UTC+2, Marcus Ottosson 
escribió:

> 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?
>
>    1. Create cube 
>    2. Make translateY, translateZ and rotateX non-keyable 
>    3. Hit 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).
>
>    1. Shift + w still keys translateY and translateZ, regardless of their 
>    non-keyable state 
>    2. Right-click on rotateX to Key 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).
>
> On Wed, 21 Jul 2021 at 12:55, Rudi Hammad <rudih...@gmail.com> wrote:
>
>>
>> Hello,
>> to make an attribute not keyable you can do it with cmds or mplug or 
>> right click 'make not keyable'. What this does is grey out the channel box, 
>> so if you select the node and set a key typing 's', the attribute is not 
>> keyed. So far so good.
>>
>> Now, this is what I find annoying. Many times when animating you just 
>> select the channel box attributes (so not the node) and type 's'. In this 
>> case even if it set not to be keyable, it will add a key, so it is not 
>> really unkeyable. So is it possible to make it 100% unkeyable?
>>
>>
>> Side note: I find odd that the api uses the method MPlug.setKeyable() to 
>> hide and MPlug.setChannelBox() to make keyable. A bit confusing isn't it?
>>
>> R
>>
>> -- 
>> 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
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/b210fbff-2a8f-4c63-a914-da9eb7547d5cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/0e791617-80fb-4b8a-ad85-ed83e071ec50n%40googlegroups.com.

Reply via email to