I want to copy one driver to all selected objects at once, but the "copy to selected" function copies solely the current value of driver, and not the driver itself.
Is there a possibility to copy also the driver to all selected objects?
I'm going to say there is not yet a quick way to do it.
The closest I can come to accomplishing your mission is this python script (which you can put in a Text Editor panel and use the Run Script button on the right of the toolbar, which means you might need to widen the panel)
Select all your objects, and select the source object last (so it is the active object), then click Run Script.
import bpy import sys def copyDriver(src, tgt): if tgt.animation_data is None: tgt.animation_data_create() print(tgt) if False:# or isArrayPath(src.data_path): d2 = tgt.driver_add(src.data_path, src.array_index) else: d2 = tgt.driver_add(src.data_path) d2.driver.expression = src.driver.expression for v1 in src.driver.variables: copyVariable(v1, d2.driver) def copyVariable(src, tgt): v2 = tgt.variables.new() v2.type = src.type v2.name = src.name try: v2.targets.data_path = src.targets.data_path v2.targets.id_type = src.targets.id_type v2.targets.id = src.targets.id except: print("dang, %s %s"%(src.targets.id, sys.exc_info()) ) def isArrayPath(path): return path == 'location' or path == "dimensions" or path == "rotation" print ( isArrayPath("location") ) print ( isArrayPath("text_box.x") ) scn = bpy.context.scene src = bpy.context.active_object for obj in scn.objects: if (obj==src): continue if obj.select: print("object") if not src.animation_data is None: for dr in src.animation_data.drivers: copyDriver(dr, obj) print("data") if not src.data.animation_data is None: for dr in src.data.animation_data.drivers: copyDriver(dr, obj.data)
I have tested this only partially. I did not even attempt to copy modifiers. I'm sure there are some other driver doodads I'm not properly copying.
Anyway, I expect if someone can find a reliable API function to replace my copyDriver() kludge, your life will get a lot easier.
In the mean time, feel free to point out shortcomings and I'll see if I can kludge a way around it.
The super simple solution is in the menu Object -> Make Links -> Animation data. This also copies all animation but for me it proved to be invaluable since manually copy-pasting drives can be tedious when there are dozens of those objects. Like with any data copying in Blender, it copies from active object to all selected objects.