Rework: Proportional Editing Pie #3

Merged
Demeter Dzadik merged 2 commits from demeters_branch into main 2024-08-21 02:30:19 +02:00
Showing only changes of commit 7340c9c347 - Show all commits

View File

@ -27,100 +27,75 @@ class PIE_OT_set_proportional_falloff(Operator):
return {'FINISHED'}
class PIE_MT_proportional_edit_obj(Menu):
bl_idname = "PIE_MT_proportional_obj"
bl_label = "Proportional Editing Pie"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("object.set_proportional_falloff", text="Smooth", icon='SMOOTHCURVE').falloff_shape='SMOOTH'
# 6 - RIGHT
pie.operator("object.set_proportional_falloff", text="Sphere", icon='SPHERECURVE').falloff_shape='SPHERE'
# 2 - BOTTOM
pie.operator("object.set_proportional_falloff", text="Linear", icon='LINCURVE').falloff_shape='LINEAR'
# 8 - TOP
pie.prop(
context.tool_settings,
"use_proportional_edit_objects",
text="Proportional On/Off",
)
# 7 - TOP - LEFT
pie.operator("object.set_proportional_falloff", text="Root", icon='ROOTCURVE').falloff_shape='ROOT'
# 9 - TOP - RIGHT
pie.operator(
"object.set_proportional_falloff",
text="Inverse Square",
icon='INVERSESQUARECURVE',
).falloff_shape='INVERSE_SQUARE'
# 1 - BOTTOM - LEFT
pie.operator("object.set_proportional_falloff", text="Sharp", icon='SHARPCURVE').falloff_shape='SHARP'
# 3 - BOTTOM - RIGHT
pie.menu("PIE_MT_proportional_moreob", text="More...", icon='THREE_DOTS')
class PIE_MT_proportional_edit_mesh(Menu):
bl_idname = "PIE_MT_proportional_edt"
class PIE_MT_proportional_edit(Menu):
bl_idname = "PIE_MT_proportional_edit"
bl_label = "Proportional Editing Pie"
def draw(self, context):
ts = context.tool_settings
layout = self.layout
pie = layout.menu_pie()
# 4 - LEFT
pie.operator("object.set_proportional_falloff", text="Smooth", icon='SMOOTHCURVE').falloff_shape='SMOOTH'
# 6 - RIGHT
pie.operator("object.set_proportional_falloff", text="Sphere", icon='SPHERECURVE').falloff_shape='SPHERE'
if context.mode == 'OBJECT':
pie.menu("PIE_MT_proportional_edit_obj_more", text="More...", icon='THREE_DOTS')
else:
pie.menu("PIE_MT_proportional_edit_mesh_more", text="More...", icon='THREE_DOTS')
# 2 - BOTTOM
pie.operator(
"object.set_proportional_falloff",
text="Inverse Square",
icon='INVERSESQUARECURVE',
).falloff_shape='INVERSE_SQUARE'
# 8 - TOP
pie.prop(ts, "use_proportional_edit", text="Toggle Proportional", icon='PROP_ON')
# 7 - TOP - LEFT
pie.prop(ts, "use_proportional_connected", text="Toggle Connected", icon='PROP_CON')
# 9 - TOP - RIGHT
pie.prop(ts, "use_proportional_projected", text="Toggle Projected", icon='PROP_PROJECTED')
pie.operator("object.set_proportional_falloff", text="Sharp", icon='SHARPCURVE').falloff_shape='SHARP'
if context.mode == 'OBJECT':
# 8 - TOP
pie.prop(ts, "use_proportional_edit_objects", text="Toggle Proportional")
# 7 - TOP - LEFT
pie.operator("object.set_proportional_falloff", text="Root", icon='ROOTCURVE').falloff_shape='ROOT'
# 9 - TOP - RIGHT
pie.operator("object.set_proportional_falloff", text="Inverse Square", icon='INVERSESQUARECURVE').falloff_shape='INVERSE_SQUARE'
else:
# 8 - TOP
pie.prop(ts, "use_proportional_edit", text="Toggle Proportional", icon='PROP_ON')
# 7 - TOP - LEFT
pie.prop(ts, "use_proportional_connected", text="Toggle Connected", icon='PROP_CON')
# 9 - TOP - RIGHT
pie.prop(ts, "use_proportional_projected", text="Toggle Projected", icon='PROP_PROJECTED')
# 1 - BOTTOM - LEFT
pie.operator("object.set_proportional_falloff", text="Root", icon='ROOTCURVE').falloff_shape='ROOT'
pie.operator("object.set_proportional_falloff", text="Linear", icon='LINCURVE').falloff_shape='LINEAR'
# 3 - BOTTOM - RIGHT
pie.menu("PIE_MT_proportional_more", text="More...", icon='THREE_DOTS')
pie.operator("object.set_proportional_falloff", text="Sphere", icon='SPHERECURVE').falloff_shape='SPHERE'
class PIE_MT_proportional_edit_mesh_more(Menu):
bl_idname = "PIE_MT_proportional_more"
bl_idname = "PIE_MT_proportional_edit_mesh_more"
bl_label = "More Falloff Shapes"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
box = pie.split().column()
box.operator("object.set_proportional_falloff", text="Sharp", icon='SHARPCURVE').falloff_shape='SHARP'
box.operator("object.set_proportional_falloff", text="Linear", icon='LINCURVE').falloff_shape='LINEAR'
box.operator("object.set_proportional_falloff", text="Constant", icon='NOCURVE').falloff_shape='CONSTANT'
box.operator("object.set_proportional_falloff", text="Random", icon='RNDCURVE').falloff_shape='RANDOM'
layout.operator("object.set_proportional_falloff", text="Root", icon='ROOTCURVE').falloff_shape='ROOT'
layout.operator("object.set_proportional_falloff", text="Inverse Square", icon='INVERSESQUARECURVE').falloff_shape='INVERSE_SQUARE'
layout.operator("object.set_proportional_falloff", text="Constant", icon='NOCURVE').falloff_shape='CONSTANT'
layout.operator("object.set_proportional_falloff", text="Random", icon='RNDCURVE').falloff_shape='RANDOM'
class PIE_MT_proportional_edit_obj_more(Menu):
bl_idname = "PIE_MT_proportional_moreob"
bl_label = "Proportional Falloffs"
bl_idname = "PIE_MT_proportional_edit_obj_more"
bl_label = "More Falloff Shapes"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
box = pie.split().column()
box.operator("object.set_proportional_falloff", text="Constant", icon='NOCURVE').falloff_shape='CONSTANT'
box.operator("object.set_proportional_falloff", text="Random", icon='RNDCURVE').falloff_shape='RANDOM'
layout.operator("object.set_proportional_falloff", text="Constant", icon='NOCURVE').falloff_shape='CONSTANT'
layout.operator("object.set_proportional_falloff", text="Random", icon='RNDCURVE').falloff_shape='RANDOM'
registry = (
PIE_OT_set_proportional_falloff,
PIE_MT_proportional_edit_obj,
PIE_MT_proportional_edit_mesh,
PIE_MT_proportional_edit,
PIE_MT_proportional_edit_mesh_more,
PIE_MT_proportional_edit_obj_more,
)
@ -129,13 +104,13 @@ registry = (
def register():
register_hotkey(
'wm.call_menu_pie',
op_kwargs={'name': 'PIE_MT_proportional_obj'},
hotkey_kwargs={'type': "O", 'value': "PRESS", 'shift': True},
op_kwargs={'name': 'PIE_MT_proportional_edit'},
hotkey_kwargs={'type': "O", 'value': "PRESS"},
key_cat="Object Mode",
)
register_hotkey(
'wm.call_menu_pie',
op_kwargs={'name': 'PIE_MT_proportional_edt'},
hotkey_kwargs={'type': "O", 'value': "PRESS", 'shift': True},
op_kwargs={'name': 'PIE_MT_proportional_edit'},
hotkey_kwargs={'type': "O", 'value': "PRESS"},
key_cat="Mesh",
)