Patch to allow pre-2.50 Blenders to read newer files.

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)
This commit is contained in:
2008-11-27 16:00:59 +00:00
parent 6b5c948457
commit d6aff38426
5 changed files with 10 additions and 2 deletions

View 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);
}

View 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);

View 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')

View File

@@ -71,7 +71,7 @@ typedef struct wmWindowManager {
ListBase screenkeymap;
ListBase uikeymap;
ListBase timekeymap;
/* keymaps have to be NULLed in readfile.c */
} wmWindowManager;

View 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;