4
$\begingroup$

Is there a way to test if an object in Blender has shape-keys or not?

$\endgroup$

1 Answer 1

5
$\begingroup$

Access shape key data via the object.data.shape_keys object, and the actual shape key blocks through object.data.shape_keys.key_blocks collection:

import bpy
# Reference active object
o = bpy.context.object

# Check if object has any shape keys at all (will be None if not)
if o.data.shape_keys:
    num_of_SK_blocks = len( o.data.shape_keys.key_blocks )
    print( "Number of shape keys: ", num_of_SK_blocks )
$\endgroup$
0

You must log in to answer this question.

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