diff options
author | Hans Goudey <h.goudey@me.com> | 2022-11-11 04:14:48 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-11-11 04:41:13 +0300 |
commit | 9465b109af0b70244a36f9e68493e316d9f8b56f (patch) | |
tree | c4d933bf09f8313071556063156538ec3356b24c /source/blender/editors/interface | |
parent | 026d21a225521670c6b5083da9da61227da69e65 (diff) | |
parent | ca1642cd0c5cdf634fe2022c955d93983de95934 (diff) |
Merge branch 'master' into refactor-mesh-position-genericrefactor-mesh-position-generic
Diffstat (limited to 'source/blender/editors/interface')
6 files changed, 32 insertions, 19 deletions
diff --git a/source/blender/editors/interface/interface_drag.cc b/source/blender/editors/interface/interface_drag.cc index 4bf2dac4151..e959986d19e 100644 --- a/source/blender/editors/interface/interface_drag.cc +++ b/source/blender/editors/interface/interface_drag.cc @@ -27,15 +27,14 @@ void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale) } void UI_but_drag_set_asset(uiBut *but, - const AssetHandle *asset, + const AssetHandle *asset_handle, const char *path, - struct AssetMetaData *metadata, int import_type, int icon, struct ImBuf *imb, float scale) { - wmDragAsset *asset_drag = WM_drag_create_asset_data(asset, metadata, path, import_type); + wmDragAsset *asset_drag = WM_drag_create_asset_data(asset_handle, path, import_type); /* FIXME: This is temporary evil solution to get scene/view-layer/etc in the copy callback of the * #wmDropBox. diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 9a4f98ebcd6..a5e2cd02f3b 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1309,8 +1309,8 @@ static void ui_id_preview_image_render_size( const bContext *C, Scene *scene, ID *id, PreviewImage *pi, int size, const bool use_job); static void ui_studiolight_icon_job_exec(void *customdata, - short *UNUSED(stop), - short *UNUSED(do_update), + bool *UNUSED(stop), + bool *UNUSED(do_update), float *UNUSED(progress)) { Icon **tmp = (Icon **)customdata; diff --git a/source/blender/editors/interface/interface_panel.cc b/source/blender/editors/interface/interface_panel.cc index 24d8281aad8..05b6ecf29d5 100644 --- a/source/blender/editors/interface/interface_panel.cc +++ b/source/blender/editors/interface/interface_panel.cc @@ -2026,7 +2026,7 @@ static void ui_panel_drag_collapse_handler_add(const bContext *C, const bool was ui_panel_drag_collapse_handler, ui_panel_drag_collapse_handler_remove, dragcol_data, - 0); + eWM_EventHandlerFlag(0)); } /** @@ -2510,8 +2510,12 @@ static void panel_handle_data_ensure(const bContext *C, { if (panel->activedata == nullptr) { panel->activedata = MEM_callocN(sizeof(uiHandlePanelData), __func__); - WM_event_add_ui_handler( - C, &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, panel, 0); + WM_event_add_ui_handler(C, + &win->modalhandlers, + ui_handler_panel, + ui_handler_remove_panel, + panel, + eWM_EventHandlerFlag(0)); } uiHandlePanelData *data = static_cast<uiHandlePanelData *>(panel->activedata); diff --git a/source/blender/editors/interface/interface_region_menu_popup.cc b/source/blender/editors/interface/interface_region_menu_popup.cc index 871fd5c6166..8fd6731d2ec 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.cc +++ b/source/blender/editors/interface/interface_region_menu_popup.cc @@ -286,13 +286,13 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi int width, height; UI_block_layout_resolve(block, &width, &height); - UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT); + UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_NUMSELECT); if (pup->popup) { int offset[2] = {0, 0}; uiBut *but_activate = nullptr; - UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NUMSELECT); + UI_block_flag_enable(block, UI_BLOCK_LOOP); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); UI_block_direction_set(block, direction); diff --git a/source/blender/editors/interface/interface_template_asset_view.cc b/source/blender/editors/interface/interface_template_asset_view.cc index 11fe653724c..9a3f7800c64 100644 --- a/source/blender/editors/interface/interface_template_asset_view.cc +++ b/source/blender/editors/interface/interface_template_asset_view.cc @@ -57,7 +57,6 @@ static void asset_view_item_but_drag_set(uiBut *but, UI_but_drag_set_asset(but, asset_handle, BLI_strdup(blend_path), - ED_asset_handle_get_metadata(asset_handle), FILE_ASSET_IMPORT_APPEND, ED_asset_handle_get_preview_icon_id(asset_handle), imbuf, diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a3259831c9f..b32aa82ad9e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -3673,13 +3673,9 @@ static void colorband_buttons_layout(uiLayout *layout, row = uiLayoutRow(split, false); uiItemR(row, &ptr, "position", 0, IFACE_("Pos"), ICON_NONE); - bt = block->buttons.last; - UI_but_func_set(bt, colorband_update_cb, bt, coba); row = uiLayoutRow(layout, false); uiItemR(row, &ptr, "color", 0, "", ICON_NONE); - bt = block->buttons.last; - UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL); } else { split = uiLayoutSplit(layout, 0.5f, false); @@ -3704,13 +3700,28 @@ static void colorband_buttons_layout(uiLayout *layout, row = uiLayoutRow(subsplit, false); uiItemR(row, &ptr, "position", UI_ITEM_R_SLIDER, IFACE_("Pos"), ICON_NONE); - bt = block->buttons.last; - UI_but_func_set(bt, colorband_update_cb, bt, coba); row = uiLayoutRow(split, false); uiItemR(row, &ptr, "color", 0, "", ICON_NONE); - bt = block->buttons.last; - UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL); + } + + /* Some special (rather awkward) treatment to update UI state on certain property changes. */ + LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) { + if (but->rnapoin.data != ptr.data) { + continue; + } + if (!but->rnaprop) { + continue; + } + + const char *prop_identifier = RNA_property_identifier(but->rnaprop); + if (STREQ(prop_identifier, "position")) { + UI_but_func_set(but, colorband_update_cb, but, coba); + } + + if (STREQ(prop_identifier, "color")) { + UI_but_funcN_set(but, rna_update_cb, MEM_dupallocN(cb), NULL); + } } } } |