KeyBlock-->Driver relation

Hi yet once again :);

I have a list of shapes on my object, say, 2 of them driven by drivers (yes, I know… The saga continues :slight_smile: ) I can get how many drivers there are through:

drivers =['Key'].animation_data.drivers

But, my problem is that I couldn’t find a way to correlate between these indexed drivers and their respective shape keys… How can I detect through code, which shape key is driven by a driver?

My sincerest thanx for putting up with all sorts of my noob problems, but I’m picking up fast, thanx to the help of many pros on this forum.



Aarrghhh!!! Giving up… :frowning: Tried many things, like “” or find(), to no avail… Any help would wildly be appreciated (iingh)…

You can use the data_path property of an fcurve to do a backwards look up.

fcurves =['Key'].animation_data.drivers
for f in fcurves:

>>key_blocks["Key 1"].value

drivers =['Key'].animation_data.drivers
drivers[0].data_path #returns a string of the data path

Atom, thank you so very much for your help. It’s always quite frustrating at the beginning of everything when it’s really difficult to really know where to refer to. But I believe I’m getting there in Blender, step by step.

Cheers man;


My noobness kicks in once more, right there… :frowning: I really don’t know of a way to get to the name of the property of the value that’s returned here. How do you do it? Like, how does one get to “Key 1” as a string from the “key_blocks[“Key 1”].value” that’s been returned by the script?

string splitting should do the trick:

s = 'key_blocks["Key 1"].value'
s.split('"')[1] # "Key 1"

Arghh… This one’s all about Pyhton itself. But no fear, working on that relentlessly Thanx CodemanX.