[Bf-blender-cvs] [6ac1a64] pie-menus: Pies:

Antony Riakiotakis noreply at git.blender.org
Mon Jul 28 13:12:33 CEST 2014


Commit: 6ac1a646ecd6318f369a7c8323d746a0065b891e
Author: Antony Riakiotakis
Date:   Mon Jul 28 13:11:11 2014 +0200
Branches: pie-menus
https://developer.blender.org/rB6ac1a646ecd6318f369a7c8323d746a0065b891e

Pies:

* Remove testing pie menu
* Fix enums with missing items not using radial layout
* Fix recentering on bounds not working anymore
* View pie was missing material mode in blender internal.

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_regions.c
M	source/blender/editors/sculpt_paint/paint_ops.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 21150dd..dcca456 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1773,37 +1773,6 @@ class VIEW3D_PT_tools_grease_pencil(GreasePencilPanel, Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'
     bl_category = "Grease Pencil"
-
-class VIEW3D_PIE_tests(Menu):
-    bl_label = "Testing Pie"
-
-    def draw(self, context):
-        layout = self.layout
-
-        toolsettings = context.tool_settings
-        sculpt = toolsettings.sculpt
-        brush = sculpt.brush
-
-        pie = layout.menu_pie()
-        pie.prop(sculpt, "use_symmetry_feather", toggle=True)
-        pie.prop(brush, "strength")
-
-        col = pie.column(align=True)
-        col.label(text="Symmetry")
-
-        row = col.row(align=True)
-        row.prop(sculpt, "use_symmetry_x", text="X", toggle=True)
-        row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True)
-        row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True)
-        col.prop(sculpt, "detail_refine_method", text="")
-        col.prop(sculpt, "detail_type_method", text="")
-
-        if context.sculpt_object.use_dynamic_topology_sculpting:
-            pie.operator("sculpt.dynamic_topology_toggle", icon='X', text="Disable Dyntopo")
-        else:
-            pie.operator("sculpt.dynamic_topology_toggle", icon='SCULPT_DYNTOPO', text="Enable Dyntopo")
-
-
         
     @classmethod
     def poll(cls, context):
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a751848..e42b535 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -556,6 +556,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
 	 */
 
 	uiBut *but;
+	uiLayout *layout_radial = NULL;
 	EnumPropertyItem *item, *item_array;
 	const char *name;
 	int itemw, icon, value;
@@ -569,7 +570,8 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
 
 	/* we dont want nested rows, cols in menus */
 	if (radial) {
-		uiBlockSetCurLayout(block, uiLayoutRadial(layout));
+		layout_radial = uiLayoutRadial(layout);
+		uiBlockSetCurLayout(block, layout_radial);
 	}
 	else if (layout->root->type != UI_LAYOUT_MENU) {
 		uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
@@ -581,7 +583,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
 	for (item = item_array; item->identifier; item++) {
 		if (!item->identifier[0]) {
 			if (radial)
-				uiItemS(layout);
+				uiItemS(layout_radial);
 			continue;
 		}
 
@@ -2306,16 +2308,11 @@ static void ui_litem_layout_radial(uiLayout *litem)
 				/* enable drawing as pie item if supported by widget */
 				if (ui_item_is_radial_drawable(bitem))
 					bitem->but->dt = UI_EMBOSSR;
-
-				ui_item_size(item, &itemw, &itemh);
-
-				ui_item_position(item, x - itemw / 2, y - itemh / 2, itemw, itemh);
 			}
-			else {
-				ui_item_size(item, &itemw, &itemh);
 
-				ui_item_position(item, x + vec[0] * pie_radius - itemw / 2, y + vec[1] * pie_radius - itemh / 2, itemw, itemh);
-			}
+			ui_item_size(item, &itemw, &itemh);
+
+			ui_item_position(item, x + vec[0] * pie_radius - itemw / 2, y + vec[1] * pie_radius - itemh / 2, itemw, itemh);
 
 			minx = min_ii(minx, x + vec[0] * pie_radius - itemw / 2);
 			maxx = max_ii(maxx, x + vec[0] * pie_radius + itemw / 2);
@@ -2793,7 +2790,7 @@ uiLayout *uiLayoutRadial(uiLayout *layout)
 		}
 	}
 
-	litem = MEM_callocN(sizeof(uiLayout), "uiLayoutRow");
+	litem = MEM_callocN(sizeof(uiLayout), "uiLayoutRadial");
 	litem->item.type = ITEM_LAYOUT_RADIAL;
 	litem->root = layout->root;
 	litem->active = true;
@@ -2801,7 +2798,7 @@ uiLayout *uiLayoutRadial(uiLayout *layout)
 	litem->context = layout->context;
 	litem->redalert = layout->redalert;
 	litem->w = layout->w;
-	BLI_addtail(&layout->items, litem);
+	BLI_addtail(&layout->root->layout->items, litem);
 
 	uiBlockSetCurLayout(layout->root->block, litem);
 
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 37c521d..cc18e73 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1709,6 +1709,7 @@ uiBlock *ui_popup_block_refresh(
 	if (block->flag & UI_BLOCK_RADIAL) {
 		/* find area that spawned this menu, keep it inside */
 		ScrArea *sa = CTX_wm_area(C);
+		uiBut *but;
 		int ar_w = BLI_rcti_size_x(&sa->totrct);
 		int ar_h = BLI_rcti_size_y(&sa->totrct);
 		int x_offset = 0, y_offset = 0;
@@ -1741,6 +1742,13 @@ uiBlock *ui_popup_block_refresh(
 			ui_block_translate(block, x_offset, y_offset);
 			block->pie_data.flags |= UI_PIE_INITIAL_DIRECTION;
 		}
+
+		/* lastly set the buttons at the center of the pie menu, ready for animation */
+		for (but = block->buttons.first; but; but = but->next) {
+			if (but->pie_dir) {
+				BLI_rctf_recenter(&but->rect, block->pie_data.pie_center_spawned[0], block->pie_data.pie_center_spawned[1]);
+			}
+		}
 	}
 	else {
 		/* clip block with window boundary */
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 5261574..e2bde5e 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1362,7 +1362,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.use_smooth_stroke");
 
-	WM_keymap_add_pie_menu(keymap, "VIEW3D_PIE_tests", QKEY, KM_PRESS, 0, 0, false);
 
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", RKEY, KM_PRESS, 0, 0);
 	RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.texture_angle_source_random");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index f60c0c6..19e25e4 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -680,9 +680,6 @@ static EnumPropertyItem *rna_SpaceView3D_viewport_shade_pie_itemf(bContext *UNUS
 	RNA_enum_items_add_value(&item, &totitem, viewport_shade_items_pie, OB_WIRE);
 	RNA_enum_items_add_value(&item, &totitem, viewport_shade_items_pie, OB_TEXTURE);
 
-	if (BKE_scene_use_new_shading_nodes(scene))
-		RNA_enum_items_add_value(&item, &totitem, viewport_shade_items_pie, OB_MATERIAL);
-
 	if (type && type->view_draw)
 		RNA_enum_items_add_value(&item, &totitem, viewport_shade_items_pie, OB_RENDER);




More information about the Bf-blender-cvs mailing list