Skip to content

Instantly share code, notes, and snippets.

@TurBoss
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TurBoss/a08962ed9a44ca78ee9f to your computer and use it in GitHub Desktop.
Save TurBoss/a08962ed9a44ca78ee9f to your computer and use it in GitHub Desktop.
blender addon to change euler coordinate system to match springrts
bl_info = {
"name": "Euler Changer",
"category": "Object",
}
import bpy
class ObjectEuler(bpy.types.Operator):
"""Changes the Euler coordinate mode""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "object.change_euler" # unique identifier for buttons and menu items to reference.
bl_label = "Change Euler to ZXY" # 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.rotation_mode="ZXY" # Set euler to all stored pieces
return {'FINISHED'} # this lets blender know the operator finished successfully.
def register():
bpy.utils.register_class(ObjectEuler)
bpy.types.VIEW3D_MT_object.append(menu_func)
def unregister():
bpy.utils.unregister_class(ObjectEuler)
bpy.types.VIEW3D_MT_object.remove(menu_func)
def menu_func(self, context):
self.layout.operator(ObjectEuler.bl_idname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment