Commit: 09ce794dc8c6cf5e406532651576e6b86dfd9232
Author: Campbell Barton
Date:   Sat Jun 9 14:21:39 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB09ce794dc8c6cf5e406532651576e6b86dfd9232

UI: initial support for parent panels in popovers

Currently this just includes the panels, no support for collapsing yet.

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

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

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

diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index b3bd98c7b94..b4677d95361 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2075,10 +2075,12 @@ void uiItemPopoverPanelFromGroup(
 
        for (PanelType *pt = art->paneltypes.first; pt; pt = pt->next) {
                /* Causes too many panels, check context. */
-               if (/* (*context == '\0') || */ STREQ(pt->context, context)) {
-                       if ((*category == '\0') || STREQ(pt->category, 
category)) {
-                               if (pt->poll == NULL || pt->poll(C, pt)) {
-                                       uiItemPopoverPanel_ptr(layout, C, pt, 
NULL, ICON_NONE);
+               if (pt->parent_id[0] == '\0') {
+                       if (/* (*context == '\0') || */ STREQ(pt->context, 
context)) {
+                               if ((*category == '\0') || STREQ(pt->category, 
category)) {
+                                       if (pt->poll == NULL || pt->poll(C, 
pt)) {
+                                               uiItemPopoverPanel_ptr(layout, 
C, pt, NULL, ICON_NONE);
+                                       }
                                }
                        }
                }
@@ -3828,18 +3830,11 @@ void UI_menutype_draw(bContext *C, MenuType *mt, struct 
uiLayout *layout)
        }
 }
 
-/**
- * Used for popup panels only.
- */
-void UI_paneltype_draw(bContext *C, PanelType *pt, uiLayout *layout)
+
+static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout 
*layout)
 {
        Panel *panel = MEM_callocN(sizeof(Panel), "popover panel");
        panel->type = pt;
-
-       if (layout->context) {
-               CTX_store_set(C, layout->context);
-       }
-
        if (pt->draw_header) {
                panel->layout = uiLayoutRow(layout, false);
                pt->draw_header(C, panel);
@@ -3850,9 +3845,36 @@ void UI_paneltype_draw(bContext *C, PanelType *pt, 
uiLayout *layout)
        pt->draw(C, panel);
        panel->layout = NULL;
 
+       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)) 
{
+                               uiItemS(layout);
+                               uiItemL(layout, pt_iter->label, ICON_NONE);
+                               ui_paneltype_draw_impl(C, pt_iter, layout);
+                       }
+               }
+       } while ((pt_iter = pt_iter->next));
+}
+
+/**
+ * Used for popup panels only.
+ */
+void UI_paneltype_draw(bContext *C, PanelType *pt, uiLayout *layout)
+{
+       if (layout->context) {
+               CTX_store_set(C, layout->context);
+       }
+
+       ui_paneltype_draw_impl(C, pt, layout);
+
        if (layout->context) {
                CTX_store_set(C, NULL);
        }
 
-       MEM_freeN(panel);
 }
diff --git a/source/tools b/source/tools
index fca325137b6..9d7d338cb25 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit fca325137b6ee2dfd0930ca87684ccf30703554f
+Subproject commit 9d7d338cb25a071f9646cf9ba16f17004c963f77

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to