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-17 08:39:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-17 08:39:38 +0300
commitc8e75c2b00cfb7e87bcb800c9acc8f126949749d (patch)
tree30dd08449c059cdc72d37b10359350b20c328860 /source/blender/editors/interface/interface_eyedropper_driver.c
parent4a3aac478ce0dd16faea52d224d9a8024cd9ee57 (diff)
Fix T60554: Missing undo push changing color
Operators don't have a good way to skip undo, for now check the button undo flag & return cancelled.
Diffstat (limited to 'source/blender/editors/interface/interface_eyedropper_driver.c')
-rw-r--r--source/blender/editors/interface/interface_eyedropper_driver.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c
index 57d63bafc82..c9b29da2e61 100644
--- a/source/blender/editors/interface/interface_eyedropper_driver.c
+++ b/source/blender/editors/interface/interface_eyedropper_driver.c
@@ -64,6 +64,7 @@ typedef struct DriverDropper {
PointerRNA ptr;
PropertyRNA *prop;
int index;
+ bool is_undo;
// TODO: new target?
} DriverDropper;
@@ -85,6 +86,8 @@ static bool driverdropper_init(bContext *C, wmOperator *op)
}
op->customdata = ddr;
+ ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
+
return true;
}
@@ -153,18 +156,24 @@ static void driverdropper_cancel(bContext *C, wmOperator *op)
/* main modal status check */
static int driverdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
+ DriverDropper *ddr = op->customdata;
+
/* handle modal keymap */
if (event->type == EVT_MODAL_MAP) {
switch (event->val) {
case EYE_MODAL_CANCEL:
+ {
driverdropper_cancel(C, op);
return OPERATOR_CANCELLED;
-
+ }
case EYE_MODAL_SAMPLE_CONFIRM:
+ {
+ const bool is_undo = ddr->is_undo;
driverdropper_sample(C, op, event);
driverdropper_exit(C, op);
-
- return OPERATOR_FINISHED;
+ /* Could support finished & undo-skip. */
+ return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ }
}
}
@@ -224,7 +233,7 @@ void UI_OT_eyedropper_driver(wmOperatorType *ot)
ot->poll = driverdropper_poll;
/* flags */
- ot->flag = OPTYPE_BLOCKING | OPTYPE_INTERNAL | OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_INTERNAL;
/* properties */
RNA_def_enum(ot->srna, "mapping_type", prop_driver_create_mapping_types, 0,