[Bf-blender-cvs] [e52b914782b] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonioya
noreply at git.blender.org
Sun Aug 26 17:27:31 CEST 2018
Commit: e52b914782b792c97ebb999eddca014cdee8b5e2
Author: Antonioya
Date: Sun Aug 26 16:49:26 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBe52b914782b792c97ebb999eddca014cdee8b5e2
Merge branch 'blender2.8' into greasepencil-object
Conflicts:
source/blender/blenkernel/intern/gpencil_modifier.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_fill.c
source/blender/editors/gpencil/gpencil_paint.c
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/gpencil_modifier.c
index 752147ae8a9,fd1170c1a9c..7957420bb48
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@@ -231,13 -235,13 +235,14 @@@ static void gpencil_rdp_stroke(bGPDstro
bGPDspoint *pt_src = &old_points[i];
bGPDspoint *pt = &gps->points[j];
- MDeformVert *dvert_src = &old_dvert[i];
- MDeformVert *dvert = &gps->dvert[j];
-
if ((marked[i]) || (i == 0) || (i == totpoints - 1)) {
memcpy(pt, pt_src, sizeof(bGPDspoint));
- memcpy(dvert, dvert_src, sizeof(MDeformVert));
- memcpy(dvert->dw, dvert_src->dw, sizeof(MDeformWeight));
+ if (gps->dvert != NULL) {
+ dvert_src = &old_dvert[i];
+ MDeformVert *dvert = &gps->dvert[j];
+ memcpy(dvert, dvert_src, sizeof(MDeformVert));
++ memcpy(dvert->dw, dvert_src->dw, sizeof(MDeformWeight));
+ }
j++;
}
else {
@@@ -306,10 -310,11 +311,12 @@@ void BKE_gpencil_simplify_fixed(bGPDstr
if ((i == 0) || (i == gps->totpoints - 1) || ((i % 2) > 0.0)) {
memcpy(pt, pt_src, sizeof(bGPDspoint));
- memcpy(dvert, dvert_src, sizeof(MDeformVert));
- memcpy(dvert->dw, dvert_src->dw, sizeof(MDeformWeight));
+ if (gps->dvert != NULL) {
+ dvert_src = &old_dvert[i];
+ MDeformVert *dvert = &gps->dvert[j];
+ memcpy(dvert, dvert_src, sizeof(MDeformVert));
++ memcpy(dvert->dw, dvert_src->dw, sizeof(MDeformWeight));
+ }
j++;
}
else {
diff --cc source/blender/editors/gpencil/gpencil_edit.c
index af371a95f50,d8fb5bed5af..88a73fef26e
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@@ -2920,9 -2920,9 +2920,11 @@@ static int gp_stroke_subdivide_exec(bCo
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDspoint *temp_points;
+ MDeformVert *temp_dverts;
+
const int cuts = RNA_int_get(op->ptr, "number_cuts");
+ MDeformVert *temp_dvert = NULL;
+ MDeformVert *dvert_final = NULL;
int totnewpoints, oldtotpoints;
int i2;
@@@ -2943,13 -2943,10 +2945,15 @@@
}
/* duplicate points in a temp area */
temp_points = MEM_dupallocN(gps->points);
+ if (gps->dvert == NULL) {
+ gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, "gp_stroke_weights");
+ }
+ temp_dverts = MEM_dupallocN(gps->dvert);
+
oldtotpoints = gps->totpoints;
-
+ if (gps->dvert != NULL) {
+ temp_dvert = MEM_dupallocN(gps->dvert);
+ }
/* resize the points arrys */
gps->totpoints += totnewpoints;
gps->points = MEM_recallocN(gps->points, sizeof(*gps->points) * gps->totpoints);
@@@ -2961,10 -2959,12 +2965,13 @@@
i2 = 0;
for (int i = 0; i < oldtotpoints; i++) {
bGPDspoint *pt = &temp_points[i];
+ MDeformVert *dvert = &temp_dverts[i];
bGPDspoint *pt_final = &gps->points[i2];
- MDeformVert *dvert_final = &gps->dvert[i2];
+ MDeformVert *dvert = NULL;
+ if (gps->dvert != NULL) {
+ dvert = &temp_dvert[i];
+ }
/* copy current point */
copy_v3_v3(&pt_final->x, &pt->x);
@@@ -2995,19 -2997,10 +3005,20 @@@
pt_final->time = interpf(pt->time, next->time, 0.5f);
pt_final->flag |= GP_SPOINT_SELECT;
- dvert_final->totweight = dvert->totweight;
- dvert_final->dw = MEM_dupallocN(dvert->dw);
-
- /* interpolate weight values */
- for (int d = 0; d < dvert->totweight; d++) {
- MDeformWeight *dw_a = &dvert->dw[d];
- if (dvert_next->totweight > d) {
- MDeformWeight *dw_b = &dvert_next->dw[d];
- MDeformWeight *dw_final = &dvert_final->dw[d];
- dw_final->weight= interpf(dw_a->weight,dw_b->weight, 0.5f);
+ if (gps->dvert != NULL) {
- dvert_final->totweight = 0;
- dvert_final->dw = NULL;
++ dvert_final->totweight = dvert->totweight;
++ dvert_final->dw = MEM_dupallocN(dvert->dw);
++
++ /* interpolate weight values */
++ for (int d = 0; d < dvert->totweight; d++) {
++ MDeformWeight *dw_a = &dvert->dw[d];
++ if (dvert_next->totweight > d) {
++ MDeformWeight *dw_b = &dvert_next->dw[d];
++ MDeformWeight *dw_final = &dvert_final->dw[d];
++ dw_final->weight = interpf(dw_a->weight, dw_b->weight, 0.5f);
++ }
+ }
}
-
i2++;
}
}
diff --cc source/blender/editors/gpencil/gpencil_paint.c
index 5481ae85f7c,aa163e02cfe..8643fc03786
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@@ -788,12 -792,9 +794,14 @@@ static short gp_stroke_addpoint
pts->uv_fac = pt->uv_fac;
pts->uv_rot = pt->uv_rot;
- if (gps->dvert != NULL) {
- dvert->totweight = 0;
- dvert->dw = NULL;
+ if ((ts->gpencil_flags & GP_TOOL_FLAG_CREATE_WEIGHTS) && (is_weight)) {
+ BKE_gpencil_vgroup_add_point_weight(dvert, def_nr, ts->vgroup_weight);
+ }
+ else {
- dvert->totweight = 0;
- dvert->dw = NULL;
++ if (gps->dvert != NULL) {
++ dvert->totweight = 0;
++ dvert->dw = NULL;
++ }
}
/* force fill recalc */
@@@ -981,17 -981,14 +990,21 @@@ static void gp_stroke_newfrombuffer(tGP
pt->strength = ptc->strength;
CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f);
pt->time = ptc->time;
+ pt++;
- if (dvert != NULL) {
- dvert->totweight = 0;
- dvert->dw = NULL;
-
+ if ((ts->gpencil_flags & GP_TOOL_FLAG_CREATE_WEIGHTS) && (is_weight)) {
+ BKE_gpencil_vgroup_add_point_weight(dvert, def_nr, ts->vgroup_weight);
+ dvert++;
}
+ else {
- dvert->totweight = 0;
- dvert->dw = NULL;
++ if (dvert != NULL) {
++ dvert->totweight = 0;
++ dvert->dw = NULL;
++ dvert++;
++ }
+ }
+
- pt++;
- dvert++;
++ }
}
if (totelem == 2) {
@@@ -1006,12 -1003,9 +1019,14 @@@
CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f);
pt->time = ptc->time;
- if (dvert != NULL) {
- dvert->totweight = 0;
- dvert->dw = NULL;
+ if ((ts->gpencil_flags & GP_TOOL_FLAG_CREATE_WEIGHTS) && (is_weight)) {
+ BKE_gpencil_vgroup_add_point_weight(dvert, def_nr, ts->vgroup_weight);
+ }
+ else {
- dvert->totweight = 0;
- dvert->dw = NULL;
++ if (dvert != NULL) {
++ dvert->totweight = 0;
++ dvert->dw = NULL;
++ }
}
}
@@@ -1039,14 -1033,10 +1054,16 @@@
CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f);
pt->time = ptc->time;
- if (dvert != NULL) {
- dvert->totweight = 0;
- dvert->dw = NULL;
+ if ((ts->gpencil_flags & GP_TOOL_FLAG_CREATE_WEIGHTS) && (is_weight)) {
+ BKE_gpencil_vgroup_add_point_weight(dvert, def_nr, ts->vgroup_weight);
+ }
+ else {
- dvert->totweight = 0;
- dvert->dw = NULL;
++ if (dvert != NULL) {
++ dvert->totweight = 0;
++ dvert->dw = NULL;
++ }
}
+
}
else {
float *depth_arr = NULL;
More information about the Bf-blender-cvs
mailing list