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:
authorCampbell Barton <ideasman42@gmail.com>2019-01-18 04:07:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-18 04:08:45 +0300
commit3c2126c6f11d4f1d912afb1ccfdab213255f39af (patch)
tree62c88d50c759bb4b07f09f24414ca635af0a622b /source/blender/editors/interface/interface_region_color_picker.c
parenta3f312dcd138e0e8404598f5d104d75bc439d7b8 (diff)
Fix eye-dropper causing undo push w/o any changes
Happened when accessing the eyedropper from a popup.
Diffstat (limited to 'source/blender/editors/interface/interface_region_color_picker.c')
-rw-r--r--source/blender/editors/interface/interface_region_color_picker.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c
index e91b775b261..59a723c7b90 100644
--- a/source/blender/editors/interface/interface_region_color_picker.c
+++ b/source/blender/editors/interface/interface_region_color_picker.c
@@ -301,8 +301,13 @@ static void ui_popup_close_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
uiBut *but = (uiBut *)bt1;
uiPopupBlockHandle *popup = but->block->handle;
- if (popup)
- popup->menuretval = UI_RETURN_OK;
+ if (popup) {
+ ColorPicker *cpicker = but->custom_data;
+ BLI_assert(cpicker->is_init);
+ popup->menuretval = (
+ equals_v3v3(cpicker->color_data, cpicker->color_data_init) ?
+ UI_RETURN_CANCEL : UI_RETURN_OK);
+ }
}
static void ui_colorpicker_hide_reveal(uiBlock *block, short colormode)
@@ -420,6 +425,10 @@ static void ui_block_colorpicker(
copy_v3_v3(rgb_perceptual, rgba);
ui_scene_linear_to_color_picker_space(from_but, rgb_perceptual);
ui_rgb_to_color_picker_v(rgb_perceptual, hsv);
+ if (cpicker->is_init == false) {
+ copy_v3_v3(cpicker->color_data_init, cpicker->color_data);
+ cpicker->is_init = true;
+ }
/* when the softmax isn't defined in the RNA,
* using very large numbers causes sRGB/linear round trip to fail. */