diff options
author | Daniel Stokes <kupomail@gmail.com> | 2013-12-18 02:42:47 +0400 |
---|---|---|
committer | kupoman <kupomail@gmail.com> | 2013-12-18 05:03:27 +0400 |
commit | e9e08a1d12594eab0e341049fc252ff8578e9333 (patch) | |
tree | ac7c15959b03398babb68058f3824c2a4dbff5b7 /source/blender/blenloader/intern | |
parent | 173f7a3d30db8cba95656bf03dc842b9300c2436 (diff) |
Game Engine: Level of detail support and tools
Levels of detail can be added and modified in the object panel. The object
panel also contains new tools for generating levels of detail, setting up
levels of detail based on object names (useful for importing), and
clearing an object's level of detail settings. This is meant as a game
engine feature, though the level of details settings can be previewed in
the viewport.
Reviewed By: moguri, nexyon, brecht
Differential Revision: http://developer.blender.org/D109
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 19 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ac34f81907a..f3244a63a8b 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4492,6 +4492,16 @@ static void lib_link_object(FileData *fd, Main *main) ob->rigidbody_constraint->ob1 = newlibadr(fd, ob->id.lib, ob->rigidbody_constraint->ob1); ob->rigidbody_constraint->ob2 = newlibadr(fd, ob->id.lib, ob->rigidbody_constraint->ob2); } + + { + LodLevel *level; + for (level = ob->lodlevels.first; level; level = level->next) { + level->source = newlibadr(fd, ob->id.lib, level->source); + + if (!level->source && level == ob->lodlevels.first) + level->source = ob; + } + } } } @@ -5026,6 +5036,9 @@ static void direct_link_object(FileData *fd, Object *ob) if (ob->sculpt) { ob->sculpt = MEM_callocN(sizeof(SculptSession), "reload sculpt session"); } + + link_list(fd, &ob->lodlevels); + ob->currentlod = ob->lodlevels.first; } /* ************ READ SCENE ***************** */ @@ -8396,6 +8409,12 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) expand_doit(fd, mainvar, ob->rigidbody_constraint->ob2); } + if (ob->currentlod) { + LodLevel *level; + for (level = ob->lodlevels.first; level; level = level->next) { + expand_doit(fd, mainvar, level->source); + } + } } static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index be81f355e26..fd8c711fb1a 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1537,6 +1537,8 @@ static void write_objects(WriteData *wd, ListBase *idbase) write_particlesystems(wd, &ob->particlesystem); write_modifiers(wd, &ob->modifiers); + + writelist(wd, DATA, "LodLevel", &ob->lodlevels); } ob= ob->id.next; } |