[Bf-blender-cvs] [90906db] pie-menus: Address Dalai's concerns

Antony Riakiotakis noreply at git.blender.org
Wed Jul 30 15:37:18 CEST 2014


Commit: 90906db4fd4e3199defddbf5574e5c0cbb8bdab3
Author: Antony Riakiotakis
Date:   Wed Jul 30 15:37:05 2014 +0200
Branches: pie-menus
https://developer.blender.org/rB90906db4fd4e3199defddbf5574e5c0cbb8bdab3

Address Dalai's concerns

===================================================================

M	release/scripts/modules/bpy_types.py
M	release/scripts/startup/bl_operators/wm.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/templates_py/ui_pie_menu.py
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/space_api/spacetypes.c
M	source/blender/editors/space_view3d/view3d_ops.c
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/wm.h

===================================================================

diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index f43df91..7774a3a 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -140,7 +140,7 @@ class WindowManager(bpy_types.ID):
         finally:
             self.pupmenu_end__internal(popup)
 
-    def menu_pie(self, event, draw_func, title="", icon='NONE', force_hold=False):
+    def pie_menu(self, event, draw_func, title="", icon='NONE', force_hold=False):
         import bpy
         pie = self.piemenu_begin__internal(title, icon, event, force_hold)
 
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 4e0843a..a73d299 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -551,7 +551,7 @@ class WM_OT_context_pie_enum(Operator):
             layout = self.layout
             layout.prop(value_base, prop_string, expand=True)
 
-        context.window_manager.menu_pie(draw_func=draw_cb, title=prop.name, icon=prop.icon, event=event)
+        context.window_manager.pie_menu(draw_func=draw_cb, title=prop.name, icon=prop.icon, event=event)
 
         return {'FINISHED'}
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 92f3be6..44daa3b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1439,6 +1439,7 @@ class VIEW3D_PIE_shade(Menu):
                 pie.operator("OBJECT_OT_shade_smooth")
                 pie.operator("OBJECT_OT_shade_flat")
 
+
 class VIEW3D_PIE_manipulator(Menu):
     bl_label = "Manipulator"
 
@@ -1450,7 +1451,6 @@ class VIEW3D_PIE_manipulator(Menu):
         pie.prop(context.space_data, "show_manipulator")
 
         
-
 class VIEW3D_PIE_pivot(Menu):
     bl_label = "Pivot"
 
@@ -1461,6 +1461,7 @@ class VIEW3D_PIE_pivot(Menu):
         pie.prop(context.space_data, "pivot_point", expand=True)
         pie.prop(context.space_data, "use_pivot_point_align", text="Center Points")
 
+
 class VIEW3D_PIE_snap(Menu):
     bl_label = "Snapping"
 
diff --git a/release/scripts/templates_py/ui_pie_menu.py b/release/scripts/templates_py/ui_pie_menu.py
index 1aaf5ca..a3461b9 100644
--- a/release/scripts/templates_py/ui_pie_menu.py
+++ b/release/scripts/templates_py/ui_pie_menu.py
@@ -7,6 +7,7 @@ from bpy.types import Menu
 
 myitems = (('0','Hey Lady!', ''),('1','Spaaaaaaaceeeee!',''),('2','Wanna be awesome in space?',''), ('3','The fact sphere is always useful',''))
 
+
 class TestPieOperator(bpy.types.Operator):
     """Tooltip"""
     bl_idname = "wm.test_pie_operator"
@@ -22,6 +23,7 @@ class TestPieOperator(bpy.types.Operator):
         print("The sphere core says: " + myitems[int(self.test_type)][1])
         return {'FINISHED'}
 
+
 class VIEW3D_PIE_template(Menu):
     bl_label = "Test Pie"
 
@@ -41,6 +43,7 @@ def unregister():
     bpy.utils.unregister_class(TestPieOperator)
     bpy.utils.unregister_class(VIEW3D_PIE_template)
 
+
 if __name__ == "__main__":
     register()
     
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 0e8a451..7c0223e 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -122,7 +122,7 @@ bScreen	*ED_screen_animation_playing(const struct wmWindowManager *wm);
 
 /* screen keymaps */
 void    ED_operatortypes_screen(void);
-void    ED_operatormacros_screen(void);
+void    ED_operatormacros_view3d(void);
 void    ED_keymap_screen(struct wmKeyConfig *keyconf);
 
 /* operators; context poll callbacks */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index ff89371..7032c05 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -718,7 +718,7 @@ void                       UI_panel_category_draw_all(struct ARegion *ar, const
  * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */
 
 void UI_add_region_handlers(struct ListBase *handlers);
-void UI_add_popup_handlers(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *popup, bool accept_dbl_click);
+void UI_add_popup_handlers(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *popup, const bool accept_dbl_click);
 void UI_remove_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *popup);
 void UI_remove_popup_handlers_all(struct bContext *C, struct ListBase *handlers);
 
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 8bce619..6947548 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8527,7 +8527,6 @@ static bool ui_pie_menu_supported_apply(uiBut *but) {
 	return true;
 }
 
-
 static int ui_pie_menu_apply(bContext *C, uiPopupBlockHandle *menu, uiBut *but, bool force_close, bool click_style)
 {
 	int retval = WM_UI_HANDLER_BREAK;
@@ -8800,8 +8799,6 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
 	return retval;
 }
 
-
-
 static int ui_handle_menus_recursive(
         bContext *C, const wmEvent *event, uiPopupBlockHandle *menu,
         int level, const bool is_parent_inside, const bool is_parent_menu, const bool is_floating)
@@ -9091,7 +9088,7 @@ void UI_add_region_handlers(ListBase *handlers)
 	WM_event_add_ui_handler(NULL, handlers, ui_handler_region, ui_handler_remove_region, NULL, false);
 }
 
-void UI_add_popup_handlers(bContext *C, ListBase *handlers, uiPopupBlockHandle *popup, bool accept_dbl_click)
+void UI_add_popup_handlers(bContext *C, ListBase *handlers, uiPopupBlockHandle *popup, const bool accept_dbl_click)
 {
 	WM_event_add_ui_handler(C, handlers, ui_handler_popup, ui_handler_remove_popup, popup, accept_dbl_click);
 }
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 6237e60..3c8971d 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2141,95 +2141,43 @@ static RadialDirection ui_get_radialbut_vec(float *vec, short itemnum)
 	 */
 
 	/* if (itemnum < 5) { */
-		switch (itemnum) {
-			case 1:
-				dir = UI_RADIAL_W;
-				angle = 180.0f;
-				break;
-			case 2:
-				dir = UI_RADIAL_E;
-				angle = 0.0f;
-				break;
-			case 3:
-				dir = UI_RADIAL_S;
-				angle = 270.0f;
-				break;
-			case 4:
-				dir = UI_RADIAL_N;
-				angle = 90.0f;
-				break;
-/*		}
-	}
-	else if (totitems < 9) {
-		switch (itemnum) {
-			*/
-			case 5:
-				dir = UI_RADIAL_NW;
-				angle = 140;
-				break;
-			case 6:
-				dir = UI_RADIAL_NE;
-				angle = 40;
-				break;
-			case 7:
-				dir = UI_RADIAL_SW;
-				angle = 220;
-				break;
-			case 8:
-				dir = UI_RADIAL_SE;
-				angle = 320;
-				break;
-
-			default:
-				break;
-		}
-#if 0
-	}
-	else {
-		/* subdivide quadrants progressively, depending on number of items */
-		int anglepad, curquad, numinquad, aligncorrect=0;
-		int quaditems, overflow;
-
-		overflow = totitems % 4;		/* how many items are in the last incomplete loop */
-		curquad = itemnum % 4;	/* the quadrant that the current button is in */
-
-		quaditems = (int)((totitems-4) / 4);	/* how many items in this quadrant between compass points */
-		if ((overflow) && (curquad <= overflow)) quaditems++;
-		numinquad = (int)((itemnum - 1) / 4);	/* the ordered position of the current button in its quadrant */
-
-
-		/* divide up the required angle for this quadrant, and find the angle to offset this item */
-		anglepad = 90 / (quaditems+1);
-		switch(curquad) {
-			case 1:
-				angle = 0;
-				break;
-			case 2:
-				angle = 90;
-				break;
-			case 3:
-				angle = 180;
-				break;
-			case 0:
-				angle = 270;
-				break;
-		}
-		angle += anglepad * numinquad;
-
-
-		/* if the angle is near the horizontal, squish it a bit closer.
-		 * This visually spaces the horizontal menu items better, since even though the
-		 * item centers may be evenly distributed, it doesn't look that way. */
-		if (angle < 90)
-			aligncorrect = angle;
-		else if (angle < 270)
-			aligncorrect = angle - 180;
-		else if (angle <= 360)
-			aligncorrect = angle - 360;
+	switch (itemnum) {
+		case 1:
+			dir = UI_RADIAL_W;
+			angle = 180.0f;
+			break;
+		case 2:
+			dir = UI_RADIAL_E;
+			angle = 0.0f;
+			break;
+		case 3:
+			dir = UI_RADIAL_S;
+			angle = 270.0f;
+			break;
+		case 4:
+			dir = UI_RADIAL_N;
+			angle = 90.0f;
+			break;
+		case 5:
+			dir = UI_RADIAL_NW;
+			angle = 140;
+			break;
+		case 6:
+			dir = UI_RADIAL_NE;
+			angle = 40;
+			break;
+		case 7:
+			dir = UI_RADIAL_SW;
+			angle = 220;
+			break;
+		case 8:
+			dir = UI_RADIAL_SE;
+			angle = 320;
+			break;
 
-		angle += aligncorrect/17;	/* 17 == magic number, works nicely */
+		default:
+			break;
 	}
-#endif
 
 	angle = DEG2RADF(angle);
 
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index eb081ab..156b4f9 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3753,7 +3753,7 @@ static void draw_disk_shaded(float start, float angle, float radius_int, float r
 	glVertex2f(c * radius_int, s * radius_int);
 
 	if (shaded) {
-		fac = (y2 + radius_ext) / (float) (2.0f * radius_ext);
+		fac = (y2 + radius_ext) / (2.0f * radius_ext);
 		round_box_shade_col4_r(r_col, col1, col2, fac);
 
 		glColor4ubv(r_col);
@@ -3768,7 +3768,7 @@ static void draw_disk_shaded(float start, float angle, float radius_int, float r
 		y2 = s * radius_ext;
 
 		if (shaded) {
-			fac = (y1 + radius_ext) / (float) (2.0f * radius_ext);
+			fac = (y1 + radius_ext) / (2.0f * radius_ext);
 			round_box_shade_col4_r(r_col, col1, col2, fac);
 
 			glColor4ubv(r_col);
@@ -3776,7 +3776,7 @@ static void draw_disk_shaded(float start, float angle, float radius_int, float r
 		glVertex2f(c * radius_int, s * radius_int);
 
 		if (shaded) {
-			fac = (y2 + radius_ext) / (float) (2.0f * radius_ext);
+			fac = (y2 + radius_ext)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list