[Bf-blender-cvs] [da3928312a7] greasepencil-object: Gpencil: Add BKE_gpencil_add_stroke_existing_style() function.

YimingWu noreply at git.blender.org
Wed Oct 30 13:02:24 CET 2019


Commit: da3928312a7510cac6e67cf593a91b66bd0aedb3
Author: YimingWu
Date:   Wed Oct 30 19:49:18 2019 +0800
Branches: greasepencil-object
https://developer.blender.org/rBda3928312a7510cac6e67cf593a91b66bd0aedb3

Gpencil: Add BKE_gpencil_add_stroke_existing_style() function.

This additionally copies the temp drawing color fields in gps->runtime.
So that when adding new strokes in the modifier the style is preserved.

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

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/addons_contrib
M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/intern/gpencil.c
M	source/tools

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

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 8a05b618f03..ad82c4ce43e 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 8a05b618f031582c006c6f62b9e60619ab3eef8b
+Subproject commit ad82c4ce43ef2801ef51e75af1f9702992478b02
diff --git a/release/scripts/addons b/release/scripts/addons
index acfe2a22e07..8e6f485cf5b 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit acfe2a22e07046564cc5788388c2404486c76fe9
+Subproject commit 8e6f485cf5b160c425d7da7c743879b20f3d6a96
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 786f4704328..7077ff07384 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 786f4704328507a95b6c1d254bf4cf400a5e8f0c
+Subproject commit 7077ff07384491d1f7630484995557f1c7302dae
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index d09917a9e41..8c02ff37311 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -125,6 +125,12 @@ struct bGPDstroke *BKE_gpencil_add_stroke(struct bGPDframe *gpf,
                                           int totpoints,
                                           short thickness);
 
+struct bGPDstroke *BKE_gpencil_add_stroke_existing_style(struct bGPDframe *gpf,
+                                                         struct bGPDstroke *existing,
+                                                         int mat_idx,
+                                                         int totpoints,
+                                                         short thickness);
+
 /* Stroke and Fill - Alpha Visibility Threshold */
 #define GPENCIL_ALPHA_OPACITY_THRESH 0.001f
 #define GPENCIL_STRENGTH_MIN 0.003f
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 29dfb2ceb52..07bc7716593 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -507,6 +507,18 @@ bGPDstroke *BKE_gpencil_add_stroke(bGPDframe *gpf, int mat_idx, int totpoints, s
   return gps;
 }
 
+/* Add a stroke and copy the temporary drawing color value from one of the existing stroke */
+bGPDstroke *BKE_gpencil_add_stroke_existing_style(
+    bGPDframe *gpf, bGPDstroke *existing, int mat_idx, int totpoints, short thickness)
+{
+  bGPDstroke *gps = BKE_gpencil_add_stroke(gpf, mat_idx, totpoints, thickness);
+  /* Copy runtime color data so that strokes added in the modifier has the style.
+   * There are depsgrapgh reference pointers inside,
+   * change the copy function if interfere with future drawing implementation. */
+  memcpy(&gps->runtime, &existing->runtime, sizeof(bGPDstroke_Runtime));
+  return gps;
+}
+
 /* ************************************************** */
 /* Data Duplication */
 
diff --git a/source/tools b/source/tools
index ce943dad8a2..2afbb8ec472 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit ce943dad8a21b4784e2dcef12d8f893473cddb7f
+Subproject commit 2afbb8ec472cac5102eb239f57b006f8c9387685



More information about the Bf-blender-cvs mailing list