[Bf-blender-cvs] [d2f8281] temp_custom_loop_normals: Cleanup, and do not execute the modifier when 'autosmooth' is disabled.

Bastien Montagne noreply at git.blender.org
Fri Jan 23 17:43:20 CET 2015


Commit: d2f8281b4b3ab99a28b63a4a116a531d449ac9d2
Author: Bastien Montagne
Date:   Fri Jan 23 16:56:01 2015 +0100
Branches: temp_custom_loop_normals
https://developer.blender.org/rBd2f8281b4b3ab99a28b63a4a116a531d449ac9d2

Cleanup, and do not execute the modifier when 'autosmooth' is disabled.

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

M	source/blender/blenkernel/intern/mesh_evaluate.c
M	source/blender/modifiers/intern/MOD_setsplitnormal.c

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

diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 7ba16d4..7e69266 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -1288,7 +1288,7 @@ static void mesh_normals_loop_custom_set(MVert *mverts, const int numVerts, MEdg
 				continue;
 			}
 
-			if (!BLI_BITMAP_TEST_BOOL(done_loops, i)) {
+			if (!BLI_BITMAP_TEST(done_loops, i)) {
 				/* Notes:
 				 *     * In case of mono-loop smooth fan, loops is NULL, so everything is fine (we have nothing to do).
 				 *     * Loops in this linklist are ordered (in reversed order compared to how they were discovered by
@@ -1387,7 +1387,6 @@ static void mesh_normals_loop_custom_set(MVert *mverts, const int numVerts, MEdg
 			else {
 				const int nidx = use_vertices ? (int)mloops[i].v : i;
 				float *nor = custom_loopnors[nidx];
-				float tnor[3];
 
 				BKE_lnor_space_custom_normal_to_data(lnors_spaces.lspaces[i], nor, r_clnors_data[i]);
 				BLI_BITMAP_DISABLE(done_loops, i);
diff --git a/source/blender/modifiers/intern/MOD_setsplitnormal.c b/source/blender/modifiers/intern/MOD_setsplitnormal.c
index 3b0fc4d..4f24861 100644
--- a/source/blender/modifiers/intern/MOD_setsplitnormal.c
+++ b/source/blender/modifiers/intern/MOD_setsplitnormal.c
@@ -52,17 +52,6 @@
 #include "MOD_util.h"
 
 
-static float get_weight(MDeformVert *dvert, const int defgrp_index, const bool use_invert_vgroup, const int vidx)
-{
-	if (!dvert || defgrp_index == -1) {
-		return 1.0f;
-	}
-	else {
-		const float weight = defvert_find_weight(&dvert[vidx], defgrp_index);
-		return use_invert_vgroup ? 1.0f - weight : weight;
-	}
-}
-
 static void get_min_max_co(float (*cos)[3], const int num_verts, float r_min_co[3], float r_max_co[3])
 {
 	/* XXX Check we can't get this from object?! Don't think so (bbox does not account for DM/mod stack). */
@@ -359,11 +348,14 @@ static bool is_valid_target(SetSplitNormalModifierData *smd)
 	else if ((smd->mode == MOD_SETSPLITNORMAL_MODE_TRACKTO) && smd->target) {
 		return true;
 	}
+	modifier_setError((ModifierData *)smd, "Invalid target settings");
 	return false;
 }
 
 static void setSplitNormalModifier_do(SetSplitNormalModifierData *smd, Object *ob, DerivedMesh *dm)
 {
+	Mesh *me = ob->data;
+
 	const int num_verts = dm->getNumVerts(dm);
 	const int num_edges = dm->getNumEdges(dm);
 	const int num_loops = dm->getNumLoops(dm);
@@ -385,12 +377,18 @@ static void setSplitNormalModifier_do(SetSplitNormalModifierData *smd, Object *o
 	float (*polynors)[3];
 	bool free_polynors = false;
 
+	/* Do not run that modifier at all if autosmooth is disabled! */
 	if (!is_valid_target(smd) || !num_loops) {
 		return;
 	}
 
+	if (!(me->flag & ME_AUTOSMOOTH)) {
+		modifier_setError((ModifierData *)smd, "Please enable 'Auto Smooth' option in mesh settings");
+		return;
+	}
+
+
 	if (use_current_clnors) {
-		Mesh *me = ob->data;
 		dm->calcLoopNormals(dm, (me->flag & ME_AUTOSMOOTH) != 0, me->smoothresh);
 		loopnors = dm->getLoopDataArray(dm, CD_NORMAL);
 	}




More information about the Bf-blender-cvs mailing list