[Bf-blender-cvs] [70f3ff808ac] master: GPencil: Rename property Follow Drawing Path to Alignment

Antonioya noreply at git.blender.org
Tue May 14 17:28:46 CEST 2019


Commit: 70f3ff808ac591b4e9c7c71583ce1032024b9e4f
Author: Antonioya
Date:   Tue May 14 17:28:31 2019 +0200
Branches: master
https://developer.blender.org/rB70f3ff808ac591b4e9c7c71583ce1032024b9e4f

GPencil: Rename property Follow Drawing Path to Alignment

The old name was not clear and with new options the new name is more easy to understand.

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

M	release/scripts/startup/bl_ui/properties_material_gpencil.py
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
M	source/blender/makesdna/DNA_material_types.h
M	source/blender/makesrna/intern/rna_material.c

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

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 3ba18049a2e..acf44cdc260 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -157,7 +157,7 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
                 col.prop(gpcolor, "color", text="Color")
 
             if gpcolor.mode in {'DOTS', 'BOX'}:
-                col.prop(gpcolor, "use_follow_path", text="Follow Drawing Path")
+                col.prop(gpcolor, "alignment_mode")
 
 
 class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index cc0c5e114bf..7b2c0ed168e 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -134,7 +134,7 @@ void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be,
                                 bGPDstroke *gps,
                                 short thickness,
                                 const float ink[4],
-                                const int follow_mode)
+                                const int alignment_mode)
 {
   int totvertex = gps->totpoints;
   if (be->vbo == NULL) {
@@ -178,7 +178,7 @@ void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be,
     /* use previous point to determine stroke direction */
     bGPDspoint *pt2 = NULL;
     float fpt[3];
-    if (follow_mode != GP_STYLE_FOLLOW_PATH) {
+    if (alignment_mode != GP_STYLE_FOLLOW_PATH) {
       /* add small offset to get a vector */
       copy_v3_v3(fpt, &pt->x);
       fpt[0] += 0.00001f;
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 5747de72d7a..71e83dac461 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -725,8 +725,8 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data,
     DRW_shgroup_uniform_float(grp, "mix_stroke_factor", &stl->shgroups[id].mix_stroke_factor, 1);
 
     /* lock rotation of dots and boxes */
-    stl->shgroups[id].follow_mode = gp_style->follow_mode;
-    DRW_shgroup_uniform_int(grp, "follow_mode", &stl->shgroups[id].follow_mode, 1);
+    stl->shgroups[id].alignment_mode = gp_style->alignment_mode;
+    DRW_shgroup_uniform_int(grp, "alignment_mode", &stl->shgroups[id].alignment_mode, 1);
   }
   else {
     stl->storage->obj_scale = 1.0f;
@@ -758,7 +758,7 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data,
     DRW_shgroup_uniform_float(grp, "mix_stroke_factor", &stl->storage->mix_stroke_factor, 1);
 
     /* lock rotation of dots and boxes */
-    DRW_shgroup_uniform_int(grp, "follow_mode", &stl->storage->follow_mode, 1);
+    DRW_shgroup_uniform_int(grp, "alignment_mode", &stl->storage->alignment_mode, 1);
   }
 
   DRW_shgroup_uniform_vec4(grp, "colormix", gp_style->stroke_rgba, 1);
@@ -870,7 +870,7 @@ static void gpencil_add_stroke_vertexdata(GpencilBatchCache *cache,
   float ink[4];
   short sthickness;
   MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
-  const int follow_mode = (gp_style) ? gp_style->follow_mode : GP_STYLE_FOLLOW_PATH;
+  const int alignment_mode = (gp_style) ? gp_style->alignment_mode : GP_STYLE_FOLLOW_PATH;
 
   /* set color using base color, tint color and opacity */
   if (cache->is_dirty) {
@@ -920,7 +920,7 @@ static void gpencil_add_stroke_vertexdata(GpencilBatchCache *cache,
     else {
       /* create vertex data */
       const int old_len = cache->b_point.vbo_len;
-      DRW_gpencil_get_point_geom(&cache->b_point, gps, sthickness, ink, follow_mode);
+      DRW_gpencil_get_point_geom(&cache->b_point, gps, sthickness, ink, alignment_mode);
 
       /* add to list of groups */
       if (old_len < cache->b_point.vbo_len) {
@@ -1491,7 +1491,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
       /* save gradient info */
       stl->storage->gradient_f = brush->gpencil_settings->gradient_f;
       copy_v2_v2(stl->storage->gradient_s, brush->gpencil_settings->gradient_s);
-      stl->storage->follow_mode = (gp_style) ? gp_style->follow_mode : GP_STYLE_FOLLOW_PATH;
+      stl->storage->alignment_mode = (gp_style) ? gp_style->alignment_mode : GP_STYLE_FOLLOW_PATH;
 
       /* if only one point, don't need to draw buffer because the user has no time to see it */
       if (gpd->runtime.sbuffer_size > 1) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index b4df86b5a4c..9ebd168bc4c 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -129,7 +129,7 @@ typedef struct GPENCIL_shgroup {
   int caps_mode[2];
   float obj_scale;
   int xray_mode;
-  int follow_mode;
+  int alignment_mode;
 
   float gradient_f;
   float gradient_s[2];
@@ -182,7 +182,7 @@ typedef struct GPENCIL_Storage {
 
   float gradient_f;
   float gradient_s[2];
-  int follow_mode;
+  int alignment_mode;
 
   float mix_stroke_factor;
 
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
index fed24665be5..a2f4c1f9b15 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl
@@ -1,6 +1,6 @@
 uniform vec2 Viewport;
 uniform int xraymode;
-uniform int follow_mode;
+uniform int alignment_mode;
 
 layout(points) in;
 layout(triangle_strip, max_vertices = 4) out;
@@ -20,8 +20,8 @@ out vec2 mTexCoord;
 #define M_2PI 6.28318530717958647692 /* 2*pi */
 #define FALSE 0
 
-/* keep this definition equals to GP_STYLE_FOLLOW_NONE value */
-#define NONE 2
+/* keep this definition equals to GP_STYLE_FOLLOW_FIXED value */
+#define FIXED 2
 
 /* project 3d point to 2d on screen space */
 vec2 toScreenSpace(vec4 vertex)
@@ -72,7 +72,7 @@ float getAngle(vec2 pt0, vec2 pt1)
     return 0.0;
   }
 
-  if (follow_mode == NONE) {
+  if (alignment_mode == FIXED) {
     return 0.0;
   }
 
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 454ded28f8e..cbfe88a6ca3 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -99,8 +99,8 @@ typedef struct MaterialGPencilStyle {
 
   /** Factor used to mix texture and stroke color. */
   float mix_stroke_factor;
-  /** Mode used to follow stroke drawing path by textures */
-  int follow_mode;
+  /** Mode used to align Dots and Boxes with stroke drawing path and object rotation */
+  int alignment_mode;
   char _pad[4];
 } MaterialGPencilStyle;
 
@@ -352,6 +352,6 @@ enum {
 enum {
   GP_STYLE_FOLLOW_PATH = 0,
   GP_STYLE_FOLLOW_OBJ,
-  GP_STYLE_FOLLOW_NONE,
+  GP_STYLE_FOLLOW_FIXED,
 };
 #endif
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index a27ed00228e..4a449463d4d 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -440,10 +440,14 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
       {0, NULL, 0, NULL, NULL},
   };
 
-  static EnumPropertyItem follow_draw_items[] = {
+  static EnumPropertyItem alignment_draw_items[] = {
       {GP_STYLE_FOLLOW_PATH, "PATH", 0, "Path", "Follow stroke drawing path and object rotation"},
       {GP_STYLE_FOLLOW_OBJ, "OBJECT", 0, "Object", "Follow object rotation only"},
-      {GP_STYLE_FOLLOW_NONE, "NONE", 0, "None", "Do not follow drawing path or object rotation"},
+      {GP_STYLE_FOLLOW_FIXED,
+       "FIXED",
+       0,
+       "Fixed",
+       "Do not follow drawing path or object rotation and keeps aligned with viewport"},
       {0, NULL, 0, NULL, NULL},
   };
 
@@ -619,11 +623,11 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
   RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
 
   /* Mode to align Dots and Boxes to drawing path and object rotation */
-  prop = RNA_def_property(srna, "use_follow_path", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_bitflag_sdna(prop, NULL, "follow_mode");
-  RNA_def_property_enum_items(prop, follow_draw_items);
+  prop = RNA_def_property(srna, "alignment_mode", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_bitflag_sdna(prop, NULL, "alignment_mode");
+  RNA_def_property_enum_items(prop, alignment_draw_items);
   RNA_def_property_ui_text(
-      prop, "Follow Path", "Rotate Dots and Boxes aligned to drawing path and object rotation");
+      prop, "Alignment", "Defines how align Dots and Boxes with drawing path and object rotation");
   RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
 
   /* pass index for future compositing and editing tools */



More information about the Bf-blender-cvs mailing list