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:
authorTon Roosendaal <ton@blender.org>2008-11-27 19:00:59 +0300
committerTon Roosendaal <ton@blender.org>2008-11-27 19:00:59 +0300
commitd6aff38426a29af19230ee5badbda47ff4c0a306 (patch)
tree0decc8fd324088883835f5a06afb58af876d7be1
parent6b5c948457b3627ffd69c0a2f6aaa8105642eb75 (diff)
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)
-rw-r--r--source/blender/blenloader/intern/readfile.c4
-rw-r--r--source/blender/blenloader/intern/writefile.c3
-rw-r--r--source/blender/makesdna/DNA_ID.h1
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c2
5 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 53fd1bfa373..3fd0812338c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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);
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index d84211411fa..96611b6fa9d 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -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);
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index ea9f64cc26c..3ad2ae48d53 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -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')
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 05d4bc10486..0684503b2b2 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -71,7 +71,7 @@ typedef struct wmWindowManager {
ListBase screenkeymap;
ListBase uikeymap;
ListBase timekeymap;
-
+ /* keymaps have to be NULLed in readfile.c */
} wmWindowManager;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 061a784ea91..e4c4406b8ae 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -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;