I am using scripted driver to changes image texture.
import bpy
def change_image_baby( val,min,max):
if (min <= val <= max):
filePath = "//baby_eyes\\eye_0%d.png" % val
bpy.data.images["Minu Child eyes.001"].filepath = filePath
return val
bpy.app.driver_namespace['change_image_baby'] = change_image_baby
On bone Movement by using above function as driver I am able to change the images.
Now i want to use same driver function on many other characters.
So I defined "filePath" and "image" name as object property of each character
New driver function
import bpy
def change_image(n,min,max,img,file):
val = int(n*10)
# img is image to be replaced and "file" is the file path
return val
if (min <= val <= max):
filePath = file % val # as all my images are in sequence i replacing numbers see above code
bpy.data.images[img].filepath = filePath
bpy.app.driver_namespace['change_image'] = change_image
and use in driver UI to parse it to custom driver
I am not able to parse string it has to be either int or float. What is the workaround to parse string as Driver Variable?