[Bf-blender-cvs] [ec009507a41] temp-npr-gpencil-modifiers: Gpencil: layer/material influence for lenght modifier.
YimingWu
noreply at git.blender.org
Sun Sep 15 15:58:57 CEST 2019
Commit: ec009507a419fbfe7d1e90408e78865170865663
Author: YimingWu
Date: Sun Sep 15 21:58:14 2019 +0800
Branches: temp-npr-gpencil-modifiers
https://developer.blender.org/rBec009507a419fbfe7d1e90408e78865170865663
Gpencil: layer/material influence for lenght modifier.
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
M source/blender/makesdna/DNA_gpencil_modifier_types.h
M source/blender/makesrna/intern/rna_gpencil_modifier.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index badbdc5769d..5acbba691ec 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -2335,6 +2335,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
def GP_LENGTH(self, layout, ob, md):
+ gpd = ob.data
sp = layout.split()
col = sp.column()
col.label(text="Absolute:")
@@ -2343,6 +2344,28 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
col = sp.column()
col.label(text="Relative:")
col.prop(md, "percentage")
+
+ col = layout.column()
+ col.separator()
+
+ col.label(text="Material:")
+ row = col.row(align=True)
+ row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
+ row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
+ row = layout.row(align=True)
+ row.prop(md, "pass_index", text="Pass")
+ row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
+
+ col = layout.column()
+ col.separator()
+
+ col.label(text="Layer:")
+ row = col.row(align=True)
+ row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
+ row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
+ row = layout.row(align=True)
+ row.prop(md, "layer_pass", text="Pass")
+ row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
def GP_MULTIPLY(self, layout, ob, md):
sp = layout.split(factor = 0.5)
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
index c019245a3da..3bf7383000b 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
@@ -108,7 +108,20 @@ static void bakeModifier(Main *UNUSED(bmain),
LengthGpencilModifierData *lmd = (LengthGpencilModifierData *)md;
bGPDstroke *gps;
for (gps = gpf->strokes.first; gps; gps = gps->next) {
- applyLength(gps, lmd->length, lmd->percentage);
+ if (is_stroke_affected_by_modifier(ob,
+ lmd->layername,
+ lmd->materialname,
+ lmd->pass_index,
+ lmd->layer_pass,
+ 1,
+ gpl,
+ gps,
+ lmd->flag & GP_MIRROR_INVERT_LAYER,
+ lmd->flag & GP_MIRROR_INVERT_PASS,
+ lmd->flag & GP_MIRROR_INVERT_LAYERPASS,
+ lmd->flag & GP_MIRROR_INVERT_MATERIAL)){
+ applyLength(gps, lmd->length, lmd->percentage);
+ }
}
return;
}
@@ -126,7 +139,20 @@ static void deformStroke(GpencilModifierData *md,
bGPDstroke *gps)
{
LengthGpencilModifierData *lmd = (LengthGpencilModifierData *)md;
- applyLength(gps, lmd->length, lmd->percentage);
+ if (is_stroke_affected_by_modifier(ob,
+ lmd->layername,
+ lmd->materialname,
+ lmd->pass_index,
+ lmd->layer_pass,
+ 1,
+ gpl,
+ gps,
+ lmd->flag & GP_MIRROR_INVERT_LAYER,
+ lmd->flag & GP_MIRROR_INVERT_PASS,
+ lmd->flag & GP_MIRROR_INVERT_LAYERPASS,
+ lmd->flag & GP_MIRROR_INVERT_MATERIAL)){
+ applyLength(gps, lmd->length, lmd->percentage);
+ }
}
GpencilModifierTypeInfo modifierType_Gpencil_Length = {
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 7e7c3d02a40..12c776fac2b 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -647,6 +647,19 @@ typedef struct ArmatureGpencilModifierData {
typedef struct LengthGpencilModifierData {
GpencilModifierData modifier;
+ /* What's this object for ? */
+ struct Object *object;
+ /** Layer name. */
+ char layername[64];
+ /** Material name. */
+ char materialname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Flags. */
+ int flag;
+ /** Custom index for passes. */
+ int layer_pass;
+ char _pad[4];
float length;
float percentage;
} LengthGpencilModifierData;
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 0e74a536564..2bbe3176208 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -1890,6 +1890,55 @@ static void rna_def_modifier_gpencillength(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "LengthGpencilModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "materialname");
+ RNA_def_property_ui_text(prop, "Material", "Material name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ 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_MIRROR_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_MIRROR_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_MIRROR_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ 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_MIRROR_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Object used as center");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_MirrorGpencilModifier_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -10.0f, 10.0f);
RNA_def_property_ui_text(prop, "Length", "Length of each segment");
More information about the Bf-blender-cvs
mailing list