WIP: #104303: WM panel parent API #105193
|
@ -208,11 +208,7 @@ static PanelType *fmodifier_subpanel_register(ARegionType *region_type,
|
|||
panel_type->poll = poll;
|
||||
panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
|
||||
panel_type->parent = parent;
|
||||
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
|
||||
WM_paneltype_subpanel_add(parent,pt, true);
|
||||
Bastien Montagne
commented
` WM_paneltype_subpanel_add(parent, pt, false);` (you do not want to use order here).
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
|
|
@ -665,12 +665,11 @@ void nla_buttons_register(ARegionType *art)
|
|||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->draw = nla_panel_evaluation;
|
||||
pt->draw_header = nla_panel_animated_influence_header;
|
||||
pt->parent = pt_properties;
|
||||
pt->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
pt->poll = nla_strip_eval_panel_poll;
|
||||
BLI_addtail(&pt_properties->children, BLI_genericNodeN(pt));
|
||||
WM_paneltype_subpanel_add(pt_properties, pt, true);
|
||||
Bastien Montagne
commented
` WM_paneltype_subpanel_add(parent, pt, false);` (you do not want to use order here).
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
||||
|
||||
Bastien Montagne
commented
Remove extra spaces... Remove extra spaces...
|
||||
pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel animated strip time");
|
||||
strcpy(pt->idname, "NLA_PT_animated_strip_time");
|
||||
strcpy(pt->parent_id, "NLA_PT_properties");
|
||||
|
@ -679,12 +678,10 @@ void nla_buttons_register(ARegionType *art)
|
|||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
pt->draw = nla_panel_animated_strip_time;
|
||||
pt->draw_header = nla_panel_animated_strip_time_header;
|
||||
pt->parent = pt_properties;
|
||||
pt->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
pt->poll = nla_strip_eval_panel_poll;
|
||||
BLI_addtail(&pt_properties->children, BLI_genericNodeN(pt));
|
||||
WM_paneltype_subpanel_add(pt_properties, pt, true);
|
||||
Bastien Montagne
commented
` WM_paneltype_subpanel_add(parent, pt, false);` (you do not want to use order here).
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
||||
Bastien Montagne
commented
No need to remove that line No need to remove that line
|
||||
pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel modifiers");
|
||||
strcpy(pt->idname, "NLA_PT_modifiers");
|
||||
strcpy(pt->label, N_("Modifiers"));
|
||||
|
|
|
@ -391,11 +391,7 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type,
|
|||
panel_type->poll = gpencil_modifier_ui_poll;
|
||||
panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
|
||||
panel_type->parent = parent;
|
||||
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
Bastien Montagne
commented
This line should not be removed, it's not handled by the call to This line should not be removed, it's not handled by the call to `WM_paneltype_subpanel_add`.
|
||||
WM_paneltype_subpanel_add(parent, pt, true);
|
||||
Bastien Montagne
commented
` WM_paneltype_subpanel_add(parent, pt, false);` (you do not want to use order here).
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
|
|
@ -389,19 +389,9 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
|||
}
|
||||
|
||||
/* Insert into list. */
|
||||
BLI_insertlinkafter(&art->paneltypes, pt_iter, pt);
|
||||
BLI_insertlinkafter(&art->paneltypes, pt_iter, pt);
|
||||
|
||||
if (parent) {
|
||||
pt->parent = parent;
|
||||
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));
|
||||
}
|
||||
WM_paneltype_subpanel_add(parent, pt, true);
|
||||
|
||||
{
|
||||
const char *owner_id = RNA_struct_state_owner_get();
|
||||
|
@ -410,7 +400,9 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
|||
}
|
||||
}
|
||||
|
||||
WM_paneltype_add(pt);
|
||||
WM_paneltype_add(pt);
|
||||
|
||||
|
||||
Bastien Montagne
commented
No need for extra empty lines here. No need for extra empty lines here.
|
||||
|
||||
/* update while blender is running */
|
||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||
|
|
|
@ -483,11 +483,7 @@ PanelType *modifier_subpanel_register(ARegionType *region_type,
|
|||
panel_type->poll = modifier_ui_poll;
|
||||
panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
|
||||
panel_type->parent = parent;
|
||||
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
Bastien Montagne
commented
This line should not be removed, it's not handled by the call to This line should not be removed, it's not handled by the call to `WM_paneltype_subpanel_add`.
|
||||
WM_paneltype_subpanel_add(parent, pt, true);
|
||||
Bastien Montagne
commented
` WM_paneltype_subpanel_add(parent, pt, false);` (you do not want to use order here).
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
|
|
@ -262,11 +262,7 @@ PanelType *shaderfx_subpanel_register(ARegionType *region_type,
|
|||
panel_type->poll = shaderfx_ui_poll;
|
||||
panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED;
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME);
|
||||
panel_type->parent = parent;
|
||||
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
Bastien Montagne
commented
This line should not be removed, it's not handled by the call to This line should not be removed, it's not handled by the call to `WM_paneltype_subpanel_add`.
|
||||
WM_paneltype_subpanel_add(parent, pt, true);
|
||||
Bastien Montagne
commented
` WM_paneltype_subpanel_add(parent, pt, false);` (you do not want to use order here).
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
|
|
@ -1154,6 +1154,7 @@ void WM_paneltype_init(void);
|
|||
void WM_paneltype_clear(void);
|
||||
struct PanelType *WM_paneltype_find(const char *idname, bool quiet);
|
||||
bool WM_paneltype_add(struct PanelType *pt);
|
||||
void WM_paneltype_subpanel_add(PanelType *pt, PanelType *parent, bool use_order);
|
||||
void WM_paneltype_remove(struct PanelType *pt);
|
||||
|
||||
void WM_paneltype_idname_visit_for_search(const struct bContext *C,
|
||||
|
|
|
@ -47,6 +47,27 @@ bool WM_paneltype_add(PanelType *pt)
|
|||
return true;
|
||||
}
|
||||
|
||||
Bastien Montagne
commented
Style: Please leave an empty line between function definitions. Style: Please leave an empty line between function definitions.
|
||||
void WM_paneltype_subpanel_add(PanelType *pt, PanelType *parent, bool use_order)
|
||||
{
|
||||
pt->parent = parent;
|
||||
|
||||
if (parent) {
|
||||
if (use_order) {
|
||||
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));
|
||||
}
|
||||
else {
|
||||
BLI_addtail(&parent->children, BLI_genericNodeN(pt));
|
||||
}
|
||||
}
|
||||
Bastien Montagne
commented
Wondering where Wondering where `art` comes from here...? Missing parameter?
|
||||
}
|
||||
|
||||
void WM_paneltype_remove(PanelType *pt)
|
||||
{
|
||||
const bool ok = BLI_ghash_remove(g_paneltypes_hash, pt->idname, NULL, NULL);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e133fc08cd3254bb3d3bd1345028c8486700bca4
|
||||
Subproject commit 27826b4aed138b7e3aed882d0eab96740c3a55c7
|
||||
Bastien Montagne
commented
This should not be here, in fact this has been removed recently, you need to update your patch against latest This should not be here, in fact this has been removed recently, you need to update your patch against latest `main` branch.
Pratyaksh Raj
commented
Sir In my 2nd commit there is no such submodule. Updated my main branch. Now For removing this should I need to change my branch and then put another PR? Sir In my 2nd commit there is no such submodule. Updated my main branch. Now For removing this should I need to change my branch and then put another PR?
Bastien Montagne
commented
Yes just rebase on latest Yes just rebase on latest `main` branch, and force-push on your fork.
|
This line should not be removed, it's not handled by the call to
WM_paneltype_subpanel_add
.