diff options
author | Erik <ecke101@gmail.com> | 2022-06-13 19:27:50 +0300 |
---|---|---|
committer | Erik <ecke101@gmail.com> | 2022-06-13 19:27:50 +0300 |
commit | 40d700c6fbc9f80904eb1861097cf9d3cbd14d1f (patch) | |
tree | 588e5fb99a19409b660f3beccc1077b4223dfee1 /source/blender/makesrna | |
parent | e2993719a808ff39b7fe749e177ad7ea3d4c4ca6 (diff) |
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
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 9 |
1 files changed, 8 insertions, 1 deletions
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)); } { |