[Bf-blender-cvs] [0b7dbff04a4] blender-v3.0-release: Fix T93728: Greasepencil separate will loose all vertex groups
Philipp Oeser
noreply at git.blender.org
Tue Jan 11 09:00:05 CET 2022
Commit: 0b7dbff04a4a2e4b2ce715c63c46294e3c732026
Author: Philipp Oeser
Date: Wed Dec 8 10:31:57 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rB0b7dbff04a4a2e4b2ce715c63c46294e3c732026
Fix T93728: Greasepencil separate will loose all vertex groups
Caused by {rB3b6ee8cee708}
The raw data is copied here correctly
[`BKE_gpencil_stroke_weights_duplicate` in
`BKE_gpencil_stroke_duplicate`] but the vertex groups names are missing.
Prior to above commit is was enough to have `ED_object_add_duplicate`
(this seemingly took care of duplicating object's defbase).
Now vertex groups names sit on the `bGPdata` rather than the `Object`,
and since the separate operation creates **new** `bGPdata` we have to
copy vertex groups names - and active index - over [via
`BKE_defgroup_copy_list`].
Maniphest Tasks: T93728
Differential Revision: https://developer.blender.org/D13509
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index f6012883e1f..36e9baaca36 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -51,6 +51,7 @@
#include "BKE_brush.h"
#include "BKE_context.h"
+#include "BKE_deform.h"
#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_curve.h"
@@ -4587,6 +4588,9 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op)
id_us_min(ob_dst->data);
ob_dst->data = (bGPdata *)gpd_dst;
+ BKE_defgroup_copy_list(&gpd_dst->vertex_group_names, &gpd_src->vertex_group_names);
+ gpd_dst->vertex_group_active_index = gpd_src->vertex_group_active_index;
+
/* Loop old data-block and separate parts. */
if (ELEM(mode, GP_SEPARATE_POINT, GP_SEPARATE_STROKE)) {
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
More information about the Bf-blender-cvs
mailing list