Trying to understand how i can add the operator i made to a pie menu for me to use, when i run it nothing shows. Treat me like a noob at coding, thank you for your time
import bpy
from bpy.types import Menu, Operator
# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)
class hyperbevel(Operator):
bl_idname = 'Hyper.Bevel'
bl_label = 'HyperBevel'
def execute(self, context):
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_mode(use_extend=False,use_expand=False, type='EDGE')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.mark_sharp(clear=True)
bpy.ops.transform.edge_bevelweight(value=-1)
bpy.ops.object.editmode_toggle()
bpy.ops.object.transform_apply(scale=True)
bpy.ops.object.shade_smooth()
bpy.ops.object.modifier_remove(modifier="Bevel")
bpy.ops.object.modifier_add(type='BEVEL')
bpy.context.object.modifiers["Bevel"].limit_method = 'WEIGHT'
bpy.context.object.modifiers["Bevel"].segments = 3
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.mesh.edges_select_sharp()
bpy.ops.mesh.mark_sharp()
bpy.ops.transform.edge_bevelweight(value=1)
bpy.ops.object.editmode_toggle()
bpy.context.object.data.use_auto_smooth = True
bpy.context.object.modifiers["Bevel"].width = 0.02
bpy.context.object.modifiers["Bevel"].use_clamp_overlap = False
bpy.ops.object.modifier_move_up(modifier="Bevel")
return ('finished')
class VIEW3D_PIE_template(Menu):
# label is displayed at the center of the pie menu.
bl_label = "Operators"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# operator_enum will just spread all available options
# for the type enum of the operator on the pie
pie.operator("Hyper.Bevel", text = "Hyperbevel")
def register():
bpy.utils.register_class(VIEW3D_PIE_template)
def unregister():
bpy.utils.unregister_class(VIEW3D_PIE_template)
if __name__ == "__main__":
register()
bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")