diff options
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_remesh.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 98 |
2 files changed, 43 insertions, 61 deletions
diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c index 35762c5861e..d3dca03548f 100644 --- a/source/blender/editors/object/object_remesh.c +++ b/source/blender/editors/object/object_remesh.c @@ -407,7 +407,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update BKE_id_free(qj->bmain, bisect_mesh); - if (!new_mesh) { + if (new_mesh == NULL) { *do_update = true; *stop = 0; if (qj->success == 1) { @@ -418,9 +418,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update } /* Mirror the Quadriflow result to build the final mesh */ - if (new_mesh) { - new_mesh = remesh_symmetry_mirror(qj->owner, new_mesh, qj->symmetry_axes); - } + new_mesh = remesh_symmetry_mirror(qj->owner, new_mesh, qj->symmetry_axes); if (ob->mode == OB_MODE_SCULPT) { ED_sculpt_undo_geometry_begin(ob); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index d703cdfecb3..e8e0569f15e 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -783,79 +783,63 @@ static void vgroup_operator_subset_select_props(wmOperatorType *ot, bool use_act static void ED_vgroup_nr_vert_add( Object *ob, const int def_nr, const int vertnum, const float weight, const int assignmode) { - /* add the vert to the deform group with the - * specified number - */ + /* Add the vert to the deform group with the specified number. */ MDeformVert *dvert = NULL; int tot; - /* get the vert */ + /* Get the vert. */ BKE_object_defgroup_array_get(ob->data, &dvert, &tot); if (dvert == NULL) { return; } - /* check that vertnum is valid before trying to get the relevant dvert */ + /* Check that vertnum is valid before trying to get the relevant dvert. */ if ((vertnum < 0) || (vertnum >= tot)) { return; } - if (dvert) { - MDeformVert *dv = &dvert[vertnum]; - MDeformWeight *dw; - - /* Lets first check to see if this vert is - * already in the weight group -- if so - * lets update it - */ + MDeformVert *dv = &dvert[vertnum]; + MDeformWeight *dw; - dw = defvert_find_index(dv, def_nr); + /* Lets first check to see if this vert is already in the weight group - if so lets update it. */ + dw = defvert_find_index(dv, def_nr); - if (dw) { - switch (assignmode) { - case WEIGHT_REPLACE: - dw->weight = weight; - break; - case WEIGHT_ADD: - dw->weight += weight; - if (dw->weight >= 1.0f) { - dw->weight = 1.0f; - } - break; - case WEIGHT_SUBTRACT: - dw->weight -= weight; - /* if the weight is zero or less than - * remove the vert from the deform group - */ - if (dw->weight <= 0.0f) { - defvert_remove_group(dv, dw); - } - break; - } + if (dw) { + switch (assignmode) { + case WEIGHT_REPLACE: + dw->weight = weight; + break; + case WEIGHT_ADD: + dw->weight += weight; + if (dw->weight >= 1.0f) { + dw->weight = 1.0f; + } + break; + case WEIGHT_SUBTRACT: + dw->weight -= weight; + /* If the weight is zero or less than remove the vert from the deform group. */ + if (dw->weight <= 0.0f) { + defvert_remove_group(dv, dw); + } + break; } - else { - /* if the vert wasn't in the deform group then - * we must take a different form of action ... - */ - - switch (assignmode) { - case WEIGHT_SUBTRACT: - /* if we are subtracting then we don't - * need to do anything - */ - return; - - case WEIGHT_REPLACE: - case WEIGHT_ADD: - /* if we are doing an additive assignment, then - * we need to create the deform weight - */ - - /* we checked if the vertex was added before so no need to test again, simply add */ - defvert_add_index_notest(dv, def_nr, weight); - break; - } + } + else { + /* If the vert wasn't in the deform group then we must take a different form of action. */ + + switch (assignmode) { + case WEIGHT_SUBTRACT: + /* If we are subtracting then we don't need to do anything. */ + return; + + case WEIGHT_REPLACE: + case WEIGHT_ADD: + /* If we are doing an additive assignment, then we need to create the deform weight. */ + + /* We checked if the vertex was added before so no need to test again, simply add. */ + defvert_add_index_notest(dv, def_nr, weight); + break; } } } |