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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-03-14 07:10:18 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-03-14 07:10:18 +0400
commit99f72dfbfcb004418ae3c701f3badfd36996e6e5 (patch)
tree15fb556342a58a1a947bd087c11d39f7afa4f95b /source/blender/blenloader
parentf80fa544281afb22815ca083d0badd3a9979d17d (diff)
Add 'level' field to struct MDisps, companion to 'totdisp'.
Gets initialized when loading old files and updated at the same places totdisp is updated. Saves having to do log+sqrt to extract level from totdisp.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 50b8e0997ee..2cbb8a300ed 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3751,6 +3751,15 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte
for(i = 0; i < count; ++i) {
mdisps[i].disps = newdataadr(fd, mdisps[i].disps);
+ if (mdisps[i].totdisp && !mdisps[i].level) {
+ /* this calculation is only correct for loop mdisps;
+ if loading pre-BMesh face mdisps this will be
+ overwritten with the correct value in
+ bm_corners_to_loops() */
+ float gridsize = sqrtf(mdisps[i].totdisp);
+ mdisps[i].level = (int)(logf(gridsize - 1.0f) / M_LN2) + 1;
+ }
+
if( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) {
/* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */
/* this does swap for data written at write_mdisps() - readfile.c */