[Bf-blender-cvs] [40d700c6fbc] master: UI: Use "bl_order" for UI child panels

Erik noreply at git.blender.org
Mon Jun 13 18:29:01 CEST 2022


Commit: 40d700c6fbc9f80904eb1861097cf9d3cbd14d1f
Author: Erik
Date:   Mon Jun 13 18:27:50 2022 +0200
Branches: master
https://developer.blender.org/rB40d700c6fbc9f80904eb1861097cf9d3cbd14d1f

UI: Use "bl_order" for UI child panels

The "bl_order" property on add-on UI panels can be used to put
them in a specific order regardless of the order of registering.
This patch makes this ordering also possible for panels inside panels.

Differential Revision: https://developer.blender.org/D15174

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

M	source/blender/makesrna/intern/rna_ui.c

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

diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 1d0723851ad..dabb89bcd5e 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -393,7 +393,14 @@ static StructRNA *rna_Panel_register(Main *bmain,
 
   if (parent) {
     pt->parent = parent;
-    BLI_addtail(&parent->children, BLI_genericNodeN(pt));
+    LinkData *pt_child_iter = parent->children.last;
+    for (; pt_child_iter; pt_child_iter = pt_child_iter->prev) {
+      PanelType *pt_child = pt_child_iter->data;
+      if (pt_child->order <= pt->order) {
+        break;
+      }
+    }
+    BLI_insertlinkafter(&parent->children, pt_child_iter, BLI_genericNodeN(pt));
   }
 
   {



More information about the Bf-blender-cvs mailing list