[Bf-blender-cvs] [3aa61499d06] blender2.8: Fix unnecessary empty space in shading popover.

Brecht Van Lommel noreply at git.blender.org
Fri Jun 29 17:59:41 CEST 2018


Commit: 3aa61499d06960eef7a0f64e32bfb88694dc315a
Author: Brecht Van Lommel
Date:   Fri Jun 29 17:46:16 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3aa61499d06960eef7a0f64e32bfb88694dc315a

Fix unnecessary empty space in shading popover.

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

M	source/blender/editors/interface/interface_layout.c

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

diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 1b6a1bd27a0..f4c0123567c 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -4310,6 +4310,9 @@ static void ui_paneltype_draw_impl(
 	panel->type = pt;
 	panel->flag = PNL_POPOVER;
 
+	uiLayout *last_item = layout->items.last;
+
+	/* Draw main panel. */
 	if (show_header) {
 		uiLayout *row = uiLayoutRow(layout, false);
 		if (pt->draw_header) {
@@ -4326,19 +4329,21 @@ static void ui_paneltype_draw_impl(
 
 	MEM_freeN(panel);
 
-	PanelType *pt_iter = pt;
-	while (pt_iter->prev) {
-		pt_iter = pt_iter->prev;
-	}
-	do {
-		if (pt_iter != pt && STREQ(pt_iter->parent_id, pt->idname)) {
-			if (pt_iter->poll == NULL || pt_iter->poll(C, pt_iter)) {
+	/* Draw child panels. */
+	for (LinkData *link = pt->children.first; link; link = link->next) {
+		PanelType *child_pt = link->data;
+
+		if (child_pt->poll == NULL || child_pt->poll(C, child_pt)) {
+			/* Add space if something was added to the layout. */
+			if (last_item != layout->items.last) {
 				uiItemS(layout);
-				uiLayout *col = uiLayoutColumn(layout, false);
-				ui_paneltype_draw_impl(C, pt_iter, col, true);
+				last_item = layout->items.last;
 			}
+
+			uiLayout *col = uiLayoutColumn(layout, false);
+			ui_paneltype_draw_impl(C, child_pt, col, true);
 		}
-	} while ((pt_iter = pt_iter->next));
+	}
 }
 
 /**



More information about the Bf-blender-cvs mailing list