diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-11-12 01:18:46 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-11-12 01:18:46 +0300 |
commit | c29795452cc71cb9f5a571a4aff0f593a2d7acaf (patch) | |
tree | 53a46bb77f3102c545f7e55d3344e310b3bf6116 /source/blender/editors/interface | |
parent | 9980fd0b8e1f3a07060316f28469f55a3f2fc0cd (diff) | |
parent | 03ccf37162d365f3fdc8d8cd0cd6e9ff314fec6e (diff) |
Merge branch 'master' into temp-sculpt-roll-mappingtemp-sculpt-roll-mapping
Diffstat (limited to 'source/blender/editors/interface')
7 files changed, 38 insertions, 33 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_ops.cc b/source/blender/editors/interface/interface_ops.cc index 2d06dd2c465..1b576583291 100644 --- a/source/blender/editors/interface/interface_ops.cc +++ b/source/blender/editors/interface/interface_ops.cc @@ -1165,7 +1165,7 @@ bool UI_context_copy_to_selected_list(bContext *C, if (RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) { bNodeTree *ntree = (bNodeTree *)ptr->owner_id; bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data); - if (nodeFindNode(ntree, sock, &node, nullptr)) { + if (nodeFindNodeTry(ntree, sock, &node, nullptr)) { if ((path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Node)) != nullptr) { /* we're good! */ } diff --git a/source/blender/editors/interface/interface_region_color_picker.cc b/source/blender/editors/interface/interface_region_color_picker.cc index 0b2c538331a..8b28e9fece1 100644 --- a/source/blender/editors/interface/interface_region_color_picker.cc +++ b/source/blender/editors/interface/interface_region_color_picker.cc @@ -199,7 +199,7 @@ static void ui_update_color_picker_buts_rgb(uiBut *from_but, * push, so disable it on RNA buttons in the color picker block */ UI_but_flag_disable(bt, UI_BUT_UNDO); } - else if (STREQ(bt->str, "Hex: ")) { + else if (STREQ(bt->str, "Hex:")) { float rgb_hex[3]; uchar rgb_hex_uchar[3]; char col[16]; @@ -613,7 +613,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, - IFACE_("R:"), + IFACE_("Red:"), 0, yco, butwidth, @@ -623,7 +623,7 @@ static void ui_block_colorpicker(uiBlock *block, 0, 0.0, 0.0, - 0, + 10, 3, TIP_("Red")); UI_but_func_set(bt, ui_colorpicker_rgba_update_cb, bt, nullptr); @@ -631,7 +631,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, - IFACE_("G:"), + IFACE_("Green:"), 0, yco -= UI_UNIT_Y, butwidth, @@ -641,7 +641,7 @@ static void ui_block_colorpicker(uiBlock *block, 1, 0.0, 0.0, - 0, + 10, 3, TIP_("Green")); UI_but_func_set(bt, ui_colorpicker_rgba_update_cb, bt, nullptr); @@ -649,7 +649,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, - IFACE_("B:"), + IFACE_("Blue:"), 0, yco -= UI_UNIT_Y, butwidth, @@ -659,7 +659,7 @@ static void ui_block_colorpicker(uiBlock *block, 2, 0.0, 0.0, - 0, + 10, 3, TIP_("Blue")); UI_but_func_set(bt, ui_colorpicker_rgba_update_cb, bt, nullptr); @@ -675,7 +675,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefButF(block, UI_BTYPE_NUM_SLIDER, 0, - IFACE_("H:"), + IFACE_("Hue:"), 0, yco, butwidth, @@ -692,7 +692,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefButF(block, UI_BTYPE_NUM_SLIDER, 0, - IFACE_("S:"), + IFACE_("Saturation:"), 0, yco -= UI_UNIT_Y, butwidth, @@ -710,7 +710,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefButF(block, UI_BTYPE_NUM_SLIDER, 0, - IFACE_("L:"), + IFACE_("Lightness:"), 0, yco -= UI_UNIT_Y, butwidth, @@ -726,7 +726,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefButF(block, UI_BTYPE_NUM_SLIDER, 0, - IFACE_("V:"), + IFACE_("Value:"), 0, yco -= UI_UNIT_Y, butwidth, @@ -750,7 +750,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, - IFACE_("A: "), + IFACE_("Alpha:"), 0, yco -= UI_UNIT_Y, butwidth, @@ -760,7 +760,7 @@ static void ui_block_colorpicker(uiBlock *block, 3, 0.0, 0.0, - 0, + 10, 3, TIP_("Alpha")); UI_but_func_set(bt, ui_colorpicker_rgba_update_cb, bt, nullptr); @@ -788,7 +788,7 @@ static void ui_block_colorpicker(uiBlock *block, bt = uiDefBut(block, UI_BTYPE_TEXT, 0, - IFACE_("Hex: "), + IFACE_("Hex:"), 0, yco, butwidth, 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); + } } } } diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.cc b/source/blender/editors/interface/view2d_gizmo_navigate.cc index 78549a33fc5..f754b2ab088 100644 --- a/source/blender/editors/interface/view2d_gizmo_navigate.cc +++ b/source/blender/editors/interface/view2d_gizmo_navigate.cc @@ -110,7 +110,6 @@ struct NavigateWidgetGroup { struct { rcti rect_visible; } state; - int region_size[2]; }; static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType * /*gzgt*/) @@ -145,9 +144,6 @@ static void WIDGETGROUP_navigate_setup(const bContext * /*C*/, wmGizmoGroup *gzg { NavigateWidgetGroup *navgroup = MEM_cnew<NavigateWidgetGroup>(__func__); - navgroup->region_size[0] = -1; - navgroup->region_size[1] = -1; - const struct NavigateGizmoInfo *navigate_params = navigate_params_from_space_type( gzgroup->type->gzmap_params.spaceid); |