diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-10-27 19:44:29 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-10-27 19:59:48 +0300 |
commit | c80594f57f1e5b73536f16e480a3bb459935848d (patch) | |
tree | 70b38dd888f4fb536c838c50fa505a3300b3b01f /source/blender | |
parent | 3a7a9365259e30b43bfbbadceb2789b7bcee8dd2 (diff) |
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
Diffstat (limited to 'source/blender')
3 files changed, 15 insertions, 0 deletions
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"); |