I'm currently trying to modify some drivers so that they are disabled when they're not on a proxied armature. Right now, I'm using the following script to set a custom property, which is used by the drivers:
import bpy from bpy import context class UseHeight(bpy.types.PropertyGroup): @classmethod def register(cls): ob = context.object if("UseHeight" in ob.keys()): ob["UseHeight"] = (ob.proxy != None) def register(): bpy.utils.register_class(UseHeight) def unregister(): bpy.utils.unregister_class(UseHeight) if __name__ == "__main__": register()
However, I have to put this into every script I use, and with how my memory has been impacted by my health problems, I don't want to add yet another thing for me to keep track of. I've attempted to use it as an addon, but it fails to work due to this error:
Exception in module register(): '/home/zauber/.config/blender/2.69/scripts/addons/MaelstromUseHeight.py' Traceback (most recent call last): File "/home/zauber/Desktop/blender-2.69-linux-glibc211-x86_64/2.69/scripts/modules/addon_utils.py", line 311, in enable mod.register() File "/home/zauber/.config/blender/2.69/scripts/addons/MaelstromUseHeight.py", line 12, in register bpy.utils.register_class(UseHeight) File "/home/zauber/.config/blender/2.69/scripts/addons/MaelstromUseHeight.py", line 7, in register ob = context.object AttributeError: '_RestrictContext' object has no attribute 'object'
So, what do I need to do to get this working? Or is there a way I can directly check if the object's proxy value is equal to "None" inside the drivers?