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:
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index c54d738822f..5ebca6842b1 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -417,6 +417,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *even
return OPERATOR_RUNNING_MODAL;
}
+/* function used for WM_OT_save_mainfile too */
static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
{
char filename[FILE_MAX];
@@ -431,7 +432,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
static void WM_OT_save_as_mainfile(wmOperatorType *ot)
{
- ot->name= "Open Blender File";
+ ot->name= "Save As Blender File";
ot->idname= "WM_OT_save_as_mainfile";
ot->invoke= wm_save_as_mainfile_invoke;
@@ -444,6 +445,33 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
}
+/* *************** Save file directly ******** */
+
+static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+
+ RNA_string_set(op->ptr, "filename", G.sce);
+ uiPupMenuSaveOver(C, op, G.sce);
+
+ return OPERATOR_RUNNING_MODAL;
+}
+
+static void WM_OT_save_mainfile(wmOperatorType *ot)
+{
+ ot->name= "Save Blender File";
+ ot->idname= "WM_OT_save_mainfile";
+
+ ot->invoke= wm_save_mainfile_invoke;
+ ot->exec= wm_save_as_mainfile_exec;
+ ot->poll= WM_operator_winactive;
+
+ ot->flag= 0;
+
+ RNA_def_property(ot->srna, "filename", PROP_STRING, PROP_FILEPATH);
+
+}
+
+
/* *********************** */
static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
@@ -1192,6 +1220,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_open_mainfile);
WM_operatortype_append(WM_OT_jobs_timer);
WM_operatortype_append(WM_OT_save_as_mainfile);
+ WM_operatortype_append(WM_OT_save_mainfile);
}
/* default keymap for windows and screens, only call once per WM */
@@ -1208,6 +1237,7 @@ void wm_window_keymap(wmWindowManager *wm)
WM_keymap_verify_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_open_recentfile", OKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_save_as_mainfile", F2KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0);