Fix #32199: Smooth Vertex no longer has X, Y and Z options.

This commit is contained in:
Sergey Sharybin 2012-07-27 17:35:02 +00:00
parent 990466e87e
commit 718569dc16
3 changed files with 25 additions and 3 deletions

@ -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_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_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_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 */, {0} /* null-terminating sentinel */,
}, },
bmo_smooth_vert_exec, bmo_smooth_vert_exec,

@ -413,11 +413,16 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
float (*cos)[3] = NULL; float (*cos)[3] = NULL;
float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist"); float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist");
int i, j, clipx, clipy, clipz; int i, j, clipx, clipy, clipz;
int xaxis, yaxis, zaxis;
clipx = BMO_slot_bool_get(op, "mirror_clip_x"); clipx = BMO_slot_bool_get(op, "mirror_clip_x");
clipy = BMO_slot_bool_get(op, "mirror_clip_y"); clipy = BMO_slot_bool_get(op, "mirror_clip_y");
clipz = BMO_slot_bool_get(op, "mirror_clip_z"); 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; i = 0;
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) { BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
BLI_array_grow_one(cos); BLI_array_grow_one(cos);
@ -451,7 +456,13 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
i = 0; i = 0;
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) { 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++; i++;
} }

@ -1533,6 +1533,10 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
int i, repeat; int i, repeat;
float clipdist = 0.0f; 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 */ /* mirror before smooth */
if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
EDBM_verts_mirror_cache_begin(em, TRUE); 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++) { for (i = 0; i < repeat; i++) {
if (!EDBM_op_callf(em, op, if (!EDBM_op_callf(em, op,
"smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f", "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)) "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; return OPERATOR_CANCELLED;
} }
@ -1597,6 +1602,9 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; 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_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 *************************/ /********************** Smooth/Solid Operators *************************/