how can i add a driver for a shapekey via python?




The Problem is that it can't find the shape key and shape keys are getting their driver with a different method; so I'm a bit confused how it can be added by python correctly. Sorry I'm new to Python. Thanks for your help!

import bpy

obj = bpy.context.active_object
driver = obj.data.shape_keys.key_blocks['Key 1'].driver_add("value")
  • 1
    $\begingroup$ Docs say driver_add() returns a FCurve object, so you don't have the driver yet: driver = obj.data.shape_keys.key_blocks['Key 1'].driver_add("value").driver (docs.blender.org/api/2.79/…) $\endgroup$ – R. Navega Mar 14 '18 at 8:18

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.