[Bf-blender-cvs] [253c05638aa] greasepencil-object: GPencil: Use new mix_color variable in functions

Antonio Vazquez noreply at git.blender.org
Thu Oct 31 17:01:10 CET 2019


Commit: 253c05638aa18b5b2594427153e802b5cb7170a8
Author: Antonio Vazquez
Date:   Thu Oct 31 13:50:20 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB253c05638aa18b5b2594427153e802b5cb7170a8

GPencil: Use new mix_color variable in functions

Still more changes pending.

===================================================================

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_merge.c
M	source/blender/editors/gpencil/gpencil_utils.c

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 3a87c2858db..25b49fceaca 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2525,6 +2525,7 @@ bool BKE_gpencil_close_stroke(bGPDstroke *gps)
     pt->pressure = interpf(pt2->pressure, pt1->pressure, step);
     pt->strength = interpf(pt2->strength, pt1->strength, step);
     pt->flag = 0;
+    interp_v4_v4v4(pt->mix_color, pt1->mix_color, pt2->mix_color, step);
 
     /* Set weights. */
     if (gps->dvert != NULL) {
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index fe087256d25..24cb99b9b5a 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -726,6 +726,7 @@ void BKE_gpencil_subdivide(bGPDstroke *gps, int level, int flag)
       pt_final->flag = pt->flag;
       pt_final->runtime.pt_orig = pt->runtime.pt_orig;
       pt_final->runtime.idx_orig = pt->runtime.idx_orig;
+      copy_v4_v4(pt_final->mix_color, pt->mix_color);
 
       if (gps->dvert != NULL) {
         dvert = &temp_dverts[i];
@@ -749,6 +750,7 @@ void BKE_gpencil_subdivide(bGPDstroke *gps, int level, int flag)
       CLAMP(pt_final->strength, GPENCIL_STRENGTH_MIN, 1.0f);
       pt_final->time = interpf(pt->time, next->time, 0.5f);
       pt_final->runtime.pt_orig = NULL;
+      interp_v4_v4v4(pt_final->mix_color, pt->mix_color, next->mix_color, 0.5f);
 
       if (gps->dvert != NULL) {
         dvert = &temp_dverts[i];
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index c4f18c60f4d..5a8b52a6870 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -822,6 +822,7 @@ static void copy_move_point(bGPDstroke *gps,
   pt_final->flag = pt->flag;
   pt_final->uv_fac = pt->uv_fac;
   pt_final->uv_rot = pt->uv_rot;
+  copy_v4_v4(pt_final->mix_color, pt->mix_color);
 
   if (gps->dvert != NULL) {
     MDeformVert *dvert = &temp_dverts[from_idx];
@@ -2090,6 +2091,7 @@ static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDst
     pt_final->strength = pt->strength;
     pt_final->time = delta;
     pt_final->flag = pt->flag;
+    copy_v4_v4(pt_final->mix_color, pt->mix_color);
 
     /* retiming with fixed time interval (we cannot determine real time) */
     delta += 0.01f;
@@ -3019,6 +3021,7 @@ static void gpencil_flip_stroke(bGPDstroke *gps)
     pt.pressure = point->pressure;
     pt.strength = point->strength;
     pt.time = point->time;
+    copy_v4_v4(pt.mix_color, point->mix_color);
 
     /* replace first point with last point */
     point2 = &gps->points[end];
@@ -3029,6 +3032,7 @@ static void gpencil_flip_stroke(bGPDstroke *gps)
     point->pressure = point2->pressure;
     point->strength = point2->strength;
     point->time = point2->time;
+    copy_v4_v4(point->mix_color, point2->mix_color);
 
     /* replace last point with first saved before */
     point = &gps->points[end];
@@ -3039,6 +3043,7 @@ static void gpencil_flip_stroke(bGPDstroke *gps)
     point->pressure = pt.pressure;
     point->strength = pt.strength;
     point->time = pt.time;
+    copy_v4_v4(point->mix_color, pt.mix_color);
 
     end--;
   }
@@ -3069,6 +3074,7 @@ static void gpencil_stroke_copy_point(bGPDstroke *gps,
   newpoint->pressure = pressure;
   newpoint->strength = strength;
   newpoint->time = point->time + deltatime;
+  copy_v4_v4(newpoint->mix_color, point->mix_color);
 
   if (gps->dvert != NULL) {
     MDeformVert *dvert = &gps->dvert[idx];
@@ -3682,6 +3688,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
           pt_final->strength = pt->strength;
           pt_final->time = pt->time;
           pt_final->flag = pt->flag;
+          copy_v4_v4(pt_final->mix_color, pt->mix_color);
 
           if (gps->dvert != NULL) {
             dvert = &temp_dverts[i];
@@ -3705,6 +3712,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
                 pt_final->pressure = interpf(pt->pressure, next->pressure, 0.5f);
                 pt_final->strength = interpf(pt->strength, next->strength, 0.5f);
                 CLAMP(pt_final->strength, GPENCIL_STRENGTH_MIN, 1.0f);
+                interp_v4_v4v4(pt_final->mix_color, pt->mix_color, next->mix_color, 0.5f);
                 pt_final->time = interpf(pt->time, next->time, 0.5f);
                 pt_final->flag |= GP_SPOINT_SELECT;
 
diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c
index 3ce3c60a7c3..cbba50c2984 100644
--- a/source/blender/editors/gpencil/gpencil_merge.c
+++ b/source/blender/editors/gpencil/gpencil_merge.c
@@ -61,6 +61,7 @@ typedef struct tGPencilPointCache {
   float x, y, z;
   float pressure;
   float strength;
+  float mix_color[4];
 } tGPencilPointCache;
 
 /* helper function to sort points */
@@ -94,6 +95,7 @@ static void gpencil_insert_points_to_stroke(bGPDstroke *gps,
     pt_dst->uv_fac = 1.0f;
     pt_dst->uv_rot = 0;
     pt_dst->flag |= GP_SPOINT_SELECT;
+    copy_v4_v4(pt_dst->mix_color, point_elem->mix_color);
   }
 }
 
@@ -240,6 +242,7 @@ static void gpencil_calc_points_factor(bContext *C,
             copy_v3_v3(&pt2->x, &pt->x);
             pt2->pressure = pt->pressure;
             pt2->strength = pt->strength;
+            copy_v4_v4(pt2->mix_color, pt->mix_color);
             pt->flag &= ~GP_SPOINT_SELECT;
             if (clear_point) {
               pt->flag |= GP_SPOINT_TAG;
@@ -289,6 +292,7 @@ static void gpencil_calc_points_factor(bContext *C,
     copy_v3_v3(&sort_pt->x, &pt2->x);
     sort_pt->pressure = pt2->pressure;
     sort_pt->strength = pt2->strength;
+    copy_v4_v4(sort_pt->mix_color, pt2->mix_color);
 
     sort_pt->gps = gps_array[i];
 
@@ -337,6 +341,7 @@ static int gpencil_insert_to_array(tGPencilPointCache *src_array,
     dst_elem->pressure = src_elem->pressure;
     dst_elem->strength = src_elem->strength;
     dst_elem->factor = src_elem->factor;
+    copy_v4_v4(dst_elem->mix_color, src_elem->mix_color);
   }
 
   return last;
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index b194d28a8b8..05f9e7b6564 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1151,6 +1151,7 @@ void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide)
       pt_final->flag = pt->flag;
       pt_final->uv_fac = pt->uv_fac;
       pt_final->uv_rot = pt->uv_rot;
+      copy_v4_v4(pt_final->mix_color, pt->mix_color);
 
       if (gps->dvert != NULL) {
         MDeformVert *dvert = &gps->dvert[i];
@@ -1177,6 +1178,7 @@ void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide)
       pt_final->time = interpf(pt->time, next->time, 0.5f);
       pt_final->uv_fac = interpf(pt->uv_fac, next->uv_fac, 0.5f);
       pt_final->uv_rot = interpf(pt->uv_rot, next->uv_rot, 0.5f);
+      interp_v4_v4v4(pt_final->mix_color, pt->mix_color, next->mix_color, 0.5f);
 
       if (gps->dvert != NULL) {
         MDeformVert *dvert_final = &gps->dvert[i2];
@@ -2146,6 +2148,7 @@ static void gp_copy_points(bGPDstroke *gps, bGPDspoint *pt, bGPDspoint *pt_final
   pt_final->flag = pt->flag;
   pt_final->uv_fac = pt->uv_fac;
   pt_final->uv_rot = pt->uv_rot;
+  copy_v4_v4(pt_final->mix_color, pt->mix_color);
 
   if (gps->dvert != NULL) {
     MDeformVert *dvert = &gps->dvert[i];



More information about the Bf-blender-cvs mailing list