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:
authorAntonio Vazquez <blendergit@gmail.com>2022-04-14 22:51:21 +0300
committerAntonio Vazquez <blendergit@gmail.com>2022-04-14 22:51:38 +0300
commit48ff456a4bda98d73042b0ef85091cf79aad8647 (patch)
tree03c27b885ca98d14dfa118cc507b24c8fe6a4f02
parent48d2f536e182468c26a81ec2c2af2638e6768bb0 (diff)
Fix T96875: Envelope modifier strokes cannot be eselected with Tweak
The new created strokes were not setting the right `orig` pointers, so the select operator could not select the strokes and points. Now, the original pointers are set in the new strokes. To set the values is necessary assign the original pointer from the reference stroke because in modifiers the stroke is evaluated, so we need back two levels: Eval->Eval->Orig
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c
index efbec4222aa..8b0a6ee84a2 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c
@@ -344,6 +344,7 @@ static void add_stroke(Object *ob,
const int size = size1 + size2;
bGPdata *gpd = ob->data;
bGPDstroke *gps_dst = BKE_gpencil_stroke_new(mat_nr, size, gps->thickness);
+ gps_dst->runtime.gps_orig = gps->runtime.gps_orig;
memcpy(&gps_dst->points[0], &gps->points[connection_index], size1 * sizeof(bGPDspoint));
memcpy(&gps_dst->points[size1], &gps->points[point_index], size2 * sizeof(bGPDspoint));
@@ -351,7 +352,6 @@ static void add_stroke(Object *ob,
for (int i = 0; i < size; i++) {
gps_dst->points[i].pressure *= thickness;
gps_dst->points[i].strength *= strength;
- memset(&gps_dst->points[i].runtime, 0, sizeof(bGPDspoint_Runtime));
}
if (gps->dvert != NULL) {
@@ -378,6 +378,8 @@ static void add_stroke_cyclic(Object *ob,
{
bGPdata *gpd = ob->data;
bGPDstroke *gps_dst = BKE_gpencil_stroke_new(mat_nr, size * 2, gps->thickness);
+ gps_dst->runtime.gps_orig = gps->runtime.gps_orig;
+
if (gps->dvert != NULL) {
gps_dst->dvert = MEM_malloc_arrayN(size * 2, sizeof(MDeformVert), __func__);
}
@@ -387,7 +389,16 @@ static void add_stroke_cyclic(Object *ob,
int b = (point_index + i) % gps->totpoints;
gps_dst->points[i] = gps->points[a];
+ bGPDspoint *pt_dst = &gps_dst->points[i];
+ bGPDspoint *pt_orig = &gps->points[a];
+ pt_dst->runtime.pt_orig = pt_orig->runtime.pt_orig;
+ pt_dst->runtime.idx_orig = pt_orig->runtime.idx_orig;
+
gps_dst->points[size + i] = gps->points[b];
+ pt_dst = &gps_dst->points[size + i];
+ pt_orig = &gps->points[b];
+ pt_dst->runtime.pt_orig = pt_orig->runtime.pt_orig;
+ pt_dst->runtime.idx_orig = pt_orig->runtime.idx_orig;
if (gps->dvert != NULL) {
BKE_defvert_array_copy(&gps_dst->dvert[i], &gps->dvert[a], 1);
@@ -417,15 +428,23 @@ static void add_stroke_simple(Object *ob,
{
bGPdata *gpd = ob->data;
bGPDstroke *gps_dst = BKE_gpencil_stroke_new(mat_nr, 2, gps->thickness);
+ gps_dst->runtime.gps_orig = gps->runtime.gps_orig;
gps_dst->points[0] = gps->points[connection_index];
gps_dst->points[0].pressure *= thickness;
gps_dst->points[0].strength *= strength;
- memset(&gps_dst->points[0].runtime, 0, sizeof(bGPDspoint_Runtime));
+ bGPDspoint *pt_dst = &gps_dst->points[0];
+ bGPDspoint *pt_orig = &gps->points[connection_index];
+ pt_dst->runtime.pt_orig = pt_orig->runtime.pt_orig;
+ pt_dst->runtime.idx_orig = pt_orig->runtime.idx_orig;
+
gps_dst->points[1] = gps->points[point_index];
gps_dst->points[1].pressure *= thickness;
gps_dst->points[1].strength *= strength;
- memset(&gps_dst->points[1].runtime, 0, sizeof(bGPDspoint_Runtime));
+ pt_dst = &gps_dst->points[1];
+ pt_orig = &gps->points[point_index];
+ pt_dst->runtime.pt_orig = pt_orig->runtime.pt_orig;
+ pt_dst->runtime.idx_orig = pt_orig->runtime.idx_orig;
if (gps->dvert != NULL) {
gps_dst->dvert = MEM_malloc_arrayN(2, sizeof(MDeformVert), __func__);