[Bf-blender-cvs] [c80594f57f1] master: GPencil: New parameter in Texture modifier to rotate Dot textures

Antonio Vazquez noreply at git.blender.org
Tue Oct 27 18:03:29 CET 2020


Commit: c80594f57f1e5b73536f16e480a3bb459935848d
Author: Antonio Vazquez
Date:   Tue Oct 27 17:44:29 2020 +0100
Branches: master
https://developer.blender.org/rBc80594f57f1e5b73536f16e480a3bb459935848d

GPencil: New parameter in Texture modifier to rotate Dot textures

This new parameter allows to rotate the texture of any Dot or Square stroke.

Differential Revision:  https://developer.blender.org/D9343

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

M	source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
index d29351646b9..35bf870b259 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltexture.c
@@ -127,6 +127,7 @@ static void deformStroke(GpencilModifierData *md,
       pt->uv_fac /= totlen;
       pt->uv_fac *= mmd->uv_scale;
       pt->uv_fac += mmd->uv_offset;
+      pt->uv_rot += mmd->alignment_rotation;
     }
   }
 }
@@ -171,6 +172,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
     col = uiLayoutColumn(layout, false);
     uiItemR(col, ptr, "fit_method", 0, IFACE_("Stroke Fit Method"), ICON_NONE);
     uiItemR(col, ptr, "uv_offset", 0, NULL, ICON_NONE);
+    uiItemR(col, ptr, "alignment_rotation", 0, NULL, ICON_NONE);
     uiItemR(col, ptr, "uv_scale", 0, IFACE_("Scale"), ICON_NONE);
   }
 
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 3a9f9bd7b66..1a83120cae9 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -780,6 +780,9 @@ typedef struct TextureGpencilModifierData {
   /** Texture fit options. */
   short fit_method;
   short mode;
+  /** Dot texture rotation */
+  float alignment_rotation;
+  char _pad[4];
 } TextureGpencilModifierData;
 
 typedef enum eTextureGpencil_Flag {
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 5592474a348..abbb55734e5 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -2263,6 +2263,16 @@ static void rna_def_modifier_gpenciltexture(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "UV Scale", "Factor to scale the UVs");
   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 
+  /* Rotation of Dot Texture. */
+  prop = RNA_def_property(srna, "alignment_rotation", PROP_FLOAT, PROP_ANGLE);
+  RNA_def_property_float_sdna(prop, NULL, "alignment_rotation");
+  RNA_def_property_float_default(prop, 0.0f);
+  RNA_def_property_range(prop, -DEG2RADF(90.0f), DEG2RADF(90.0f));
+  RNA_def_property_ui_range(prop, -DEG2RADF(90.0f), DEG2RADF(90.0f), 10, 3);
+  RNA_def_property_ui_text(
+      prop, "Rotation", "Additional rotation applied to dots and square strokes");
+  RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
   prop = RNA_def_property(srna, "fill_rotation", PROP_FLOAT, PROP_ANGLE);
   RNA_def_property_float_sdna(prop, NULL, "fill_rotation");
   RNA_def_property_ui_text(prop, "Fill Rotation", "Additional rotation of the fill UV");



More information about the Bf-blender-cvs mailing list