[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49304] trunk/blender/source/blender: Fix #32199: Smooth Vertex no longer has X, Y and Z options.

Sergey Sharybin sergey.vfx at gmail.com
Fri Jul 27 19:35:02 CEST 2012


Revision: 49304
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49304
Author:   nazgul
Date:     2012-07-27 17:35:02 +0000 (Fri, 27 Jul 2012)
Log Message:
-----------
Fix #32199: Smooth Vertex no longer has X, Y and Z options.

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c
    trunk/blender/source/blender/bmesh/operators/bmo_utils.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	2012-07-27 16:01:33 UTC (rev 49303)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_opdefines.c	2012-07-27 17:35:02 UTC (rev 49304)
@@ -104,6 +104,9 @@
 	 {BMO_OP_SLOT_BOOL, "mirror_clip_y"}, /* set vertices close to the y axis before the operation to 0 */
 	 {BMO_OP_SLOT_BOOL, "mirror_clip_z"}, /* set vertices close to the z axis before the operation to 0 */
 	 {BMO_OP_SLOT_FLT, "clipdist"}, /* clipping threshod for the above three slots */
+	 {BMO_OP_SLOT_BOOL, "use_axis_x"}, /* smooth vertices along X axis */
+	 {BMO_OP_SLOT_BOOL, "use_axis_y"}, /* smooth vertices along Y axis */
+	 {BMO_OP_SLOT_BOOL, "use_axis_z"}, /* smooth vertices along Z axis */
 	{0} /* null-terminating sentinel */,
 	},
 	bmo_smooth_vert_exec,

Modified: trunk/blender/source/blender/bmesh/operators/bmo_utils.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_utils.c	2012-07-27 16:01:33 UTC (rev 49303)
+++ trunk/blender/source/blender/bmesh/operators/bmo_utils.c	2012-07-27 17:35:02 UTC (rev 49304)
@@ -413,11 +413,16 @@
 	float (*cos)[3] = NULL;
 	float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist");
 	int i, j, clipx, clipy, clipz;
+	int xaxis, yaxis, zaxis;
 	
 	clipx = BMO_slot_bool_get(op, "mirror_clip_x");
 	clipy = BMO_slot_bool_get(op, "mirror_clip_y");
 	clipz = BMO_slot_bool_get(op, "mirror_clip_z");
 
+	xaxis = BMO_slot_bool_get(op, "use_axis_x");
+	yaxis = BMO_slot_bool_get(op, "use_axis_y");
+	zaxis = BMO_slot_bool_get(op, "use_axis_z");
+
 	i = 0;
 	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
 		BLI_array_grow_one(cos);
@@ -451,7 +456,13 @@
 
 	i = 0;
 	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
-		copy_v3_v3(v->co, cos[i]);
+		if (xaxis)
+			v->co[0] = cos[i][0];
+		if (yaxis)
+			v->co[1] = cos[i][1];
+		if (zaxis)
+			v->co[2] = cos[i][2];
+
 		i++;
 	}
 

Modified: trunk/blender/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2012-07-27 16:01:33 UTC (rev 49303)
+++ trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2012-07-27 17:35:02 UTC (rev 49304)
@@ -1533,6 +1533,10 @@
 	int i, repeat;
 	float clipdist = 0.0f;
 
+	int xaxis = RNA_boolean_get(op->ptr, "xaxis");
+	int yaxis = RNA_boolean_get(op->ptr, "yaxis");
+	int zaxis = RNA_boolean_get(op->ptr, "zaxis");
+
 	/* mirror before smooth */
 	if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
 		EDBM_verts_mirror_cache_begin(em, TRUE);
@@ -1564,8 +1568,9 @@
 	
 	for (i = 0; i < repeat; i++) {
 		if (!EDBM_op_callf(em, op,
-		                   "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f",
-		                   BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist))
+		                   "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f "
+		                   "use_axis_x=%b use_axis_y=%b use_axis_z=%b",
+		                   BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist, xaxis, yaxis, zaxis))
 		{
 			return OPERATOR_CANCELLED;
 		}
@@ -1597,6 +1602,9 @@
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
+	RNA_def_boolean(ot->srna, "xaxis", 1, "X-Axis", "Smooth along the X axis");
+	RNA_def_boolean(ot->srna, "yaxis", 1, "Y-Axis", "Smooth along the Y axis");
+	RNA_def_boolean(ot->srna, "zaxis", 1, "Z-Axis", "Smooth along the Z axis");
 }
 
 /********************** Smooth/Solid Operators *************************/




More information about the Bf-blender-cvs mailing list