Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-01-22 20:08:58 +0300
committerHans Goudey <h.goudey@me.com>2021-01-22 20:08:58 +0300
commite845467d93fe35e222d14b0bb27472ccb309b321 (patch)
tree2f6105746dc29b3d5d24b99a8cb846a108ea9dc0 /source/blender/editors
parent226eb5e3668699e7b1d9c985a2b79ac49020befc (diff)
Fix: Mouse presses in some areas do not set active modifier
There are a couple of operations that are meant to set the active modifier that currently don't. The first is a mouse press on the drag icon on the right of the header, and the second is mouse presses on modifier sub-panels headers. This was an oversight in the implementation, especially the second, because the blank space on the right of a sub-panel header often looks just like the blank space elsewhere on the modifier's panel that *does* set the active modifier. Note that this purposefully doesn't include collapsing and expanding the modifier as operations that set the active, since regardless of whether that makes sense, it wasn't in the agreed upon design, which would ideally not need changing for 2.92. Differential Revision: https://developer.blender.org/D10155
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_panel.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index e96c0a25d6d..12862363c5b 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -583,7 +583,7 @@ static void set_panels_list_data_expand_flag(const bContext *C, const ARegion *r
/** \name Panels
* \{ */
-static bool panel_use_active_highlight(const Panel *panel)
+static bool panel_custom_data_active_get(const Panel *panel)
{
/* The caller should make sure the panel is active and has a type. */
BLI_assert(UI_panel_is_active(panel));
@@ -599,6 +599,21 @@ static bool panel_use_active_highlight(const Panel *panel)
return false;
}
+static void panel_custom_data_active_set(Panel *panel)
+{
+ /* Since the panel is interacted with, it should be active and have a type. */
+ BLI_assert(UI_panel_is_active(panel));
+ BLI_assert(panel->type != NULL);
+
+ if (panel->type->active_property[0] != '\0') {
+ PointerRNA *ptr = UI_panel_custom_data_get(panel);
+ BLI_assert(RNA_struct_find_property(ptr, panel->type->active_property) != NULL);
+ if (ptr != NULL && !RNA_pointer_is_null(ptr)) {
+ RNA_boolean_set(ptr, panel->type->active_property, true);
+ }
+ }
+}
+
/**
* Set flag state for a panel and its sub-panels.
*/
@@ -1342,7 +1357,7 @@ void ui_draw_aligned_panel(const uiStyle *style,
region_search_filter_active);
}
- if (panel_use_active_highlight(panel)) {
+ if (panel_custom_data_active_get(panel)) {
panel_draw_highlight_border(panel, rect, &header_rect);
}
}
@@ -2169,6 +2184,12 @@ static void ui_handle_panel_header(const bContext *C,
ui_panel_drag_collapse_handler_add(C, UI_panel_is_closed(panel));
}
+ /* Set panel custom data (modifier) active when expanding subpanels, but not top-level
+ * panels to allow collapsing and expanding without setting the active element. */
+ if (is_subpanel) {
+ panel_custom_data_active_set(panel);
+ }
+
set_panels_list_data_expand_flag(C, region);
panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
return;
@@ -2607,6 +2628,8 @@ static void panel_activate_state(const bContext *C, Panel *panel, const uiHandle
}
if (state == PANEL_STATE_DRAG) {
+ panel_custom_data_active_set(panel);
+
panel_set_flag_recursive(panel, PNL_SELECT, true);
panel_set_runtime_flag_recursive(panel, PANEL_IS_DRAG_DROP, true);