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.
This commit is contained in:
Antonioya
2019-05-14 17:28:31 +02:00
parent 0d2e708ea4
commit 70f3ff808a
7 changed files with 28 additions and 24 deletions

View File

@@ -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):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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 */