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>2005-05-19 19:47:42 +0400
committerTon Roosendaal <ton@blender.org>2005-05-19 19:47:42 +0400
commitdee5af12e3327dd2dcd80eaef15c44756eb42315 (patch)
treea73936035a935506afbe4220b1fb3a5501f27dc6
parent461768db47acc2988070b416d5475098b487d6a4 (diff)
Back to the Future bugfix!
When a new space (window) type gets added, older Blender binaries will crash on reading files saved with such spaces. This breaks the so nice upward compility on files... With addition of SpaceTime I got an occasion to verify & fix that. If Blender detects a non-existant space it will degrade it to a 3D window now. Tested on a full 2.34 compile.
-rw-r--r--source/blender/src/spacetypes.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/src/spacetypes.c b/source/blender/src/spacetypes.c
index 2b7b8de4dce..6509aee6982 100644
--- a/source/blender/src/spacetypes.c
+++ b/source/blender/src/spacetypes.c
@@ -43,6 +43,7 @@
#include "BIF_gl.h"
#include "BIF_mywindow.h"
#include "BIF_screen.h"
+#include "BIF_space.h"
#include "BIF_spacetypes.h"
/***/
@@ -75,11 +76,11 @@ void spacetype_set_winfuncs(SpaceType *st, SpaceDrawFP draw, SpaceChangeFP chang
st->winhandle= handle;
}
- /***/
+ /* gets SpaceType struct, but also has patch to initialize unknown spacetypes */
-static SpaceType *spacetype_from_code(int spacecode)
+static SpaceType *spacetype_from_area(ScrArea *area)
{
- switch (spacecode) {
+ switch (area->spacetype) {
case SPACE_ACTION: return spaceaction_get_type();
case SPACE_BUTS: return spacebuts_get_type();
case SPACE_FILE: return spacefile_get_type();
@@ -96,13 +97,15 @@ static SpaceType *spacetype_from_code(int spacecode)
case SPACE_VIEW3D: return spaceview3d_get_type();
case SPACE_TIME: return spacetime_get_type();
default:
+ newspace(area, SPACE_VIEW3D);
+ return spaceview3d_get_type();
return NULL;
}
}
void scrarea_do_windraw(ScrArea *area)
{
- SpaceType *st= spacetype_from_code(area->spacetype);
+ SpaceType *st= spacetype_from_area(area);
areawinset(area->win);
@@ -118,7 +121,7 @@ void scrarea_do_windraw(ScrArea *area)
}
void scrarea_do_winchange(ScrArea *area)
{
- SpaceType *st= spacetype_from_code(area->spacetype);
+ SpaceType *st= spacetype_from_area(area);
areawinset(area->win);
@@ -133,7 +136,7 @@ void scrarea_do_winchange(ScrArea *area)
}
void scrarea_do_winhandle(ScrArea *area, BWinEvent *evt)
{
- SpaceType *st= spacetype_from_code(area->spacetype);
+ SpaceType *st= spacetype_from_area(area);
areawinset(area->win);