1
$\begingroup$

How can I call up this name (Key.001) in python? Every object has it's own one Key name (Key, Key.001, Key.002, Key.003...)

Blender File

Here it is in the in the console. in order to show it up I had to drag the value slider of the shape key:

Python console

So what I'm asking for is what is the name of the variable that puts the "Key.001" there.

$\endgroup$
2
  • $\begingroup$ Hello and welcome. Glad you figured it out on your own. Answering your own questions is totally encouraged and even helpful for future users, but please do so in the answer section bellow. Could you edit your question and transfer the answer part to an actual answer? $\endgroup$ Jun 23, 2019 at 19:12
  • $\begingroup$ @DuarteFarrajotaRamos Thanks for the reminder :) $\endgroup$
    – koko ze
    Jun 23, 2019 at 19:16

1 Answer 1

1
$\begingroup$

I figured it out. I also added the basis name, shape key name and shape key index:

import bpy
 
#Defines the selected shape key index.
selected_shape_key_index = bpy.context.object.active_shape_key_index
print("The selected shape key index is",selected_shape_key_index)
    
#Defines the selected shape key name.
selected_shape_key_name = bpy.context.object.active_shape_key.name
print("The selected shape key name is",selected_shape_key_name)
    
#Defines the selected shape key collection.
selected_shape_key_collection = bpy.context.object.active_shape_key.id_data.name
print("The selected shape key collection is called",selected_shape_key_collection)

#Defines the Basis name
basis_name = bpy.data.shape_keys[selected_shape_key_collection].key_blocks[0].name
print("The basis name is",basis_name)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .