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
This commit is contained in:
Antonio Vazquez 2020-10-27 17:44:29 +01:00
parent 3a7a936525
commit c80594f57f
3 changed files with 15 additions and 0 deletions

View File

@ -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);
}

View File

@ -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 {

View File

@ -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");