Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- class SimpleOperator(bpy.types.Operator):
- """Tooltip"""
- bl_idname = "object.simple_operator"
- bl_label = "Simple Object Operator"
- bl_options = {'REGISTER','UNDO'}
- axis : bpy.props.EnumProperty (name="Axis", items=[('x','X',''),('y','Y',''),('z','Z','')], default="y")
- threshold : bpy.props.FloatProperty (name="Threshold", min=0, default=0)
- flip : bpy.props.BoolProperty (name="Flip", default = False)
- def draw(self, context):
- layout = self.layout
- layout.use_property_split = True
- column = layout.column()
- row = column.row()
- row.prop(self, "axis", expand=True)
- layout.prop(self, "threshold", text="Threshold")
- layout.prop(self, "flip", text="Flip")
- @classmethod
- def poll(cls, context):
- return context.active_object is not None
- def main(self, context):
- if self.axis == 'x':
- if self.flip == False:
- return 'POSITIVE_X'
- elif self.flip == True:
- return 'NEGATIVE_X'
- if self.axis == 'y':
- if self.flip == False:
- return 'POSITIVE_Y'
- elif self.flip == True:
- return 'NEGATIVE_Y'
- if self.axis == 'z':
- if self.flip == False:
- return 'POSITIVE_Z'
- elif self.flip == True:
- return 'NEGATIVE_Z'
- def execute(self, context):
- print (self.main(context))
- bpy.ops.mesh.symmetrize(threshold=self.threshold , direction=self.main(context))
- return {'FINISHED'}
- def register():
- bpy.utils.register_class(SimpleOperator)
- def unregister():
- bpy.utils.unregister_class(SimpleOperator)
- if __name__ == "__main__":
- register()
Advertisement
Add Comment
Please, Sign In to add comment