Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2021-12-08 12:31:57 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-12-08 18:10:07 +0300
commit72b39d3f920072b6a568c63c26e35d444cfcb6f3 (patch)
tree8370efe3e066c6a6ab243fb7ebe2f5cf80a67d08 /source/blender/editors/gpencil/gpencil_edit.c
parente23b54a59f0428399bbf4de5ba007ad764fa80be (diff)
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
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index a4931ed6007..7dad83e305f 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"
@@ -4569,6 +4570,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) {