GPencil: Cyclic flag for dot dash modifier
Cyclic option per segment, allows interesting "loop" visual effects. Reviewed by: Antonio Vazquez (antoniov) Differential Revision: https://developer.blender.org/D14439
This commit is contained in:
parent
d4e1458db3
commit
97f2210157
|
@ -148,6 +148,9 @@ static bool stroke_dash(const bGPDstroke *gps,
|
|||
|
||||
bGPDstroke *stroke = BKE_gpencil_stroke_new(
|
||||
ds->mat_nr < 0 ? gps->mat_nr : ds->mat_nr, size, gps->thickness);
|
||||
if (ds->flag & GP_DASH_USE_CYCLIC) {
|
||||
stroke->flag |= GP_STROKE_CYCLIC;
|
||||
}
|
||||
|
||||
for (int is = 0; is < size; is++) {
|
||||
bGPDspoint *p = &gps->points[new_stroke_offset + is];
|
||||
|
@ -337,6 +340,7 @@ static void panel_draw(const bContext *C, Panel *panel)
|
|||
uiItemR(sub, &ds_ptr, "radius", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, &ds_ptr, "opacity", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, &ds_ptr, "material_index", 0, NULL, ICON_NONE);
|
||||
uiItemR(sub, &ds_ptr, "use_cyclic", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
gpencil_modifier_panel_end(layout, ptr);
|
||||
|
|
|
@ -522,7 +522,7 @@ typedef struct DashGpencilModifierSegment {
|
|||
float radius;
|
||||
float opacity;
|
||||
int mat_nr;
|
||||
int _pad;
|
||||
int flag;
|
||||
} DashGpencilModifierSegment;
|
||||
|
||||
typedef struct DashGpencilModifierData {
|
||||
|
@ -546,6 +546,14 @@ typedef struct DashGpencilModifierData {
|
|||
|
||||
} DashGpencilModifierData;
|
||||
|
||||
typedef enum eDashGpencil_Flag {
|
||||
GP_DASH_INVERT_LAYER = (1 << 0),
|
||||
GP_DASH_INVERT_PASS = (1 << 1),
|
||||
GP_DASH_INVERT_LAYERPASS = (1 << 2),
|
||||
GP_DASH_INVERT_MATERIAL = (1 << 3),
|
||||
GP_DASH_USE_CYCLIC = (1 << 7),
|
||||
} eDashGpencil_Flag;
|
||||
|
||||
typedef struct MirrorGpencilModifierData {
|
||||
GpencilModifierData modifier;
|
||||
struct Object *object;
|
||||
|
|
|
@ -3743,6 +3743,11 @@ static void rna_def_modifier_gpencildash(BlenderRNA *brna)
|
|||
"Use this index on generated segment. -1 means using the existing material");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DASH_USE_CYCLIC);
|
||||
RNA_def_property_ui_text(prop, "Use Cyclic", "Enable cyclic on individual stroke dashes");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
srna = RNA_def_struct(brna, "DashGpencilModifierData", "GpencilModifier");
|
||||
RNA_def_struct_ui_text(srna, "Dash Modifier", "Create dot-dash effect for strokes");
|
||||
RNA_def_struct_sdna(srna, "DashGpencilModifierData");
|
||||
|
@ -3794,17 +3799,17 @@ static void rna_def_modifier_gpencildash(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_LAYER);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DASH_INVERT_LAYER);
|
||||
RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "invert_materials", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_MATERIAL);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DASH_INVERT_MATERIAL);
|
||||
RNA_def_property_ui_text(prop, "Inverse Materials", "Inverse filter");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_PASS);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DASH_INVERT_PASS);
|
||||
RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
|
@ -3815,7 +3820,7 @@ static void rna_def_modifier_gpencildash(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_LAYERPASS);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DASH_INVERT_LAYERPASS);
|
||||
RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
|
|
Loading…
Reference in New Issue