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 | |
parent | 80da50270dfd4c330302813aa3a92240a9361865 (diff) | |
parent | 01478a3743f1d1fe3d641ff498953af027ca2e60 (diff) |
svn merge ^/trunk/blender -r42564:42586
23 files changed, 129 insertions, 60 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index 4173d71b39c..98a3c81d65a 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -54,7 +54,7 @@ def abspath(path, start=None, library=None): """ if path.startswith("//"): if library: - start = abspath(_os.path.dirname(library.filepath)) + start = _os.path.dirname(abspath(library.filepath)) return _os.path.join(_os.path.dirname(_bpy.data.filepath) if start is None else start, path[2:], diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index e1d33198142..01103aede0d 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -38,7 +38,7 @@ class ANIM_OT_keying_set_export(Operator): bl_label = "Export Keying Set..." filepath = StringProperty( - name="File Path", + subtype='FILE_PATH', ) filter_folder = BoolProperty( name="Filter folders", diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 11d545849ef..061c66dc1fa 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -413,7 +413,12 @@ class CLIP_OT_setup_tracking_scene(Operator): @staticmethod def _setupCamera(context): + sc = context.space_data + clip = sc.clip + tracking = clip.tracking + camob = CLIP_OT_setup_tracking_scene._findOrCreateCamera(context) + cam = camob.data # Remove all constraints to be sure motion is fine camob.constraints.clear() @@ -423,6 +428,9 @@ class CLIP_OT_setup_tracking_scene(Operator): con.use_active_clip = True con.influence = 1.0 + cam.sensor_width = tracking.camera.sensor_width + cam.lens = tracking.camera.focal_length + @staticmethod def _setupViewport(context): sc = context.space_data diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py index c97f6eae6c7..55ad8a77d43 100644 --- a/release/scripts/startup/bl_operators/image.py +++ b/release/scripts/startup/bl_operators/image.py @@ -30,9 +30,7 @@ class EditExternally(Operator): bl_options = {'REGISTER'} filepath = StringProperty( - name="File Path", - description="Path to an image file", - maxlen=1024, + subtype='FILE_PATH', ) def _editor_guess(self, context): diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 89029e3af01..1da5e2ca381 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -748,8 +748,6 @@ class WM_OT_path_open(Operator): bl_label = "" filepath = StringProperty( - name="File Path", - maxlen=1024, subtype='FILE_PATH', ) @@ -1085,8 +1083,7 @@ class WM_OT_keyconfig_activate(Operator): bl_label = "Activate Keyconfig" filepath = StringProperty( - name="File Path", - maxlen=1024, + subtype='FILE_PATH', ) def execute(self, context): @@ -1116,8 +1113,7 @@ class WM_OT_appconfig_activate(Operator): bl_label = "Activate Application Configuration" filepath = StringProperty( - name="File Path", - maxlen=1024, + subtype='FILE_PATH', ) def execute(self, context): @@ -1203,8 +1199,7 @@ class WM_OT_keyconfig_import(Operator): bl_label = "Import Key Configuration..." filepath = StringProperty( - name="File Path", - description="Filepath to write file to", + subtype='FILE_PATH', default="keymap.py", ) filter_folder = BoolProperty( @@ -1270,8 +1265,7 @@ class WM_OT_keyconfig_export(Operator): bl_label = "Export Key Configuration..." filepath = StringProperty( - name="File Path", - description="Filepath to write file to", + subtype='FILE_PATH', default="keymap.py", ) filter_folder = BoolProperty( @@ -1513,8 +1507,7 @@ class WM_OT_addon_install(Operator): ) filepath = StringProperty( - name="File Path", - description="File path to write file to", + subtype='FILE_PATH', ) filter_folder = BoolProperty( name="Filter folders", diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 712429716a6..2e8f1a5512e 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -56,6 +56,7 @@ int BLI_create_symlink(const char *path, const char *to); struct direntry; int BLI_is_dir(const char *path); +int BLI_is_file(const char *path); void BLI_dir_create_recursive(const char *dir); double BLI_dir_free_space(const char *dir); char *BLI_current_working_dir(char *dir, const int maxlen); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 1ef254d355f..001b191155d 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -471,6 +471,12 @@ int BLI_is_dir(const char *file) return S_ISDIR(BLI_exists(file)); } +int BLI_is_file(const char *path) +{ + int mode= BLI_exists(path); + return (mode && !S_ISDIR(mode)); +} + LinkNode *BLI_file_read_as_lines(const char *name) { FILE *fp= fopen(name, "r"); 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) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a31984dfc29..02b1fa300fb 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -469,7 +469,7 @@ static const char *rna_ensure_property_description(PropertyRNA *prop) } #ifdef WITH_INTERNATIONAL - if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS)) + if(description && (U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS)) description= BLF_gettext(description); #endif diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 392aa6a7f5a..612c34d1c92 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -1404,7 +1404,7 @@ static void rna_def_scene_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Scene", ""); + RNA_def_property_ui_text(prop, "Mode", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); //XXX filter only camera objects diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 2c0e22337c0..61c3da36203 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -191,6 +191,7 @@ struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType * int WM_operator_poll (struct bContext *C, struct wmOperatorType *ot); int WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, int context); int WM_operator_call (struct bContext *C, struct wmOperator *op); +int WM_operator_call_notest(struct bContext *C, struct wmOperator *op); int WM_operator_repeat (struct bContext *C, struct wmOperator *op); int WM_operator_repeat_check(const struct bContext *C, struct wmOperator *op); int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties); @@ -206,6 +207,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_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 9d8f68115cf..1593f14a76c 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -597,12 +597,36 @@ static int wm_operator_exec(bContext *C, wmOperator *op, int repeat) } -/* for running operators with frozen context (modal handlers, menus) */ +/* simply calls exec with basic checks */ +static int wm_operator_exec_notest(bContext *C, wmOperator *op) +{ + int retval= OPERATOR_CANCELLED; + + if(op==NULL || op->type==NULL || op->type->exec==NULL) + return retval; + + retval= op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + + return retval; +} + +/* for running operators with frozen context (modal handlers, menus) + * + * warning: do not use this within an operator to call its self! [#29537] */ int WM_operator_call(bContext *C, wmOperator *op) { return wm_operator_exec(C, op, 0); } +/* this is intended to be used when an invoke operator wants to call exec on its self + * and is basically like running op->type->exec() directly, no poll checks no freeing, + * since we assume whoever called invokle will take care of that */ +int WM_operator_call_notest(bContext *C, wmOperator *op) +{ + return wm_operator_exec_notest(C, op); +} + /* do this operator again, put here so it can share above code */ int WM_operator_repeat(bContext *C, wmOperator *op) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index fa6521b3ec0..004b71307df 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -802,7 +802,7 @@ int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (RNA_property_is_set(op->ptr, "filepath")) { - return WM_operator_call(C, op); + return WM_operator_call_notest(C, op); /* call exec direct */ } else { WM_event_add_fileselect(C, op); @@ -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) { @@ -1628,7 +1637,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(RNA_property_is_set(op->ptr, "filepath")) { - return WM_operator_call(C, op); + return WM_operator_call_notest(C, op); } else { /* XXX TODO solve where to get last linked library from */ @@ -1994,6 +2003,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED( { char name[FILE_MAX]; int check_existing=1; + int ret; /* cancel if no active window */ if (CTX_wm_window(C) == NULL) @@ -2018,16 +2028,20 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED( check_existing = 0; if (G.save_over) { - if (check_existing) + if (check_existing && BLI_exists(name)) { uiPupMenuSaveOver(C, op, name); + ret= OPERATOR_RUNNING_MODAL; + } else { - wm_save_as_mainfile_exec(C, op); + ret= wm_save_as_mainfile_exec(C, op); } - } else { + } + else { WM_event_add_fileselect(C, op); + ret= OPERATOR_RUNNING_MODAL; } - return OPERATOR_RUNNING_MODAL; + return ret; } static void WM_OT_save_mainfile(wmOperatorType *ot) |