diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 1 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_context_menu.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 7 |
3 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 00e96955fb4..0d6236a7728 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -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); diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 1e4f1a7f5dc..516fd4fc7fc 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -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); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 3cc9a743a17..a22351eea7e 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -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); +} + /** \} */ /* -------------------------------------------------------------------- */ |