diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 15 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 4 |
2 files changed, 4 insertions, 15 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index da46001bde9..7e87068a7bb 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -125,13 +125,8 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name) if (!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type)) return NULL; - - defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup"); - - BLI_strncpy(defgroup->name, name, sizeof(defgroup->name)); - BLI_addtail(&ob->defbase, defgroup); - defgroup_unique_name(defgroup, ob); + defgroup = BKE_defgroup_new(ob, name); ob->actdef = BLI_countlist(&ob->defbase); @@ -756,13 +751,10 @@ static bool ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGro const int use_vert_sel = vertex_group_use_vert_sel(ob_dst); /* Ensure vertex group on target.*/ - if (!defgroup_find_name(ob_dst, dg_src->name)) { - ED_vgroup_add_name(ob_dst, dg_src->name); + if ((dg_dst = defgroup_find_name(ob_dst, dg_src->name)) == NULL) { + dg_dst = BKE_defgroup_new(ob_dst, dg_src->name); } - /* Get destination deformgroup.*/ - dg_dst = defgroup_find_name(ob_dst, dg_src->name); - /* Get meshes.*/ dmesh_src = mesh_get_derived_deform(scene, ob_src, CD_MASK_BAREMESH); me_dst = ob_dst->data; @@ -3811,7 +3803,6 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op) /* Event notifiers for correct display of data.*/ DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob_act); - return OPERATOR_FINISHED; } else { diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 173a76a54e8..a891524b5c6 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -380,11 +380,9 @@ static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active) flip_side_name(name, defgroup->name, FALSE); mirrdef = defgroup_name_index(ob, name); if (mirrdef == -1) { - int olddef = ob->actdef; /* tsk, ED_vgroup_add sets the active defgroup */ - if (ED_vgroup_add_name(ob, name)) { + if (BKE_defgroup_new(ob, name)) { mirrdef = BLI_countlist(&ob->defbase) - 1; } - ob->actdef = olddef; } /* curdef should never be NULL unless this is |