diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-06-11 09:01:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-06-11 09:01:19 +0300 |
commit | df57ea7f3b9d750ab322692bf50828bd4c10371c (patch) | |
tree | 93e0544a353af86e71e2ce49990609280823048a /source/blender/makesrna/intern | |
parent | 3084b4350bc9a849ace91fcefeba49ee83df59f7 (diff) |
Fix panel-type re-registration with parents
The order of panel types changes when re-registering existing types.
Fixes an error exposed by T65393.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 82315605ee5..1e5f1dc20ec 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -279,12 +279,24 @@ static StructRNA *rna_Panel_register(Main *bmain, /* check if we have registered this panel type before, and remove it */ for (pt = art->paneltypes.first; pt; pt = pt->next) { if (STREQ(pt->idname, dummypt.idname)) { + PanelType *pt_next = pt->next; if (pt->ext.srna) { rna_Panel_unregister(bmain, pt->ext.srna); } else { BLI_freelinkN(&art->paneltypes, pt); } + + /* The order of panel types will be altered on re-registration. */ + if (dummypt.parent_id[0] && (parent == NULL)) { + for (pt = pt_next; pt; pt = pt->next) { + if (STREQ(pt->idname, dummypt.parent_id)) { + parent = pt; + break; + } + } + } + break; } @@ -292,6 +304,7 @@ static StructRNA *rna_Panel_register(Main *bmain, parent = pt; } } + if (!RNA_struct_available_or_report(reports, dummypt.idname)) { return NULL; } |