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:
authorCampbell Barton <ideasman42@gmail.com>2012-03-18 00:39:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-18 00:39:28 +0400
commit91580c0929f96562895d262d621745956c3ad35e (patch)
tree7338f08f832189bca3b98e8e6308a0115b475de5 /source/blender/blenloader
parent8b7ea6fc90c43a7d2b04a5ced81614776bbba77c (diff)
swap BMLoopCol r/b color, requires subversion bump.
old mesh MCol 'r' was blue, 'b' was red, but theres no reason to keep this for bmesh with MLoopCol. Loading old files works, saving legacy format works too. What wont work is loading a file after this revision and loading it in an older revision since the bmesh merge. (it wont crash but the blue and red will be swapped on vertex color layers).
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 0ba4c7a63d0..fcb492e02ca 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7753,6 +7753,26 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
}
}
+/* blue and red are swapped pre 2.62.1, be sane (red == red) now! */
+static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me)
+{
+ CustomDataLayer *layer;
+ MLoopCol *mloopcol;
+ int a;
+ int i;
+
+ for(a = 0; a < me->ldata.totlayer; a++) {
+ layer = &me->ldata.layers[a];
+
+ if(layer->type == CD_MLOOPCOL) {
+ mloopcol = (MLoopCol *)layer->data;
+ for(i = 0; i < me->totloop; i++, mloopcol++) {
+ SWAP(char, mloopcol->r, mloopcol->b);
+ }
+ }
+ }
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -13245,7 +13265,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree);
}
- /* put compatibility code here until next subversion bump */
+ /* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
+ if (main->versionfile == 262 && main->subversionfile == 1)
+ {
+ {
+ Mesh *me;
+ for (me = main->mesh.first; me; me = me->id.next) {
+ do_versions_mesh_mloopcol_swap_2_62_1(me);
+ }
+ }
+
+ }
+
+ if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 2))
{
{
/* Set new idname of keyingsets from their now "label-only" name. */
@@ -13260,6 +13292,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ /* put compatibility code here until next subversion bump */
+ {
+
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */