Patch to allow pre-2.50 Blenders to read newer files.
authorTon Roosendaal <ton@blender.org>
Thu, 27 Nov 2008 16:00:59 +0000 (16:00 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 27 Nov 2008 16:00:59 +0000 (16:00 +0000)
Since we'll reshuffle a lot in UI code, making new Screens totally
incompatible, this patch saves the Screen chunk in Blender files
with a new identifier (ID_SCRN), causing it to be not read in old
Blender binaries. Pre-2.50 blender already has a facility to recover
from this (it keeps old UI), including for .B.blends (it opens
default simple screen)

For the latter reason, it might be advisable to have the .B.blend
for 2.50+ saved as another name? Then you can use both for while.

(Note: commit is just 3 lines of code, other files are comments I
added for documentation of other stuff)

source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/makesdna/DNA_ID.h
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/windowmanager/intern/wm_event_system.c

index 53fd1bfa373fc5fbc621461ef9bd81d60f2ddf46..3fd0812338c4e58ebc8931ec875772f796614cc2 100644 (file)
@@ -8207,6 +8207,10 @@ BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r)
                        bhead = read_libblock(fd, fd->mainlist.last, bhead, LIB_READ+LIB_EXTERN, NULL);
                        break;
                        
+                       /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
+               case ID_SCRN:
+                       bhead->code= ID_SCR;
+                       /* deliberate pass on to default */
                default:
                        bhead = read_libblock(fd, bfd->main, bhead, LIB_LOCAL, NULL);
                }
index d84211411fa90030950143e5633087333f823d0c..96611b6fa9d710df161b0fceb7d6ac75f475900e 100644 (file)
@@ -1620,7 +1620,8 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
        while(sc) {
                
                /* write LibData */
-               writestruct(wd, ID_SCR, "Screen", 1, sc);
+               /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
+               writestruct(wd, ID_SCRN, "Screen", 1, sc);
                if (sc->id.properties) 
                        IDP_WriteProperty(sc->id.properties, wd);
 
index ea9f64cc26c474354009dd90d4aca1660a85170a..3ad2ae48d53a0e0a8420b6ec272c0257885276df 100644 (file)
@@ -174,6 +174,7 @@ typedef struct PreviewImage {
 #define ID_KE          MAKE_ID2('K', 'E')
 #define ID_WO          MAKE_ID2('W', 'O')
 #define ID_SCR         MAKE_ID2('S', 'R')
+#define ID_SCRN                MAKE_ID2('S', 'N')
 #define ID_VF          MAKE_ID2('V', 'F')
 #define ID_TXT         MAKE_ID2('T', 'X')
 #define ID_SO          MAKE_ID2('S', 'O')
index 05d4bc104866b969bc23138d1014e387eb469333..0684503b2b2f9cef35cc1f9da5cc613633007d1e 100644 (file)
@@ -71,7 +71,7 @@ typedef struct wmWindowManager {
        ListBase screenkeymap;
        ListBase uikeymap;
        ListBase timekeymap;
-       
+       /* keymaps have to be NULLed in readfile.c */
        
 } wmWindowManager;
 
index 061a784ea91b172d885f973a14481f5dd6b150f5..e4c4406b8aeb545973a67a84cfabd9be867d2141 100644 (file)
@@ -252,6 +252,7 @@ void wm_draw_update(bContext *C)
                        if(win->screen->do_draw)
                                ED_screen_draw(win);
 
+                       /* regions are menus here */
                        for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
                                C->region= ar;
                                
@@ -519,6 +520,7 @@ void wm_event_do_handlers(bContext *C)
                        
                        action= wm_handlers_do(C, event, &win->handlers);
                        
+                       /* modal menus in Blender use (own) regions linked to screen */
                        if(wm_event_always_pass(event) || action==WM_HANDLER_CONTINUE) {
                                ARegion *ar;