Revision: 56006
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56006
Author:   ton
Date:     2013-04-13 12:03:20 +0000 (Sat, 13 Apr 2013)
Log Message:
-----------
Bug fix #34896

The feature "Keep Session" was also loading that session when you double-click
on a .blend to open it, or when a .blend file was on commandline.

Moved this feature to the main() in creator.c, so it can check on it properly, 
skipping the
kept session when a file was loaded.

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/WM_api.h
    trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c
    trunk/blender/source/blender/windowmanager/wm_event_system.h
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/source/blender/windowmanager/WM_api.h
===================================================================
--- trunk/blender/source/blender/windowmanager/WM_api.h 2013-04-13 09:32:27 UTC 
(rev 56005)
+++ trunk/blender/source/blender/windowmanager/WM_api.h 2013-04-13 12:03:20 UTC 
(rev 56006)
@@ -113,6 +113,7 @@
                        /* files */
 void           WM_file_read(struct bContext *C, const char *filepath, struct 
ReportList *reports);
 void           WM_autosave_init(struct wmWindowManager *wm);
+void           WM_recover_last_session(struct bContext *C, struct ReportList 
*reports);
 
                        /* mouse cursors */
 void           WM_cursor_set           (struct wmWindow *win, int curs);

Modified: trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c    
2013-04-13 09:32:27 UTC (rev 56005)
+++ trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c    
2013-04-13 12:03:20 UTC (rev 56006)
@@ -223,7 +223,8 @@
        
        /* load last session, uses regular file reading so it has to be in end 
(after init py etc) */
        if (U.uiflag2 & USER_KEEP_SESSION) {
-               wm_recover_last_session(C, NULL);
+               /* calling WM_recover_last_session(C, NULL) has been moved to 
creator.c */
+               /* that prevents loading both the kept session, and the file on 
the command line */
        }
        else {
                /* normally 'wm_homefile_read' will do this,

Modified: trunk/blender/source/blender/windowmanager/intern/wm_operators.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_operators.c    
2013-04-13 09:32:27 UTC (rev 56005)
+++ trunk/blender/source/blender/windowmanager/intern/wm_operators.c    
2013-04-13 12:03:20 UTC (rev 56006)
@@ -2237,7 +2237,7 @@
 
 /* *************** recover last session **************** */
 
-void wm_recover_last_session(bContext *C, ReportList *reports)
+void WM_recover_last_session(bContext *C, ReportList *reports)
 {
        char filename[FILE_MAX];
        
@@ -2268,7 +2268,7 @@
 
 static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
 {
-       wm_recover_last_session(C, op->reports);
+       WM_recover_last_session(C, op->reports);
        return OPERATOR_FINISHED;
 }
 

Modified: trunk/blender/source/blender/windowmanager/wm_event_system.h
===================================================================
--- trunk/blender/source/blender/windowmanager/wm_event_system.h        
2013-04-13 09:32:27 UTC (rev 56005)
+++ trunk/blender/source/blender/windowmanager/wm_event_system.h        
2013-04-13 12:03:20 UTC (rev 56006)
@@ -104,8 +104,5 @@
 void        wm_drags_check_ops(bContext *C, wmEvent *event);
 void        wm_drags_draw(bContext *C, wmWindow *win, rcti *rect);
 
-/* wm_operators.c */
-void           wm_recover_last_session(bContext *C, ReportList *reports);
-
 #endif /* __WM_EVENT_SYSTEM_H__ */
 

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c      2013-04-13 09:32:27 UTC (rev 
56005)
+++ trunk/blender/source/creator/creator.c      2013-04-13 12:03:20 UTC (rev 
56006)
@@ -1196,6 +1196,11 @@
        }
 }
 
+static int test_file(int UNUSED(argc), const char **argv, void *data)
+{
+       printf("path is %s\n", argv[0]);
+}
+
 static int load_file(int UNUSED(argc), const char **argv, void *data)
 {
        bContext *C = data;
@@ -1604,6 +1609,13 @@
        /* OK we are ready for it */
 #ifndef WITH_PYTHON_MODULE
        BLI_argsParse(ba, 4, load_file, C);
+       
+       if (G.background == 0) {
+               if (!G.file_loaded)
+                       if (U.uiflag2 & USER_KEEP_SESSION)
+                               WM_recover_last_session(C, NULL);
+       }
+
 #endif
 
 #ifndef WITH_PYTHON_MODULE

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to