In the Python API Reference, Under the Key Module, there’s a function Get(Name=None)…
Under the function it says that it retrieves the name of a Key Object, which is assigned to an object - Mesh… bah, see for yourself. Here.
Question - how do I find & name the Key object mentioned there?
Thanks in advance.
p.s. I’ve already asked this in the Animation forum, they told me to ask here.
Look at the last post!!
Under the function it says that it retrieves the name of a Key Object…
Actually it says:
Get the named Key object from Blender…
If you know the name of a key object (for example if you just created one with a name of your choice) you can retrieve that key object from Blender by calling ‘Get([name])’. If don’t know the name of a key object (and therefore you can’t specify a name) you’ll get a list of all existing key objects. Now you can loop over all keys and extract a specific one by whatever criteria you need.
Hope that helps
Ah - good point.
You’re right - i guess you can’t create a named key with the current api functionality.
I havn’t used shape keys for some time now. It seems you can name a shape key in the mesh buttons -> shapes panel (but not in the transform properties of the sliders in the action editor - changes here are not accepted). But still then - you successfully renamed a shape key in the shapes panel - the keys returned from Key.Get() are still named “Key, Key.001, Key.002, …”
There’s room for improvement here…
Well, it better be fixed in 2.5x. Thanks.
How Do I create keyframes via Python? For example, I have a cube and a script would record all its movements into an action. When I press Space, the recording stops. When I press Enter, the recorded action starts playing.
The example itself is not important, I just want to know how to create actions and keyframes in-game.
Thanks in advance!!