[Bf-blender-cvs] [eb5cdcc] temp_custom_loop_normals: SetSplitNormal: Fix bad handling of object-level transforms
Bastien Montagne
noreply at git.blender.org
Sun Aug 24 17:18:09 CEST 2014
Commit: eb5cdcc9f9ad89c7a648a72825510138e445a287
Author: Bastien Montagne
Date: Sun Aug 24 17:16:41 2014 +0200
Branches: temp_custom_loop_normals
https://developer.blender.org/rBeb5cdcc9f9ad89c7a648a72825510138e445a287
SetSplitNormal: Fix bad handling of object-level transforms
We need to compare poly normals in same space (target one, in this case)!
Issue reported by hd_ on BA, thanks!
===================================================================
M source/blender/modifiers/intern/MOD_setsplitnormal.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_setsplitnormal.c b/source/blender/modifiers/intern/MOD_setsplitnormal.c
index bd385d7..0b05910 100644
--- a/source/blender/modifiers/intern/MOD_setsplitnormal.c
+++ b/source/blender/modifiers/intern/MOD_setsplitnormal.c
@@ -467,7 +467,7 @@ static void setSplitNormalModifier_do_loopnormal(
/* And now, match all loops together, based on their respective faces' normals. */
for (i = 0; i < num_loops; i++) {
const MLoop *ml = &mloop[i];
- const float (*pnor)[3] = (const float (*)[3])&polynors[loop_to_poly[i]];
+ float pnor[3];
const int target_vidx = (int)cos[ml->v][0];
LinkNode *target_ml_lnk;
@@ -475,6 +475,10 @@ static void setSplitNormalModifier_do_loopnormal(
int target_lidx = -1;
const float fac = facs[i] = vfacs[ml->v];
+ /* Move our poly normal in target space! */
+ copy_v3_v3(pnor, polynors[loop_to_poly[i]]);
+ BLI_space_transform_apply_normal(&loc2trgt, pnor);
+
if (target_vidx < 0) {
/* nos is calloc'ed, no need to zero_v3 here. */
continue;
@@ -482,7 +486,7 @@ static void setSplitNormalModifier_do_loopnormal(
for (target_ml_lnk = target_verts2loops[target_vidx]; target_ml_lnk; target_ml_lnk = target_ml_lnk->next) {
const int t_lidx = GET_INT_FROM_POINTER(target_ml_lnk->link);
- const float t_dot = dot_v3v3(*pnor, target_polynors[target_loop_to_poly[t_lidx]]);
+ const float t_dot = dot_v3v3(pnor, target_polynors[target_loop_to_poly[t_lidx]]);
if (t_dot > target_ml_best_dot) {
target_ml_best_dot = t_dot;
More information about the Bf-blender-cvs
mailing list