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>2011-12-11 23:23:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-11 23:23:02 +0400
commitc280002879174e3f0fe5eb91501cfa0cc407358f (patch)
tree1211a97b48104077fb6ab0c96f571e4b4c84e292
parent4b66bd37485fe629d58cb66e582e21038ac99427 (diff)
fix [#29579] Redo brolken when jobs are running
changes * undo now checks screen jobs only, was checking all jobs before so a material preview could make an undo fail. now this is only limiteds for render/fluid bake/bake. * the redo UI is now disabled when screen operators run.
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c3
-rw-r--r--source/blender/editors/util/undo.c17
-rw-r--r--source/blender/windowmanager/WM_api.h1
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c11
5 files changed, 29 insertions, 6 deletions
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index fe09c5cd829..941c12df4aa 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -212,6 +212,7 @@ static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOp
}
}
+/* TODO de-duplicate redo panel functions - campbell */
static void clip_panel_operator_redo(const bContext *C, Panel *pa)
{
wmOperator *op= WM_operator_last_redo(C);
@@ -224,7 +225,7 @@ static void clip_panel_operator_redo(const bContext *C, Panel *pa)
block= uiLayoutGetBlock(pa->layout);
- if(ED_undo_valid(C, op->type->name)==0)
+ if (!WM_operator_check_ui_enabled(C, op->type->name))
uiLayoutSetEnabled(pa->layout, 0);
/* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 5d65202d7df..49b1b3f723e 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -96,6 +96,7 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm
}
}
+/* TODO de-duplicate redo panel functions - campbell */
static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
{
wmOperator *op= WM_operator_last_redo(C);
@@ -108,7 +109,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
block= uiLayoutGetBlock(pa->layout);
- if(ED_undo_valid(C, op->type->name)==0)
+ if (!WM_operator_check_ui_enabled(C, op->type->name))
uiLayoutSetEnabled(pa->layout, 0);
/* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index f0055bd6008..3ec99ca7508 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -126,8 +126,8 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
ScrArea *sa= CTX_wm_area(C);
/* undo during jobs are running can easily lead to freeing data using by jobs,
- or they can just lead to freezing job in some other cases */
- if(WM_jobs_has_running(CTX_wm_manager(C))) {
+ * or they can just lead to freezing job in some other cases */
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
return OPERATOR_CANCELLED;
}
@@ -341,13 +341,24 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
int ret= 0;
if(op) {
+ wmWindowManager *wm= CTX_wm_manager(C);
+ struct Scene *scene= CTX_data_scene(C);
+
ARegion *ar= CTX_wm_region(C);
ARegion *ar1= BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
if(ar1)
CTX_wm_region_set(C, ar1);
- if(WM_operator_repeat_check(C, op) && WM_operator_poll(C, op->type)) {
+ if ( (WM_operator_repeat_check(C, op)) &&
+ (WM_operator_poll(C, op->type)) &&
+ /* note, undo/redo cant run if there are jobs active,
+ * check for screen jobs only so jobs like material/texture/world preview
+ * (which copy their data), wont stop redo, see [#29579]],
+ *
+ * note, - WM_operator_check_ui_enabled() jobs test _must_ stay in sync with this */
+ (WM_jobs_test(wm, scene) == 0))
+ {
int retval;
if (G.f & G_DEBUG)
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 2c0e22337c0..5bd95ac2106 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -206,6 +206,7 @@ void WM_operator_properties_gesture_border(struct wmOperatorType *ot, int exten
void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor);
void WM_operator_properties_select_all(struct wmOperatorType *ot);
+int WM_operator_check_ui_enabled(const struct bContext *C, const char *idname);
wmOperator *WM_operator_last_redo(const struct bContext *C);
/* MOVE THIS SOMEWHERE ELSE */
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index fa6521b3ec0..31d276fee01 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -907,6 +907,15 @@ int WM_operator_winactive(bContext *C)
return 1;
}
+/* return FALSE, if the UI should be disabled */
+int WM_operator_check_ui_enabled(const bContext *C, const char *idname)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ Scene *scene= CTX_data_scene(C);
+
+ return !(ED_undo_valid(C, idname)==0 || WM_jobs_test(wm, scene));
+}
+
wmOperator *WM_operator_last_redo(const bContext *C)
{
wmWindowManager *wm= CTX_wm_manager(C);
@@ -940,7 +949,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, arg_op);
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, style);
- if(ED_undo_valid(C, op->type->name)==0)
+ if (!WM_operator_check_ui_enabled(C, op->type->name))
uiLayoutSetEnabled(layout, 0);
if(op->type->flag & OPTYPE_MACRO) {