diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-02-19 17:18:28 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-02-19 17:19:32 +0400 |
commit | a9386400365c3cdb7642e0879b152f5e3dee30ee (patch) | |
tree | 94cb7cf9adbcf5bbfc6a88663ccbf14e98f51e7a /source | |
parent | 521b3a5dac62080c8162b025f2ede8b5c741c6f4 (diff) |
Fix T38717: Copy Vertex Group To Selected fails when all Vertex Groups
are empty.
This is now considered a no-op and counts as a successful copy (since
nothing would have changed anyway).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 6f2af46fa92..7a219f2a9d7 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -506,6 +506,9 @@ bool ED_vgroup_array_copy(Object *ob, Object *ob_from) int defbase_tot = BLI_countlist(&ob->defbase); bool new_vgroup = false; + if (ob == ob_from) + return true; + ED_vgroup_parray_alloc(ob_from->data, &dvert_array_from, &dvert_tot_from, false); ED_vgroup_parray_alloc(ob->data, &dvert_array, &dvert_tot, false); @@ -514,7 +517,8 @@ bool ED_vgroup_array_copy(Object *ob, Object *ob_from) new_vgroup = true; } - if (ob == ob_from || dvert_tot == 0 || (dvert_tot != dvert_tot_from) || dvert_array_from == NULL || dvert_array == NULL) { + if (dvert_tot == 0 || (dvert_tot != dvert_tot_from) || dvert_array_from == NULL || dvert_array == NULL) { + if (dvert_array) MEM_freeN(dvert_array); if (dvert_array_from) MEM_freeN(dvert_array_from); @@ -522,7 +526,9 @@ bool ED_vgroup_array_copy(Object *ob, Object *ob_from) /* free the newly added vgroup since it wasn't compatible */ vgroup_delete_all(ob); } - return false; + + /* if true: both are 0 and nothing needs changing, consider this a success */ + return (dvert_tot == dvert_tot_from); } /* do the copy */ |