[Bf-blender-cvs] [4a438cfa58c] soc-2017-normal-tools: Fixed error in mod with many loops sharing edge.
Rohan Rathi
noreply at git.blender.org
Tue Oct 3 19:19:02 CEST 2017
Commit: 4a438cfa58c77f89f969a213293cc502a30b939f
Author: Rohan Rathi
Date: Tue Oct 3 22:46:26 2017 +0530
Branches: soc-2017-normal-tools
https://developer.blender.org/rB4a438cfa58c77f89f969a213293cc502a30b939f
Fixed error in mod with many loops sharing edge.
Also removed redundant function and replaced its definition to BKE_mesh.h
===================================================================
M source/blender/blenkernel/BKE_mesh.h
M source/blender/blenkernel/intern/mesh_evaluate.c
M source/blender/modifiers/intern/MOD_weighted_normal.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index f3b2b653e3d..e3544543adc 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -195,6 +195,10 @@ void BKE_mesh_loop_tangents_ex(
struct ReportList *reports);
void BKE_mesh_loop_tangents(
struct Mesh *mesh, const char *uvmap, float (*r_looptangents)[4], struct ReportList *reports);
+void loop_manifold_fan_around_vert_next(
+ const struct MLoop *mloops, const struct MPoly *mpolys,
+ const int *loop_to_poly, const int *e2lfan_curr, const uint mv_pivot_index,
+ const struct MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int *r_mlfan_vert_index, int *r_mpfan_curr_index);
/**
* References a contiguous loop-fan with normal offset vars.
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 643ca3ee536..596479edd5d 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -651,7 +651,7 @@ typedef struct LoopSplitTaskDataCommon {
/* See comment about edge_to_loops below. */
#define IS_EDGE_SHARP(_e2l) (ELEM((_e2l)[1], INDEX_UNSET, INDEX_INVALID))
-static void loop_manifold_fan_around_vert_next(
+void loop_manifold_fan_around_vert_next(
const MLoop *mloops, const MPoly *mpolys,
const int *loop_to_poly, const int *e2lfan_curr, const uint mv_pivot_index,
const MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int *r_mlfan_vert_index, int *r_mpfan_curr_index)
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c
index 78fbbd80aae..2ae848fd8f3 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -92,39 +92,6 @@ static bool check_strength(int strength, int *cur_strength, float *cur_val, int
return true;
}
-/* Copied function used to fan around the current vertex */
-static void loop_manifold_fan_around_vert_next(
- const MLoop *mloops, const MPoly *mpolys,
- const int *loop_to_poly, const int *e2lfan_curr, const uint mv_pivot_index,
- const MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int *r_mlfan_vert_index, int *r_mpfan_curr_index)
-{
- const MLoop *mlfan_next;
- const MPoly *mpfan_next;
- *r_mlfan_curr_index = (e2lfan_curr[0] == *r_mlfan_curr_index) ? e2lfan_curr[1] : e2lfan_curr[0];
- *r_mpfan_curr_index = loop_to_poly[*r_mlfan_curr_index];
-
- BLI_assert(*r_mlfan_curr_index >= 0);
- BLI_assert(*r_mpfan_curr_index >= 0);
-
- mlfan_next = &mloops[*r_mlfan_curr_index];
- mpfan_next = &mpolys[*r_mpfan_curr_index];
- if (((*r_mlfan_curr)->v == mlfan_next->v && (*r_mlfan_curr)->v == mv_pivot_index) ||
- ((*r_mlfan_curr)->v != mlfan_next->v && (*r_mlfan_curr)->v != mv_pivot_index))
- {
- *r_mlfan_vert_index = *r_mlfan_curr_index;
- if (--(*r_mlfan_curr_index) < mpfan_next->loopstart) {
- *r_mlfan_curr_index = mpfan_next->loopstart + mpfan_next->totloop - 1;
- }
- }
- else {
- if (++(*r_mlfan_curr_index) >= mpfan_next->loopstart + mpfan_next->totloop) {
- *r_mlfan_curr_index = mpfan_next->loopstart;
- }
- *r_mlfan_vert_index = *r_mlfan_curr_index;
- }
- *r_mlfan_curr = &mloops[*r_mlfan_curr_index];
-}
-
static void apply_weights_sharp_loops(WeightedNormalModifierData *wnmd, int *loop_index, int size, pair *mode_pair,
float(*loop_normal)[3], int *loops_to_poly, float(*polynors)[3], int weight, int *strength)
{
@@ -385,6 +352,9 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd, Object
e2l[1] = ml_curr_index;
}
}
+ else if (!IS_EDGE_SHARP(e2l)) {
+ e2l[1] = INDEX_INVALID;
+ }
}
}
More information about the Bf-blender-cvs
mailing list