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


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 )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.