[Bf-blender-cvs] [ebf3736] wiggly-widgets: Draw selected widgets before others

Julian Eisel noreply at git.blender.org
Thu Mar 3 12:00:32 CET 2016


Commit: ebf373641c383b96b8e371502cec489011556a85
Author: Julian Eisel
Date:   Thu Mar 3 11:55:09 2016 +0100
Branches: wiggly-widgets
https://developer.blender.org/rBebf373641c383b96b8e371502cec489011556a85

Draw selected widgets before others

We want the manipulator to be in front of facemap widgets.

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

M	source/blender/windowmanager/widgets/intern/wm_widgetmap.c

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

diff --git a/source/blender/windowmanager/widgets/intern/wm_widgetmap.c b/source/blender/windowmanager/widgets/intern/wm_widgetmap.c
index f44214d..445c5c6 100644
--- a/source/blender/windowmanager/widgets/intern/wm_widgetmap.c
+++ b/source/blender/windowmanager/widgets/intern/wm_widgetmap.c
@@ -293,6 +293,7 @@ void WM_widgetmap_widgets_draw(
 
 	wmWidget *widget = wmap->wmap_context.active_widget;
 
+	/* draw active widget */
 	if (widget && in_scene == (widget->flag & WM_WIDGET_SCENE_DEPTH)) {
 		if (widget->flag & WM_WIDGET_DRAW_ACTIVE) {
 			/* notice that we don't update the widgetgroup, widget is now on
@@ -300,13 +301,27 @@ void WM_widgetmap_widgets_draw(
 			widget->draw(C, widget);
 		}
 	}
-	else if (!BLI_listbase_is_empty(&wmap->widgetgroups)) {
+
+	/* draw selected widgets */
+	if (wmap->wmap_context.selected_widgets) {
+		for (int i = 0; i < wmap->wmap_context.tot_selected; i++) {
+			widget = BLI_ghash_lookup(draw_widgets, wmap->wmap_context.selected_widgets[i]->idname);
+			if (widget && (in_scene == (widget->flag & WM_WIDGET_SCENE_DEPTH))) {
+				/* notice that we don't update the widgetgroup, widget is now on
+				 * its own, it should have all relevant data to update itself */
+				widget->draw(C, widget);
+			}
+		}
+	}
+
+	/* draw other widgets */
+	if (!wmap->wmap_context.active_widget && !BLI_listbase_is_empty(&wmap->widgetgroups)) {
 		GHashIterator gh_iter;
 
 		GHASH_ITER (gh_iter, draw_widgets) { /* draw_widgets excludes hidden widgets */
 			widget = BLI_ghashIterator_getValue(&gh_iter);
 			if ((in_scene == (widget->flag & WM_WIDGET_SCENE_DEPTH)) &&
-			    ((widget->flag & WM_WIDGET_SELECTED) == 0) && /* selected are drawn later */
+			    ((widget->flag & WM_WIDGET_SELECTED) == 0) && /* selected were drawn already */
 			    ((widget->flag & WM_WIDGET_DRAW_HOVER) == 0 || (widget->flag & WM_WIDGET_HIGHLIGHT)))
 			{
 				widget->draw(C, widget);
@@ -314,17 +329,6 @@ void WM_widgetmap_widgets_draw(
 		}
 	}
 
-	/* draw selected widgets last */
-	if (wmap->wmap_context.selected_widgets) {
-		for (int i = 0; i < wmap->wmap_context.tot_selected; i++) {
-			widget = BLI_ghash_lookup(draw_widgets, wmap->wmap_context.selected_widgets[i]->idname);
-			if (widget && (in_scene == (widget->flag & WM_WIDGET_SCENE_DEPTH))) {
-				/* notice that we don't update the widgetgroup, widget is now on
-				 * its own, it should have all relevant data to update itself */
-				widget->draw(C, widget);
-			}
-		}
-	}
 
 	if (draw_multisample)
 		glDisable(GL_MULTISAMPLE);




More information about the Bf-blender-cvs mailing list