#---------------------------------------------------------- # add mirror modifier #---------------------------------------------------------- bl_info = { "name": "add mirror modifier", "author": "ishidourou", "version": (1, 0), "blender": (2, 65, 0), "location": "View3D > Object", "description": "Add Mirror Modifier", "warning": "", "wiki_url": "", "tracker_url": "", "category": "Object"} import bpy from math import * # # Menu in tools region # class ToolsPanel(bpy.types.Panel): bl_label = "Add Mirror Modifier" bl_space_type = "VIEW_3D" bl_region_type = "TOOLS" def draw(self, context): self.layout.operator("add.mirror") # # The AddMirrorModifier button prints a message in the console # class OBJECT_OT_AmmButton(bpy.types.Operator): bl_idname = "add.mirror" bl_label = "Add" bl_options = {'REGISTER'} def execute(self, context): obj = bpy.ops.object cobj = bpy.context.object mesh = cobj.data obj.mode_set(mode='EDIT') bpy.ops.mesh.select_all(action='DESELECT') obj.mode_set(mode='OBJECT') for vertex in mesh.vertices: if (vertex.co.x < -0.000001): vertex.select = True #obj.mode_set(mode='OBJECT') obj.mode_set(mode='EDIT') bpy.ops.mesh.delete(type='VERT') #obj.mode_set(mode='OBJECT') bpy.ops.object.modifier_add(type='MIRROR') print('finished!') return{'FINISHED'} # # Registration # All panels and operators must be registered with Blender; otherwise # they do not show up. The simplest way to register everything in the # file is with a call to bpy.utils.register_module(__name__). # def register(): bpy.utils.register_class(OBJECT_OT_AmmButton) bpy.utils.register_module(__name__) def unregister(): bpy.utils.unregister_class(OBJECT_OT_AmmButton) bpy.utils.unregister_module(__name__) if __name__ == "__main__": register()