Fix panel pinning showing for instanced panels (e.g. FCurve modifiers)
This was reported for FCurve modifiers, but was also true (in theory) for other instanced panels (regular modifiers, spreadsheet filters, ...), these would not show pinning for other reasons (no caterories). So in the case of the Graph Editor the follwing happens: `graph_buttons_register` only registers `GRAPH_PT_modifiers`, the panel itself has no header (PANEL_TYPE_NO_HEADER), further panels for individual modifiers are added dynamically in `graph_panel_modifiers`. So when pinning a particular modifier, we would pin e.g. `GRAPH_PT_noise` (not `GRAPH_PT_modifiers`). ED_region_panels_layout_ex would only collect panels known to `graph_buttons_register` (so is not aware of the specific panels of modifiers). So while I think it should be possible to pin `GRAPH_PT_modifiers` on top of an individual modifier's panel this would result in all modifiers being shown in other categories [which would also be weird]. Panel header layout was also not correct (drawing the pin icon over the modifier delete icon). So to resolve this, just dont use pinning for these type of panels. part of T92293. Maniphest Tasks: T92293 Differential Revision: https://developer.blender.org/D12965
This commit is contained in:
parent
cca811de98
commit
7ac4e874db
Notes:
blender-bot
2023-02-14 02:30:10 +01:00
Referenced by issue #92293, Graph Editor Modifiers UI Bug
|
@ -1777,6 +1777,7 @@ void UI_panel_label_offset(const struct uiBlock *block, int *r_x, int *r_y);
|
|||
int UI_panel_size_y(const struct Panel *panel);
|
||||
bool UI_panel_is_dragging(const struct Panel *panel);
|
||||
bool UI_panel_matches_search_filter(const struct Panel *panel);
|
||||
bool UI_panel_can_be_pinned(const struct Panel *panel);
|
||||
|
||||
bool UI_panel_category_is_visible(const struct ARegion *region);
|
||||
void UI_panel_category_add(struct ARegion *region, const char *name);
|
||||
|
|
|
@ -1257,6 +1257,9 @@ void ui_popup_context_menu_for_panel(bContext *C, ARegion *region, Panel *panel)
|
|||
if (panel->type->parent != NULL) {
|
||||
return;
|
||||
}
|
||||
if (!UI_panel_can_be_pinned(panel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create(&screen->id, &RNA_Panel, panel, &ptr);
|
||||
|
|
|
@ -2100,7 +2100,7 @@ static void ui_handle_panel_header(const bContext *C,
|
|||
BLI_assert(!(panel->type->flag & PANEL_TYPE_NO_HEADER));
|
||||
|
||||
const bool is_subpanel = (panel->type->parent != NULL);
|
||||
const bool use_pin = UI_panel_category_is_visible(region) && !is_subpanel;
|
||||
const bool use_pin = UI_panel_category_is_visible(region) && UI_panel_can_be_pinned(panel);
|
||||
const bool show_pin = use_pin && (panel->flag & PNL_PIN);
|
||||
const bool show_drag = !is_subpanel;
|
||||
|
||||
|
@ -2497,6 +2497,11 @@ PointerRNA *UI_region_panel_custom_data_under_cursor(const bContext *C, const wm
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool UI_panel_can_be_pinned(const Panel *panel)
|
||||
{
|
||||
return (panel->type->parent == NULL) && !(panel->type->flag & PANEL_TYPE_INSTANCED);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
Loading…
Reference in New Issue