Hi,
I’m trying to transfer an object (it’s clothes) from an initial armature to a new one (both armature are identical, same bones). After doing that the object doesn’t follow the new armature properly (but all the weights are similar), it’s because of the drivers in the shape keys, they’re still attached to the initial armature. My problem is to point them to the new one.
Is there a way to change all the drivers Object ID, instead of doing it 1 by 1 ?
I think the picture will make my question clear
Thanks a lot !
You can do this in the Python console pretty quickly. Select the object and try this code:
for d in bpy.context.object.data.shape_keys.animation_data.drivers:
d.driver.variables[0].targets[0].id = D.objects['NEW NAME HERE']
That should get most of them
Hi Rocketman,
thank you so much, you saved my time !
Works great
Honestly I’m amazed that actually worked.
After few tries it worked without modifying your code at all, just replacing the name of the armature of course
Hello! Thank you. I cant get it to work do… Im new to Python. Can you please write an example how you modifyied the code so maybe I can understand. Thank you
Had the exact same task as the OP, unfortunately the code posted above didn’t help, and I don’t know enough about Python to edit it properly for it to work.
However, I did find this excellent addon: [Addon] replace driver targets - #13 by buzzkirill
which solved the problem very handily
Hi, sorry, i’m not familiar with scripting at all. Can you please explain step by step what do i need to do with that code to get it working?
Just install the addon from the link I attached and go from there. It may not work depending on your Blender version
That link to addon is no longer works, or you mean the script posted by Tokamak ? If yes then you mean that somehow i need to convert that script into blender .ry file or what?
Yes, the one posted by Tokamak. I just tested it and it works in 4.0. So all you need to do is just copy & paste his code into Notepad, then save it as a .py file (in the save dialog, just type 123.py or ReplaceDriverTargets.py). Then in Blender you’ll be able to select it in the install Addons menu. If it doesn’t show up immediately afterwards, search for the name.
It works! Thank you so much for the replies, really appreciate the help!
