2.5: Top Menu
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 23 Jul 2009 21:35:11 +0000 (21:35 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 23 Jul 2009 21:35:11 +0000 (21:35 +0000)
* Clean up File menu, added back recover last session op.
* .blend compress now behaves a bit different, previously
  it would only respect the user preference. Now it saves
  existing files the same way they are saved, and new files
  following the user preference. The save operator has a
  Compress toggle in the file browser left panels now.

* Add menu working again, some fixes to make these operators
  work outside the 3d view were needed.
* Timeline menu removed, its contents will be moved to the
  timeline header menus.
* Game menu can now start game, changed the start game op
  to choose another 3d view if none is available.
* Render menu has a few items now.
* Help menu contains a few links again.

release/ui/space_info.py
source/blender/editors/curve/editcurve.c
source/blender/editors/object/object_edit.c
source/blender/editors/screen/screen_context.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp

index 55ce80e857fa5700242a1de996e1311b66a65587..96494ccdb143f5cf98a446c17443c5ee55003985 100644 (file)
@@ -7,6 +7,7 @@ class INFO_HT_header(bpy.types.Header):
 
        def draw(self, context):
                st = context.space_data
+               rd = context.scene.render_data
                layout = self.layout
                
                layout.template_header()
@@ -15,7 +16,6 @@ class INFO_HT_header(bpy.types.Header):
                        row = layout.row()
                        row.itemM("INFO_MT_file")
                        row.itemM("INFO_MT_add")
-                       row.itemM("INFO_MT_timeline")
                        row.itemM("INFO_MT_game")
                        row.itemM("INFO_MT_render")
                        row.itemM("INFO_MT_help")
@@ -36,21 +36,49 @@ class INFO_MT_file(bpy.types.Menu):
                layout = self.layout
 
                layout.operator_context = "EXEC_AREA"
-               layout.itemO("wm.read_homefile")
+               layout.itemO("wm.read_homefile", text="New")
                layout.operator_context = "INVOKE_AREA"
-               layout.itemO("wm.open_mainfile")
+               layout.itemO("wm.open_mainfile", text="Open...")
+               layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent")
+               layout.itemO("wm.recover_last_session")
 
                layout.itemS()
 
                layout.operator_context = "EXEC_AREA"
-               layout.itemO("wm.save_mainfile")
+               layout.itemO("wm.save_mainfile", text="Save")
                layout.operator_context = "INVOKE_AREA"
-               layout.itemO("wm.save_as_mainfile")
+               layout.itemO("wm.save_as_mainfile", text="Save As...")
+
+               layout.itemS()
+
+               layout.itemM("INFO_MT_file_import")
+               layout.itemM("INFO_MT_file_export")
 
                layout.itemS()
 
                layout.itemM("INFO_MT_file_external_data")
 
+               layout.itemS()
+
+               layout.operator_context = "EXEC_AREA"
+               layout.itemO("wm.exit_blender", text="Quit")
+
+class INFO_MT_file_import(bpy.types.Menu):
+       __space_type__ = "USER_PREFERENCES"
+       __label__ = "Import"
+
+       def draw(self, context):
+               layout = self.layout
+
+class INFO_MT_file_export(bpy.types.Menu):
+       __space_type__ = "USER_PREFERENCES"
+       __label__ = "Export"
+
+       def draw(self, context):
+               layout = self.layout
+
+               layout.itemO("export.ply", text="PLY")
+
 class INFO_MT_file_external_data(bpy.types.Menu):
        __space_type__ = "USER_PREFERENCES"
        __label__ = "External Data"
@@ -74,15 +102,25 @@ class INFO_MT_add(bpy.types.Menu):
 
        def draw(self, context):
                layout = self.layout
-               layout.itemL(text="Nothing yet")
 
-class INFO_MT_timeline(bpy.types.Menu):
-       __space_type__ = "USER_PREFERENCES"
-       __label__ = "Timeline"
+               layout.operator_context = "EXEC_SCREEN"
 
-       def draw(self, context):
-               layout = self.layout
-               layout.itemL(text="Nothing yet")
+               layout.item_menu_enumO( "OBJECT_OT_mesh_add", "type", text="Mesh", icon="ICON_OUTLINER_OB_MESH")
+               layout.item_menu_enumO( "OBJECT_OT_curve_add", "type", text="Curve", icon="ICON_OUTLINER_OB_CURVE")
+               layout.item_menu_enumO( "OBJECT_OT_surface_add", "type", text="Surface", icon="ICON_OUTLINER_OB_SURFACE")
+               layout.item_enumO("OBJECT_OT_object_add", "type", "META", icon="ICON_OUTLINER_OB_META")
+               layout.itemO("OBJECT_OT_text_add", text="Text", icon="ICON_OUTLINER_OB_FONT")
+
+               layout.itemS()
+
+               layout.itemO("OBJECT_OT_armature_add", text="Armature", icon="ICON_OUTLINER_OB_ARMATURE")
+               layout.item_enumO("OBJECT_OT_object_add", "type", "LATTICE", icon="ICON_OUTLINER_OB_LATTICE")
+               layout.item_enumO("OBJECT_OT_object_add", "type", "EMPTY", icon="ICON_OUTLINER_OB_EMPTY")
+
+               layout.itemS()
+
+               layout.item_enumO("OBJECT_OT_object_add", "type", "CAMERA", icon="ICON_OUTLINER_OB_CAMERA")
+               layout.item_enumO("OBJECT_OT_object_add", "type", "LAMP", icon="ICON_OUTLINER_OB_LAMP")
 
 class INFO_MT_game(bpy.types.Menu):
        __space_type__ = "USER_PREFERENCES"
@@ -90,7 +128,8 @@ class INFO_MT_game(bpy.types.Menu):
 
        def draw(self, context):
                layout = self.layout
-               layout.itemL(text="Nothing yet")
+
+               layout.itemO("view3d.game_start")
 
 class INFO_MT_render(bpy.types.Menu):
        __space_type__ = "USER_PREFERENCES"
@@ -98,7 +137,14 @@ class INFO_MT_render(bpy.types.Menu):
 
        def draw(self, context):
                layout = self.layout
-               layout.itemL(text="Nothing yet")
+               rd = context.scene.render_data
+
+               layout.itemO("screen.render", text="Render Image")
+               layout.item_booleanO("screen.render", "animation", True, text="Render Animation")
+
+               layout.itemS()
+
+               layout.itemO("screen.render_view_show")
 
 class INFO_MT_help(bpy.types.Menu):
        __space_type__ = "USER_PREFERENCES"
@@ -106,7 +152,16 @@ class INFO_MT_help(bpy.types.Menu):
 
        def draw(self, context):
                layout = self.layout
-               layout.itemL(text="Nothing yet")
+
+               layout.itemO("help.manual")
+               layout.itemO("help.release_logs")
+
+               layout.itemS()
+
+               layout.itemO("help.blender_website")
+               layout.itemO("help.blender_eshop")
+               layout.itemO("help.developer_community")
+               layout.itemO("help.user_community")
 
 class INFO_PT_tabs(bpy.types.Panel):
        __space_type__ = "USER_PREFERENCES"
@@ -477,12 +532,12 @@ class INFO_PT_bottombar(bpy.types.Panel):
                split.itemL(text="")
                split.itemO("wm.save_homefile", text="Save As Default")
 
-
 bpy.types.register(INFO_HT_header)
 bpy.types.register(INFO_MT_file)
+bpy.types.register(INFO_MT_file_import)
+bpy.types.register(INFO_MT_file_export)
 bpy.types.register(INFO_MT_file_external_data)
 bpy.types.register(INFO_MT_add)
-bpy.types.register(INFO_MT_timeline)
 bpy.types.register(INFO_MT_game)
 bpy.types.register(INFO_MT_render)
 bpy.types.register(INFO_MT_help)
@@ -495,3 +550,57 @@ bpy.types.register(INFO_PT_autosave)
 bpy.types.register(INFO_PT_language)
 bpy.types.register(INFO_PT_bottombar)
 
+# Help operators
+
+import bpy_ops # XXX - should not need to do this
+del bpy_ops
+
+class HelpOperator(bpy.types.Operator):
+       def execute(self, context):
+               try: import webbrowser
+               except: webbrowser = None
+
+               if webbrowser:
+                       webbrowser.open(self.__URL__)
+               else:
+                       raise Exception("Operator requires a full Python installation")
+
+               return ('FINISHED',)
+
+class HELP_OT_manual(HelpOperator):
+       __idname__ = "help.manual"
+       __label__ = "Manual"
+       __URL__ = 'http://wiki.blender.org/index.php/Manual'
+
+class HELP_OT_release_logs(HelpOperator):
+       __idname__ = "help.release_logs"
+       __label__ = "Release Logs"
+       __URL__ = 'http://www.blender.org/development/release-logs/'
+
+class HELP_OT_blender_website(HelpOperator):
+       __idname__ = "help.blender_website"
+       __label__ = "Blender Website"
+       __URL__ = 'http://www.blender.org/'
+
+class HELP_OT_blender_eshop(HelpOperator):
+       __idname__ = "help.blender_eshop"
+       __label__ = "Blender e-Shop"
+       __URL__ = 'http://www.blender3d.org/e-shop'
+
+class HELP_OT_developer_community(HelpOperator):
+       __idname__ = "help.developer_community"
+       __label__ = "Developer Community"
+       __URL__ = 'http://www.blender.org/community/get-involved/'
+
+class HELP_OT_user_community(HelpOperator):
+       __idname__ = "help.user_community"
+       __label__ = "User Community"
+       __URL__ = 'http://www.blender.org/community/user-community/'
+
+bpy.ops.add(HELP_OT_manual)
+bpy.ops.add(HELP_OT_release_logs)
+bpy.ops.add(HELP_OT_blender_website)
+bpy.ops.add(HELP_OT_blender_eshop)
+bpy.ops.add(HELP_OT_developer_community)
+bpy.ops.add(HELP_OT_user_community)
+
index 2bf5d357e5cb70989ec501ecf6ea2d8c4146e6fd..28a9d3ac7c9074b70bf7c8b50e9a9ab9f5df0834 100644 (file)
@@ -4724,11 +4724,13 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname)
                        Mat3MulMat3(cmat, imat, mat);
                        Mat3Inv(imat, cmat);
                }
+               else
+                       Mat3One(imat);
+
                setflagsNurb(editnurb, 0);
        }
-       else {
+       else
                return NULL;
-       }
        
        /* these types call this function to return a Nurb */
        if (stype!=CU_PRIM_TUBE && stype!=CU_PRIM_DONUT) {
index 37453039cf57458f0e1e88e08a72f79fc6ed624c..cf37b0dd81296ac96264d169f26b233447b77240 100644 (file)
@@ -3587,10 +3587,11 @@ void ED_object_enter_editmode(bContext *C, int flag)
        if(scene->id.lib) return;
        if(base==NULL) return;
        
-       if(sa->spacetype==SPACE_VIEW3D)
+       if(sa && sa->spacetype==SPACE_VIEW3D)
                v3d= sa->spacedata.first;
        
-       if((v3d==NULL || (base->lay & v3d->lay))==0) return;
+       if(v3d && (base->lay & v3d->lay)==0) return;
+       else if(!v3d && (base->lay & scene->lay)==0) return;
 
        ob = base->object;
 
index 19750833b4de0c9d08e785c67dae7ad20d155ae0..2dc2cf9f2938e74553309c11188014acc25516b6 100644 (file)
@@ -93,7 +93,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
        }
        else if(CTX_data_equals(member, "active_base")) {
                if(scene->basact)
-                       CTX_data_pointer_set(result, &scene->id, &RNA_UnknownType, &scene->basact);
+                       CTX_data_pointer_set(result, &scene->id, &RNA_UnknownType, scene->basact);
 
                return 1;
        }
index 4a42d1ed36920d68488a1a518a46bba8b181a12a..3032bff18df07f8d2bd9286906a4cebc85d372cc 100644 (file)
@@ -206,6 +206,7 @@ int ED_operator_object_active(bContext *C)
 int ED_operator_editmesh(bContext *C)
 {
        Object *obedit= CTX_data_edit_object(C);
+       printf("em %p %d\n", obedit, (obedit)? obedit->type == OB_MESH: -1);
        if(obedit && obedit->type==OB_MESH)
                return NULL != ((Mesh *)obedit->data)->edit_mesh;
        return 0;
index cb20b3dc93eea79b4ee4dfbbd296b0ff7705e6ea..20e0a79f0c717355895cbd00430e86035bddb917 100644 (file)
@@ -1425,7 +1425,7 @@ static void RestoreState(bContext *C)
 }
 
 /* maybe we need this defined somewhere else */
-extern void StartKetsjiShell(struct bContext *C,int always_use_expand_framing);
+extern void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int always_use_expand_framing);
 
 #endif // GAMEBLENDER == 1
 
@@ -1433,13 +1433,40 @@ static int game_engine_exec(bContext *C, wmOperator *unused)
 {
 #if GAMEBLENDER == 1
        Scene *startscene = CTX_data_scene(C);
+       bScreen *sc= CTX_wm_screen(C);
+       ScrArea *sa, *prevsa= CTX_wm_area(C);
+       ARegion *ar, *prevar= CTX_wm_region(C);
+
+       sa= prevsa;
+       if(sa->spacetype != SPACE_VIEW3D) {
+               for(sa=sc->areabase.first; sa; sa= sa->next)
+                       if(sa->spacetype==SPACE_VIEW3D)
+                               break;
+       }
+
+       if(!sa)
+               return OPERATOR_CANCELLED;
+       
+       for(ar=sa->regionbase.first; ar; ar=ar->next)
+               if(ar->regiontype == RGN_TYPE_WINDOW)
+                       break;
+       
+       if(!ar)
+               return OPERATOR_CANCELLED;
        
+       // bad context switch ..
+       CTX_wm_area_set(C, sa);
+       CTX_wm_region_set(C, ar);
+
        view3d_operator_needs_opengl(C);
        
        SaveState(C);
-       StartKetsjiShell(C, 1);
+       StartKetsjiShell(C, ar, 1);
        RestoreState(C);
        
+       CTX_wm_region_set(C, prevar);
+       CTX_wm_area_set(C, prevsa);
+
        //XXX restore_all_scene_cfra(scene_cfra_store);
        set_scene_bg(startscene);
        //XXX scene_update_for_newframe(G.scene, G.scene->lay);
@@ -1461,7 +1488,7 @@ void VIEW3D_OT_game_start(wmOperatorType *ot)
        /* api callbacks */
        ot->exec= game_engine_exec;
        
-       ot->poll= ED_operator_view3d_active;
+       //ot->poll= ED_operator_view3d_active;
 }
 
 /* ************************************** */
index 542a747d454bddf311fc796ad1f15cccfeddfb3c..56ae220f7f0ef982e171ffa69c2b37d3fcb19451 100644 (file)
@@ -57,7 +57,7 @@ struct wmWindow       *WM_window_open         (struct bContext *C, struct rcti *rect);
 int                    WM_read_homefile        (struct bContext *C, struct wmOperator *op);
 int                    WM_write_homefile       (struct bContext *C, struct wmOperator *op);
 void           WM_read_file            (struct bContext *C, char *name, struct ReportList *reports);
-void           WM_write_file           (struct bContext *C, char *target, struct ReportList *reports);
+void           WM_write_file           (struct bContext *C, char *target, int compress, struct ReportList *reports);
 void           WM_read_autosavefile(struct bContext *C);
 void           WM_write_autosave       (struct bContext *C);
 
index 5377e351ff05b6050e60ced84f5e9ec60c70e04c..11b8f7f8c6f8d4ee8b722185250ab41991b06f0d 100644 (file)
@@ -451,7 +451,7 @@ int WM_operator_name_call(bContext *C, const char *opstring, int context, Pointe
 
                                CTX_wm_region_set(C, NULL);
                                CTX_wm_area_set(C, NULL);
-                               retval= wm_operator_invoke(C, ot, window->eventstate, properties);
+                               retval= wm_operator_invoke(C, ot, event, properties);
                                CTX_wm_region_set(C, ar);
                                CTX_wm_area_set(C, area);
 
index c3b317590f16d717d70a4de51e61067de38a9760..2019906bd5e92ff71be95c066e1f022274a93549 100644 (file)
@@ -539,7 +539,7 @@ static void do_history(char *name, ReportList *reports)
                BKE_report(reports, RPT_ERROR, "Unable to make version backup");
 }
 
-void WM_write_file(bContext *C, char *target, ReportList *reports)
+void WM_write_file(bContext *C, char *target, int compress, ReportList *reports)
 {
        Library *li;
        int writeflags, len;
@@ -580,10 +580,11 @@ void WM_write_file(bContext *C, char *target, ReportList *reports)
 
        do_history(di, reports);
        
-       /* we use the UserDef to define compression flag */
-       writeflags= G.fileflags & ~G_FILE_COMPRESS;
-       if(U.flag & USER_FILECOMPRESS)
-               writeflags |= G_FILE_COMPRESS;
+       writeflags= G.fileflags;
+
+       /* set compression flag */
+       if(compress) writeflags |= G_FILE_COMPRESS;
+       else writeflags &= ~G_FILE_COMPRESS;
        
        if (BLO_write_file(CTX_data_main(C), di, writeflags, reports)) {
                strcpy(G.sce, di);
@@ -591,6 +592,9 @@ void WM_write_file(bContext *C, char *target, ReportList *reports)
                strcpy(G.main->name, di);       /* is guaranteed current file */
 
                G.save_over = 1; /* disable untitled.blend convention */
+
+               if(compress) G.fileflags |= G_FILE_COMPRESS;
+               else G.fileflags &= ~G_FILE_COMPRESS;
                
                writeBlog();
        }
index 5e60207f62d2a3a81b05951c72ca745a05632469..5c484dfa322886d9971f71e193601164dfb67b7b 100644 (file)
@@ -571,7 +571,7 @@ static void WM_OT_read_homefile(wmOperatorType *ot)
 
 static int recentfile_exec(bContext *C, wmOperator *op)
 {
-       int event= RNA_int_get(op->ptr, "nr");
+       int event= RNA_enum_get(op->ptr, "file");
 
        // XXX wm in context is not set correctly after WM_read_file -> crash
        // do it before for now, but is this correct with multiple windows?
@@ -594,30 +594,54 @@ static int recentfile_exec(bContext *C, wmOperator *op)
 
 static int wm_recentfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-       struct RecentFile *recent;
        uiPopupMenu *pup;
        uiLayout *layout;
-       int i, ofs= 0;
 
        pup= uiPupMenuBegin(C, "Open Recent", 0);
        layout= uiPupMenuLayout(pup);
+       uiItemsEnumO(layout, op->type->idname, "file");
+       uiPupMenuEnd(C, pup);
+       
+       return OPERATOR_CANCELLED;
+}
+
+static EnumPropertyItem *open_recentfile_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+       EnumPropertyItem tmp = {0, "", 0, "", ""};
+       EnumPropertyItem *item= NULL;
+       struct RecentFile *recent;
+       int totitem= 0, i, ofs= 0;
 
        if(G.sce[0]) {
-               uiItemIntO(layout, G.sce, 0, op->type->idname, "nr", 1);
+               tmp.value= 1;
+               tmp.identifier= G.sce;
+               tmp.name= G.sce;
+               RNA_enum_item_add(&item, &totitem, &tmp);
                ofs = 1;
        }
-       
-       for(recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++)
-               if(strcmp(recent->filename, G.sce))
-                       uiItemIntO(layout, recent->filename, 0, op->type->idname, "nr", i+ofs+1);
 
-       uiPupMenuEnd(C, pup);
-       
-       return OPERATOR_CANCELLED;
+       /* dynamically construct enum */
+       for(recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++) {
+               if(strcmp(recent->filename, G.sce)) {
+                       tmp.value= i+ofs+1;
+                       tmp.identifier= recent->filename;
+                       tmp.name= recent->filename;
+                       RNA_enum_item_add(&item, &totitem, &tmp);
+               }
+       }
+
+       RNA_enum_item_end(&item, &totitem);
+       *free= 1;
+
+       return item;
 }
 
 static void WM_OT_open_recentfile(wmOperatorType *ot)
 {
+       PropertyRNA *prop;
+       static EnumPropertyItem file_items[]= {
+               {0, NULL, 0, NULL, NULL}};
+
        ot->name= "Open Recent File";
        ot->idname= "WM_OT_open_recentfile";
        
@@ -625,7 +649,8 @@ static void WM_OT_open_recentfile(wmOperatorType *ot)
        ot->exec= recentfile_exec;
        ot->poll= WM_operator_winactive;
        
-       RNA_def_property(ot->srna, "nr", PROP_INT, PROP_UNSIGNED);
+       prop= RNA_def_enum(ot->srna, "file", file_items, 1, "File", "");
+       RNA_def_enum_funcs(prop, open_recentfile_itemf);
 }
 
 /* ********* main file *********** */
@@ -675,15 +700,57 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
        ot->exec= wm_open_mainfile_exec;
        ot->poll= WM_operator_winactive;
        
-       ot->flag= 0;
-       
        RNA_def_property(ot->srna, "filename", PROP_STRING, PROP_FILEPATH);
+}
+
+static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
+{
+       char scestr[FILE_MAX], filename[FILE_MAX];
+       int save_over;
 
+       /* back up some values */
+       BLI_strncpy(scestr, G.sce, sizeof(scestr));
+       save_over = G.save_over;
+
+       // XXX wm in context is not set correctly after WM_read_file -> crash
+       // do it before for now, but is this correct with multiple windows?
+       WM_event_add_notifier(C, NC_WINDOW, NULL);
+
+       /* load file */
+       BLI_make_file_string("/", filename, btempdir, "quit.blend");
+       WM_read_file(C, filename, op->reports);
+
+       /* restore */
+       G.save_over = save_over;
+       BLI_strncpy(G.sce, scestr, sizeof(G.sce));
+
+       return 0;
+}
+
+static void WM_OT_recover_last_session(wmOperatorType *ot)
+{
+       ot->name= "Recover Last Session";
+       ot->idname= "WM_OT_recover_last_session";
+       
+       ot->exec= wm_recover_last_session_exec;
+       ot->poll= WM_operator_winactive;
+}
+
+static void save_set_compress(wmOperator *op)
+{
+       if(!RNA_property_is_set(op->ptr, "compress")) {
+               if(G.save_over) /* keep flag for existing file */
+                       RNA_boolean_set(op->ptr, "compress", G.fileflags & G_FILE_COMPRESS);
+               else /* use userdef for new file */
+                       RNA_boolean_set(op->ptr, "compress", U.flag & USER_FILECOMPRESS);
+       }
 }
 
 static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        char name[FILE_MAX];
+
+       save_set_compress(op);
        
        BLI_strncpy(name, G.sce, FILE_MAX);
        untitled(name);
@@ -698,6 +765,10 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *even
 static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
 {
        char filename[FILE_MAX];
+       int compress;
+
+       save_set_compress(op);
+       compress= RNA_boolean_get(op->ptr, "compress");
        
        if(RNA_property_is_set(op->ptr, "filename"))
                RNA_string_get(op->ptr, "filename", filename);
@@ -705,7 +776,8 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
                BLI_strncpy(filename, G.sce, FILE_MAX);
                untitled(filename);
        }
-       WM_write_file(C, filename, op->reports);
+
+       WM_write_file(C, filename, compress, op->reports);
        
        WM_event_add_notifier(C, NC_WM|ND_FILESAVE, NULL);
 
@@ -721,10 +793,8 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
        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);
-
+       RNA_def_string_file_path(ot->srna, "filename", "", 0, "Filename", "");
+       RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file.");
 }
 
 /* *************** Save file directly ******** */
@@ -732,6 +802,8 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
 static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        char name[FILE_MAX];
+
+       save_set_compress(op);
        
        BLI_strncpy(name, G.sce, FILE_MAX);
        untitled(name);
@@ -750,10 +822,8 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
        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);
-       
+       RNA_def_string_file_path(ot->srna, "filename", "", 0, "Filename", "");
+       RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file.");
 }
 
 
@@ -1590,6 +1660,7 @@ void wm_operatortype_init(void)
        WM_operatortype_append(WM_OT_exit_blender);
        WM_operatortype_append(WM_OT_open_recentfile);
        WM_operatortype_append(WM_OT_open_mainfile);
+       WM_operatortype_append(WM_OT_recover_last_session);
        WM_operatortype_append(WM_OT_jobs_timer);
        WM_operatortype_append(WM_OT_save_as_mainfile);
        WM_operatortype_append(WM_OT_save_mainfile);
index 03dd5d07eb00964c6460fd0f4bf06ae5dec80458..6e6531c9b5fdc5807b7733ad70c9c175805b8451 100644 (file)
@@ -118,11 +118,10 @@ static BlendFileData *load_game_data(char *filename)
        return bfd;
 }
 
-extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_framing)
+extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int always_use_expand_framing)
 {
        /* context values */
        struct wmWindow *win= CTX_wm_window(C);
-       struct ARegion *ar= CTX_wm_region(C);
        struct Scene *scene= CTX_data_scene(C);
        struct Main* maggie1= CTX_data_main(C);