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>2013-06-10 08:33:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-10 08:33:05 +0400
commit501f6555033455cd1df86f699dc860acf51b1e1f (patch)
tree29e8073c9f42a737a7a8c76ce559cec7a6251f03
parente3afec146116900b1af0296c65b8b3765385ae4c (diff)
fix [#35648] Loop cut, smoothness showing wrong symmetrical
this is more of a feature request then a bug, but nicer to use even smoothing offset for loopcut smoothing.
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c1
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h2
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c12
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c3
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c2
5 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 497c99f3f8a..012cbccacc7 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1010,6 +1010,7 @@ static BMOpDefine bmo_subdivide_edges_def = {
{"use_single_edge", BMO_OP_SLOT_BOOL}, /* tessellate the case of one edge selected in a quad or triangle */
{"use_only_quads", BMO_OP_SLOT_BOOL}, /* only subdivide quads (for loopcut) */
{"use_sphere", BMO_OP_SLOT_BOOL}, /* for making new primitives only */
+ {"use_smooth_even", BMO_OP_SLOT_BOOL}, /* maintain even offset when smoothing */
{{'\0'}},
},
/* slots_out */
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index 7f62d4cd21a..4c6129cf43f 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -122,7 +122,7 @@ extern const int bmo_opdefines_total;
/*------specific operator helper functions-------*/
void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
- const float smooth, const short smooth_falloff,
+ const float smooth, const short smooth_falloff, const bool use_smooth_even,
const float fractal, const float along_normal,
const int numcuts,
const int seltype, const int cornertype,
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index 0fcf17cd718..8e30da60f60 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -49,6 +49,7 @@ typedef struct SubDParams {
float along_normal;
//int beauty;
bool use_smooth;
+ bool use_smooth_even;
bool use_sphere;
bool use_fractal;
int seed;
@@ -180,6 +181,10 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
val = fabsf(1.0f - 2.0f * fabsf(0.5f - perc));
val = bmesh_subd_falloff_calc(params->smooth_falloff, val);
+ if (params->use_smooth_even) {
+ val *= BM_vert_calc_shell_factor(v);
+ }
+
mul_v3_fl(tvec, params->smooth * val * len);
add_v3_v3(co, tvec);
@@ -830,6 +835,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
params.fractal = fractal;
params.along_normal = along_normal;
params.use_smooth = (smooth != 0.0f);
+ params.use_smooth_even = BMO_slot_get(op->slots_in, "use_smooth_even");
params.use_fractal = (fractal != 0.0f);
params.use_sphere = use_sphere;
params.origkey = skey;
@@ -1146,7 +1152,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
/* editmesh-emulating function */
void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
- const float smooth, const short smooth_falloff,
+ const float smooth, const short smooth_falloff, const bool use_smooth_even,
const float fractal, const float along_normal,
const int numcuts,
const int seltype, const int cornertype,
@@ -1159,7 +1165,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
/* use_sphere isnt exposed here since its only used for new primitives */
BMO_op_initf(bm, &op, BMO_FLAG_DEFAULTS,
"subdivide_edges edges=%he "
- "smooth=%f smooth_falloff=%i "
+ "smooth=%f smooth_falloff=%i use_smooth_even=%b "
"fractal=%f along_normal=%f "
"cuts=%i "
"quad_corner_type=%i "
@@ -1167,7 +1173,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
"use_only_quads=%b "
"seed=%i",
edge_hflag,
- smooth, smooth_falloff,
+ smooth, smooth_falloff, use_smooth_even,
fractal, along_normal,
numcuts,
cornertype,
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index a126546c81c..2829aed4999 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -295,7 +295,8 @@ static void ringsel_finish(bContext *C, wmOperator *op)
* Note though that it will break edgeslide in this specific case.
* See [#31939]. */
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
- smoothness, smooth_falloff, 0.0f, 0.0f,
+ smoothness, smooth_falloff, true,
+ 0.0f, 0.0f,
cuts,
SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, true,
use_only_quads, 0);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index b3463915080..1f7690b9b42 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -92,7 +92,7 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
}
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
- smooth, SUBD_FALLOFF_ROOT,
+ smooth, SUBD_FALLOFF_ROOT, false,
fractal, along_normal,
cuts,
SUBDIV_SELECT_ORIG, RNA_enum_get(op->ptr, "quadcorner"),