diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-13 01:01:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-13 01:01:39 +0400 |
commit | 8115753fd280c4e23f9d86508184ed057a9a2099 (patch) | |
tree | a68a1b0d219f3521a41a23ed1f358a530b388978 /source/blender/editors | |
parent | 80da50270dfd4c330302813aa3a92240a9361865 (diff) | |
parent | 01478a3743f1d1fe3d641ff498953af027ca2e60 (diff) |
svn merge ^/trunk/blender -r42564:42586
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/keyingsets.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 15 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 20 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_tools.c | 7 | ||||
-rw-r--r-- | source/blender/editors/object/object_hook.c | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_toolbar.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_toolbar.c | 3 | ||||
-rw-r--r-- | source/blender/editors/util/undo.c | 17 |
11 files changed, 56 insertions, 33 deletions
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 3b65e777200..682b40affc2 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -798,7 +798,7 @@ void ANIM_keying_sets_menu_setup (bContext *C, const char title[], const char op for (ks= builtin_keyingsets.first; ks; ks=ks->next, i--) { /* only show KeyingSet if context is suitable */ if (ANIM_keyingset_context_ok_poll(C, ks)) - uiItemEnumO_value(layout, ks->name, ICON_NONE, op_name, "type", i); + uiItemIntO(layout, ks->name, ICON_NONE, op_name, "type", i); } uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index aee23626787..6ebfddff5c1 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5492,6 +5492,11 @@ wmOperator *uiContextActiveOperator(const struct bContext *C) ARegion *ar_ctx= CTX_wm_region(C); uiBlock *block; + /* background mode */ + if (ar_ctx == NULL) { + return NULL; + } + /* scan active regions ui */ for(block=ar_ctx->uiblocks.first; block; block=block->next) { if (block->ui_operator) { diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 2a75c2a26c1..b50df29918d 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -458,11 +458,16 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op)) * - otherwise, up to info (which is what users normally see) */ str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO); - - write_text(txt, str); - MEM_freeN(str); - - return OPERATOR_FINISHED; + + if (str) { + write_text(txt, str); + MEM_freeN(str); + + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } static void UI_OT_reports_to_textblock(wmOperatorType *ot) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 58c3c0130b8..b89a80bb0d7 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2481,22 +2481,14 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...) va_end(ap); } +/* note, only call this is the file exists, + * the case where the file does not exist so can be saved without a + * popup must be checked for already, since saving from here + * will free the operator which will break invoke(). + * The operator state for this is implicitly OPERATOR_RUNNING_MODAL */ void uiPupMenuSaveOver(bContext *C, wmOperator *op, const char *filename) { - size_t len= strlen(filename); - - if(len==0) - return; - - if(filename[len-1]=='/' || filename[len-1]=='\\') { - uiPupMenuError(C, "Cannot overwrite a directory"); - WM_operator_free(op); - return; - } - if(BLI_exists(filename)==0) - operator_cb(C, op, 1); - else - confirm_operator(C, op, "Save Over", filename); + confirm_operator(C, op, "Save Over", filename); } void uiPupMenuNotice(bContext *C, const char *str, ...) diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index c690d775946..6a01e1fc303 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -2778,10 +2778,11 @@ static int select_axis_exec(bContext *C, wmOperator *op) int axis= RNA_enum_get(op->ptr, "axis"); int mode= RNA_enum_get(op->ptr, "mode"); /* -1==aligned, 0==neg, 1==pos*/ - if(ese==NULL) + if (ese==NULL || ese->htype != BM_VERT) { + BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)"); return OPERATOR_CANCELLED; - - if (ese->htype==BM_VERT) { + } + else { BMVert *ev, *act_vert= (BMVert*)ese->data; BMIter iter; float value= act_vert->co[axis]; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index b87cbcb9d3b..082332fc3b0 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -612,7 +612,9 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot) ot->poll= hook_op_edit_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + /* this operator removes modifier which isn't stored in local undo stack, + so redoing it from redo panel gives totally weird results */ + ot->flag= /*OPTYPE_REGISTER|*/OPTYPE_UNDO; /* properties */ prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove"); @@ -799,7 +801,9 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot) ot->poll= hook_op_edit_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + /* this operator changes data stored in modifier which doesn't get pushed to undo stack, + so redoing it from redo panel gives totally weird results */ + ot->flag= /*OPTYPE_REGISTER|*/OPTYPE_UNDO; /* properties */ prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to"); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 04ae926ee06..3109669602d 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1843,10 +1843,13 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ /* for switching to/from mode */ static int paint_poll_test(bContext *C) { + Object *ob= CTX_data_active_object(C); if(CTX_data_edit_object(C)) return 0; if(CTX_data_active_object(C)==NULL) return 0; + if(!ob->data || ((ID *)ob->data)->lib) + return 0; return 1; } 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_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 69c192b077b..daa2031bb5f 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -715,7 +715,7 @@ int file_draw_check_exists(SpaceFile *sfile) if(RNA_boolean_get(sfile->op->ptr, "check_existing")) { char filepath[FILE_MAX]; BLI_join_dirfile(filepath, sizeof(filepath), sfile->params->dir, sfile->params->file); - if(BLI_exists(filepath) && !BLI_is_dir(filepath)) { + if(BLI_is_file(filepath)) { return TRUE; } } @@ -1143,8 +1143,8 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) BLI_dir_create_recursive(sfile->params->dir); } - /* special case, user may have pasted a fulepath into the directory */ - if(BLI_exists(sfile->params->dir) && BLI_is_dir(sfile->params->dir) == 0) { + /* special case, user may have pasted a filepath into the directory */ + if(BLI_is_file(sfile->params->dir)) { char path[sizeof(sfile->params->dir)]; BLI_strncpy(path, sfile->params->dir, sizeof(path)); BLI_split_dirfile(path, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index d226815a1de..cb6a53c67eb 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 996fab59762..be596a9a4a9 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -141,8 +141,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; } @@ -356,13 +356,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) |