Just trying to work through basic tutorial for add-ons.
http://www.blender.org/documentation/blender_python_api_2_65_5/info_tutorial_addon.html
Tried to run code from both text editor and as an add-on
bl_info = {
"name": "Move X Axis",
"category": "Object",
}
import bpy
class ObjectMoveX(bpy.types.Operator):
"""My Object Moving Script""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "object.move_x" # unique identifier for buttons and menu items to reference.
bl_label = "Move X by One" # display name in the interface.
bl_options = {'REGISTER', 'UNDO'} # enable undo for the operator.
def execute(self, context): # execute() is called by blender when running the operator.
# The original script
scene = context.scene
for obj in scene.objects:
obj.location.x += 1.0
return {'FINISHED'} # this lets blender know the operator finished successfully.
def register():
bpy.utils.register_class(ObjectMoveX)
def unregister():
bpy.utils.unregister_class(ObjectMoveX)
# This allows you to run the script directly from blenders text editor
# to test the addon without having to install it.
if __name__ == "__main__":
register()
I get the error:
bpy.utils.register_class(ObjectMoveX)
AttributeError: 'module' object has no attribute 'register_class'
I’m running Blender 2.5. I must be missing something really basic.
Thanks for any help.