Go to file
Bastien Montagne ff3d535bc2 Fix T45471: Blend file: Bad old_addr handling in mesh's customdata writing.
Issue is rather well explained in T45471: our current customdata writing code easily generates several different blocks in blend file with same 'old' address. This is bad, because those addresses are used as 'uid' during reading process (it kind of work in Blender's own reading process, by mere luck mostly, but breaks the file specs).

Solution (suggested by Campbell, thanks) implemented by this patch is to avoid duplicating everything, and instead just overwrite what we needs to skip some cdlayers on write:
* the CustomData's `totlayer` number;
* the CustomData's `layers` array of CustomDataLayer (keeping its original address using the `writestruct_at_address` helper).

New design allows us to get completely rid of the no_free flag stuff in `write_customdata()`.

Note that this implies written data is **not** directly valid from Blend PoV, since its written typemap does not match written layers (this is not an issue because typemap is rebuilt on read anyway - and it's easy to fix this if really needed).

Also, the backward compatibility saving of mface data remains an issue here, see comment in code.

Reviewers: sergey, campbellbarton

Projects: #bf_blender

Maniphest Tasks: T45471

Differential Revision: https://developer.blender.org/D1425
2015-07-21 12:02:11 +02:00
build_files SCons: Weirdly enough at some point scons became broken in OpenSubdiv branch 2015-07-20 22:43:13 +02:00
doc Docs; Py API gotcha's section 2015-07-12 20:50:44 +10:00
extern OpenSubdiv: Commit of OpenSubdiv integration into Blender 2015-07-20 22:29:26 +02:00
intern Cycles: Another attempt to solve CUDA compilation errors on 32bit platforms 2015-07-21 11:42:59 +02:00
release OpenSubdiv: Commit of OpenSubdiv integration into Blender 2015-07-20 22:29:26 +02:00
scons@625d446ae8 Fixed border extension for the sunbeams node. 2014-09-23 11:42:11 +02:00
source Fix T45471: Blend file: Bad old_addr handling in mesh's customdata writing. 2015-07-21 12:02:11 +02:00
tests BLI_math 'compare' cleanup & enhancements. 2015-07-10 15:02:43 +02:00
.arcconfig Use HTTPS protocol for arc 2013-12-24 22:57:27 +06:00
.gitignore Revert "ignore conflict files" 2014-08-08 06:00:49 +10:00
.gitmodules Initialize git submodules for addons, locales and scons 2013-11-15 12:19:08 +06:00
CMakeLists.txt OpenSubdiv: Commit of OpenSubdiv integration into Blender 2015-07-20 22:29:26 +02:00
COPYING == docs == 2010-10-13 14:44:22 +00:00
GNUmakefile CMake: use functions instead of macros 2015-06-17 09:38:24 +10:00
SConstruct OpenSubdiv: Commit of OpenSubdiv integration into Blender 2015-07-20 22:29:26 +02:00