Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy_types.py9
-rw-r--r--release/scripts/startup/bl_operators/wm.py28
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py10
-rw-r--r--release/scripts/templates_py/ui_pie_menu.py32
4 files changed, 78 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index d2683471915..bc2e9368b71 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -140,6 +140,15 @@ class WindowManager(bpy_types.ID):
finally:
self.pupmenu_end__internal(popup)
+ def popup_menu_pie(self, event, draw_func, title="", icon='NONE'):
+ import bpy
+ pie = self.piemenu_begin__internal(title, icon, event)
+
+ try:
+ draw_func(pie, bpy.context)
+ finally:
+ self.piemenu_end__internal(pie)
+
class _GenericBone:
"""
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 4281c908afd..15e482a5e63 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -527,7 +527,33 @@ class WM_OT_context_menu_enum(Operator):
context.window_manager.popup_menu(draw_func=draw_cb, title=prop.name, icon=prop.icon)
- return {'PASS_THROUGH'}
+ return {'FINISHED'}
+
+
+class WM_OT_context_pie_enum(Operator):
+ bl_idname = "wm.context_pie_enum"
+ bl_label = "Context Enum Pie"
+ bl_options = {'UNDO', 'INTERNAL'}
+ data_path = rna_path_prop
+
+ def invoke(self, context, event):
+ data_path = self.data_path
+ value = context_path_validate(context, data_path)
+
+ if value is Ellipsis:
+ return {'PASS_THROUGH'}
+
+ base_path, prop_string = data_path.rsplit(".", 1)
+ value_base = context_path_validate(context, base_path)
+ prop = value_base.bl_rna.properties[prop_string]
+
+ def draw_cb(self, context):
+ layout = self.layout
+ layout.prop(value_base, prop_string, expand=True)
+
+ context.window_manager.popup_menu_pie(draw_func=draw_cb, title=prop.name, icon=prop.icon, event=event)
+
+ return {'FINISHED'}
class WM_OT_context_set_id(Operator):
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index b325e8c9759..999e41e17f7 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -217,6 +217,13 @@ class USERPREF_PT_interface(Panel):
sub.prop(view, "open_sublevel_delay", text="Sub Level")
col.separator()
+ col.label(text="Pie Menus:")
+ sub = col.column(align=True)
+ sub.prop(view, "pie_animation_timeout")
+ sub.prop(view, "pie_initial_timeout")
+ sub.prop(view, "pie_menu_radius")
+ sub.prop(view, "pie_menu_threshold")
+ col.separator()
col.separator()
col.separator()
@@ -681,6 +688,9 @@ class USERPREF_PT_theme(Panel):
col.label(text="Menu:")
self._theme_widget_style(col, ui.wcol_menu)
+ col.label(text="Pie Menu:")
+ self._theme_widget_style(col, ui.wcol_pie_menu)
+
col.label(text="Pulldown:")
self._theme_widget_style(col, ui.wcol_pulldown)
diff --git a/release/scripts/templates_py/ui_pie_menu.py b/release/scripts/templates_py/ui_pie_menu.py
new file mode 100644
index 00000000000..87500b682d6
--- /dev/null
+++ b/release/scripts/templates_py/ui_pie_menu.py
@@ -0,0 +1,32 @@
+import bpy
+from bpy.types import Menu
+
+# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)
+
+
+class VIEW3D_PIE_template(Menu):
+ # label is displayed at the center of the pie menu.
+ bl_label = "Select Mode"
+
+ 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_enum("mesh.select_mode", "type")
+
+
+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")
+