[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57331] trunk/blender/source/blender: fix [#35648] Loop cut, smoothness showing wrong symmetrical

Campbell Barton ideasman42 at gmail.com
Mon Jun 10 06:33:06 CEST 2013


Revision: 57331
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57331
Author:   campbellbarton
Date:     2013-06-10 04:33:05 +0000 (Mon, 10 Jun 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c
    trunk/blender/source/blender/bmesh/intern/bmesh_operators.h
    trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c
    trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
    trunk/blender/source/blender/editors/mesh/editmesh_tools.c

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c	2013-06-10 03:56:50 UTC (rev 57330)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c	2013-06-10 04:33:05 UTC (rev 57331)
@@ -1010,6 +1010,7 @@
 	 {"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 */

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_operators.h
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_operators.h	2013-06-10 03:56:50 UTC (rev 57330)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_operators.h	2013-06-10 04:33:05 UTC (rev 57331)
@@ -122,7 +122,7 @@
 
 /*------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,

Modified: trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c	2013-06-10 03:56:50 UTC (rev 57330)
+++ trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c	2013-06-10 04:33:05 UTC (rev 57331)
@@ -49,6 +49,7 @@
 	float along_normal;
 	//int beauty;
 	bool use_smooth;
+	bool use_smooth_even;
 	bool use_sphere;
 	bool use_fractal;
 	int seed;
@@ -180,6 +181,10 @@
 		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 @@
 	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 @@
 
 /* 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 @@
 	/* 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 @@
 	             "use_only_quads=%b "
 	             "seed=%i",
 	             edge_hflag,
-	             smooth, smooth_falloff,
+	             smooth, smooth_falloff, use_smooth_even,
 	             fractal, along_normal,
 	             numcuts,
 	             cornertype,

Modified: trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c	2013-06-10 03:56:50 UTC (rev 57330)
+++ trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c	2013-06-10 04:33:05 UTC (rev 57331)
@@ -295,7 +295,8 @@
 			 * 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);

Modified: trunk/blender/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2013-06-10 03:56:50 UTC (rev 57330)
+++ trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2013-06-10 04:33:05 UTC (rev 57331)
@@ -92,7 +92,7 @@
 	}
 	
 	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"),




More information about the Bf-blender-cvs mailing list