[Bf-blender-cvs] [b5ce99d] pie-menus: Calculate correct segment when offsetting the pie menu.

Antony Riakiotakis noreply at git.blender.org
Mon Jul 28 17:14:31 CEST 2014


Commit: b5ce99ddf73efa00b245ad394a8f4cb705462980
Author: Antony Riakiotakis
Date:   Mon Jul 28 17:13:44 2014 +0200
Branches: pie-menus
https://developer.blender.org/rBb5ce99ddf73efa00b245ad394a8f4cb705462980

Calculate correct segment when offsetting the pie menu.

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

M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_regions.c

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 7fd502c..37cbac5 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -7984,7 +7984,7 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock
 	return retval;
 }
 
-static void ui_block_calculate_pie_segment(uiBlock *block, const float mx, const float my)
+void ui_block_calculate_pie_segment(uiBlock *block, const float mx, const float my)
 {
 	float seg1[2];
 	float seg2[2];
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 982de7b..f0e3b4c 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -593,6 +593,8 @@ extern bool ui_button_is_active(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT;
 extern int ui_button_open_menu_direction(uiBut *but);
 extern void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but, const bool restore);
 extern uiBut *ui_but_find_activated(struct ARegion *ar);
+void ui_block_calculate_pie_segment(struct uiBlock *block, const float mx, const float my);
+
 
 void ui_button_clipboard_free(void);
 void ui_panel_menu(struct bContext *C, ARegion *ar, Panel *pa);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 9143116..eac6d36 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1740,10 +1740,13 @@ uiBlock *ui_popup_block_refresh(
 			block->pie_data.pie_center_spawned[1] += y_offset;
 
 			ui_block_translate(block, x_offset, y_offset);
-			block->pie_data.flags |= UI_PIE_INITIAL_DIRECTION;
+			if (U.pie_initial_timeout > 0)
+				block->pie_data.flags |= UI_PIE_INITIAL_DIRECTION;
+			else
+				ui_block_calculate_pie_segment(block, block->pie_data.pie_center_init[0], block->pie_data.pie_center_init[1]);
 		}
-
-		block->pie_data.flags |= UI_PIE_INVALID_DIR;
+		else
+			block->pie_data.flags |= UI_PIE_INVALID_DIR;
 
 		/* lastly set the buttons at the center of the pie menu, ready for animation */
 		if (U.pie_animation_timeout > 0) {




More information about the Bf-blender-cvs mailing list