Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / util / undo.c
index f5830e451e3abccf1f7e2b63f1f86f99319e167f..ff328a28ee9b7538c045024dc4f4fe65723a3fc7 100644 (file)
@@ -335,6 +335,12 @@ static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op))
        return ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 }
 
+static int ed_undo_redo_poll(bContext *C)
+{
+       wmOperator *last_op = WM_operator_last_redo(C);
+       return last_op && ED_operator_screenactive(C) && 
+               WM_operator_check_ui_enabled(C, last_op->type->name);
+}
 
 /* ********************** */
 
@@ -386,7 +392,7 @@ void ED_OT_undo_redo(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec = ed_undo_redo_exec;
-       ot->poll = ED_operator_screenactive;
+       ot->poll = ed_undo_redo_poll;
 }
 
 /* ui callbacks should call this rather than calling WM_operator_repeat() themselves */