[Bf-blender-cvs] [030e86768b0] greasepencil-edit-curve: GPencil: Use GPencil Theme colors for Bezier control points

Antonio Vazquez noreply at git.blender.org
Thu Jul 16 17:24:28 CEST 2020


Commit: 030e86768b0acfb74e488e099673e4926c19953b
Author: Antonio Vazquez
Date:   Thu Jul 16 17:24:20 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB030e86768b0acfb74e488e099673e4926c19953b

GPencil: Use GPencil Theme colors for Bezier control points

To flag the point the FREESTYLE flag is reused because the limit is 8 flags and all are already use it. As this handles never are displayed at the same time that freestyle is totally sure to reuse it.

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

M	source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl
M	source/blender/draw/intern/draw_cache_impl_gpencil.c

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

diff --git a/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl
index a811fcca0d4..6b4edbfe578 100644
--- a/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl
@@ -17,16 +17,17 @@ void main()
 {
   GPU_INTEL_VERTEX_SHADER_WORKAROUND
 
+  /* Reuse the FREESTYLE flag to determine is GPencil. */
   if ((data & VERT_SELECTED) != 0) {
     if ((data & VERT_ACTIVE) != 0) {
       finalColor = colorEditMeshActive;
     }
     else {
-      finalColor = colorVertexSelect;
+      finalColor = ((data & EDGE_FREESTYLE) == 0) ? colorVertexSelect : colorGpencilVertexSelect;
     }
   }
   else {
-    finalColor = colorVertex;
+    finalColor = ((data & EDGE_FREESTYLE) == 0) ? colorVertex : colorGpencilVertex;
   }
 
   vec3 world_pos = point_object_to_world(pos);
diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c
index d7732c6e20d..b9d18972b9e 100644
--- a/source/blender/draw/intern/draw_cache_impl_gpencil.c
+++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c
@@ -757,6 +757,9 @@ static char gpencil_beztriple_vflag_get(char flag,
   SET_FLAG_FROM_TEST(vflag, (flag & SELECT), VFLAG_VERT_SELECTED);
   SET_FLAG_FROM_TEST(vflag, handle_point, BEZIER_HANDLE);
   SET_FLAG_FROM_TEST(vflag, handle_selected, VFLAG_VERT_SELECTED_BEZT_HANDLE);
+  /* Reuse flag of Freestyle to indicate is GPencil data. */
+  vflag |= VFLAG_EDGE_FREESTYLE;
+
   /* Handle color id. */
   vflag |= col_id << COLOR_SHIFT;
   return vflag;



More information about the Bf-blender-cvs mailing list