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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-07-27 21:35:02 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-07-27 21:35:02 +0400
commit718569dc16e35ef37838d0357f75e945a96928b1 (patch)
treef04df90266a07cbeaca7a48df4d2541d6ddd28aa
parent990466e87eee76e9e846694c977691fb43e427d1 (diff)
Fix #32199: Smooth Vertex no longer has X, Y and Z options.
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c3
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c13
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c12
3 files changed, 25 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index c80a88d280e..eacee8e12ad 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -104,6 +104,9 @@ static BMOpDefine bmo_smooth_vert_def = {
{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,
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 5664c487236..6d5d74ebed1 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -413,11 +413,16 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
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 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
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++;
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 56d61d92b0f..a869886355a 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1533,6 +1533,10 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
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 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
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 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
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 *************************/