I seem to have a bit of a problem that I was wondering if someone could help me with. As the title says, for some reason I keep getting an error when I try to add my script to the driver, and I can’t seem to figure out why at all. Here is the screenshot of how I’m applying it to the driver:
and here is the code:
import bpy
import math
def ShiftMoonMonth(objectName):
obj = bpy.data.objects[objectName]
sourceRotation = obj.rotation_euler.z
finalRotation = (math.floor(sourceRotation/389.10)*29.10564039280042)
return finalRotation
bpy.app.driver_namespace['ShiftMoonMonth'] = ShiftMoonMonth
I have auto-run python scripts turned on, and when I look through the available namespaces in the blender console, ShiftMoonMonth is one of the options I can use. So I’m pretty sure that the code is linked to the driver, but for some reason it’s still giving this error.
The place I got the code template from was this tutorial here: https://youtu.be/rfEFU0Mdq3Q?t=21m50s at 21:50, where he is trying to solve a very similar problem to what I’m solving. As far as I can tell, it seems to be the same as what I have, although it is quite old, so there may be something else you have to do. I also don’t understand the language, so I may have missed something.
Anyway, any help would be very appreciated!