[Bf-blender-cvs] [69674f3] master: Fix T46694: UVLoop incorrectly copied flag

Campbell Barton noreply at git.blender.org
Wed Nov 11 09:16:58 CET 2015


Commit: 69674f387569bddafc27227ba3e104a262301a44
Author: Campbell Barton
Date:   Wed Nov 11 19:07:04 2015 +1100
Branches: master
https://developer.blender.org/rB69674f387569bddafc27227ba3e104a262301a44

Fix T46694: UVLoop incorrectly copied flag

Error in copying customdata flag lead to pin being randomly enabled.

===================================================================

M	source/blender/blenkernel/intern/customdata.c

===================================================================

diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index f210d34..32a21e6 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -909,6 +909,7 @@ static void layerInterp_mloopuv(
         const float *sub_weights, int count, void *dest)
 {
 	float uv[2];
+	int flag = 0;
 	int i;
 
 	zero_v2(uv);
@@ -916,9 +917,12 @@ static void layerInterp_mloopuv(
 	if (sub_weights) {
 		const float *sub_weight = sub_weights;
 		for (i = 0; i < count; i++) {
-			float weight = weights ? weights[i] : 1.0f;
+			float weight = (weights ? weights[i] : 1.0f) * (*sub_weight);
 			const MLoopUV *src = sources[i];
-			madd_v2_v2fl(uv, src->uv, (*sub_weight) * weight);
+			madd_v2_v2fl(uv, src->uv, weight);
+			if (weight > 0.0f) {
+				flag |= src->flag;
+			}
 			sub_weight++;
 		}
 	}
@@ -927,12 +931,15 @@ static void layerInterp_mloopuv(
 			float weight = weights ? weights[i] : 1;
 			const MLoopUV *src = sources[i];
 			madd_v2_v2fl(uv, src->uv, weight);
+			if (weight > 0.0f) {
+				flag |= src->flag;
+			}
 		}
 	}
 
 	/* delay writing to the destination incase dest is in sources */
-	((MLoopUV *)dest)->flag = ((MLoopUV *)sources)->flag;
 	copy_v2_v2(((MLoopUV *)dest)->uv, uv);
+	((MLoopUV *)dest)->flag = flag;
 }
 
 /* origspace is almost exact copy of mloopuv's, keep in sync */




More information about the Bf-blender-cvs mailing list