Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-10-28 20:08:24 +0300
committerAntonioya <blendergit@gmail.com>2018-10-28 20:20:50 +0300
commit39bc44ffc59ef1ad96893ce838c3a3484d072f44 (patch)
tree9a807126c06dd097be6ecda3968ffbcb12bf7bba /source/blender/makesrna/intern/rna_gpencil_modifier.c
parent9bcdb19a3e0270a0e8727290111e4a1d6e15a944 (diff)
GP: Refactor Instance modifier and rename to Array
The old name Instance was logic when the modifier created new object instances, but now works equal to mesh Array modifier, so the old name was not logic and must be Array. Also added a Object to use as offset similar to mesh Array modifier.
Diffstat (limited to 'source/blender/makesrna/intern/rna_gpencil_modifier.c')
-rw-r--r--source/blender/makesrna/intern/rna_gpencil_modifier.c48
1 files changed, 21 insertions, 27 deletions
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 37bcd83e8b7..0be38cbc558 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -61,7 +61,7 @@
const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = {
{0, "", 0, N_("Generate"), "" },
- {eGpencilModifierType_Instance, "GP_INSTANCE", ICON_MOD_ARRAY, "Instance", "Create grid of duplicate instances"},
+ {eGpencilModifierType_Array, "GP_ARRAY", ICON_MOD_ARRAY, "Array", "Create array of duplicate instances"},
{eGpencilModifierType_Build, "GP_BUILD", ICON_MOD_BUILD, "Build", "Create duplication of strokes"},
{eGpencilModifierType_Mirror, "GP_MIRROR", ICON_MOD_MIRROR, "Mirror", "Duplicate strokes like a mirror"},
{eGpencilModifierType_Simplify, "GP_SIMPLIFY", ICON_MOD_DECIM, "Simplify", "Simplify stroke reducing number of points"},
@@ -103,13 +103,6 @@ static const EnumPropertyItem modifier_gphook_falloff_items[] = {
{ 0, NULL, 0, NULL, NULL }
};
-static const EnumPropertyItem rna_enum_gpencil_lockshift_items[] = {
- { GP_LOCKAXIS_X, "GP_LOCKAXIS_X", 0, "X", "Use X axis" },
- { GP_LOCKAXIS_Y, "GP_LOCKAXIS_Y", 0, "Y", "Use Y axis" },
- { GP_LOCKAXIS_Z, "GP_LOCKAXIS_Z", 0, "Z", "Use Z axis" },
- { 0, NULL, 0, NULL, NULL }
-};
-
static const EnumPropertyItem rna_enum_time_mode_items[] = {
{ GP_TIME_MODE_NORMAL, "NORMAL", 0, "Normal", "Apply offset in normal animation direction" },
{ GP_TIME_MODE_REVERSE, "REVERSE", 0, "Reverse", "Apply offset in reverse animation direction" },
@@ -154,8 +147,8 @@ static StructRNA *rna_GpencilModifier_refine(struct PointerRNA *ptr)
return &RNA_TimeGpencilModifier;
case eGpencilModifierType_Color:
return &RNA_ColorGpencilModifier;
- case eGpencilModifierType_Instance:
- return &RNA_InstanceGpencilModifier;
+ case eGpencilModifierType_Array:
+ return &RNA_ArrayGpencilModifier;
case eGpencilModifierType_Build:
return &RNA_BuildGpencilModifier;
case eGpencilModifierType_Opacity:
@@ -1012,9 +1005,9 @@ static void rna_def_modifier_gpencilinstance(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "InstanceGpencilModifier", "GpencilModifier");
+ srna = RNA_def_struct(brna, "ArrayGpencilModifier", "GpencilModifier");
RNA_def_struct_ui_text(srna, "Instance Modifier", "Create grid of duplicate instances");
- RNA_def_struct_sdna(srna, "InstanceGpencilModifierData");
+ RNA_def_struct_sdna(srna, "ArrayGpencilModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
@@ -1028,13 +1021,21 @@ static void rna_def_modifier_gpencilinstance(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pass", "Pass index");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
- prop = RNA_def_property(srna, "count", PROP_INT, PROP_XYZ);
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, INT_MAX);
- RNA_def_property_ui_range(prop, 1, 20, 1, -1);
+ RNA_def_property_ui_range(prop, 1, 50, 1, -1);
RNA_def_property_ui_text(prop, "Count", "Number of items");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
/* Offset parameters */
+ prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "object");
+ RNA_def_property_ui_text(prop, "Object Offset",
+ "Use the location and rotation of another object to determine the distance and "
+ "rotational change between arrayed items");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "offset");
RNA_def_property_ui_text(prop, "Offset", "Value for the distance between items");
@@ -1047,13 +1048,6 @@ static void rna_def_modifier_gpencilinstance(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
- prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "lock_axis");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_lockshift_items);
- //RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Axis", "");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
RNA_def_property_float_sdna(prop, NULL, "rot");
RNA_def_property_ui_text(prop, "Rotation", "Value for changes in rotation");
@@ -1067,7 +1061,7 @@ static void rna_def_modifier_gpencilinstance(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "random_rot", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_INSTANCE_RANDOM_ROT);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_RANDOM_ROT);
RNA_def_property_ui_text(prop, "Random Rotation", "Use random factors for rotation");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
@@ -1078,7 +1072,7 @@ static void rna_def_modifier_gpencilinstance(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "random_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_INSTANCE_RANDOM_SIZE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_RANDOM_SIZE);
RNA_def_property_ui_text(prop, "Random Scale", "Use random factors for scale");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
@@ -1095,12 +1089,12 @@ static void rna_def_modifier_gpencilinstance(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_INSTANCE_INVERT_LAYER);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_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_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_INSTANCE_INVERT_PASS);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_INVERT_PASS);
RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
@@ -1111,12 +1105,12 @@ static void rna_def_modifier_gpencilinstance(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_INSTANCE_INVERT_LAYERPASS);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_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, "keep_on_top", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_INSTANCE_KEEP_ONTOP);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_KEEP_ONTOP);
RNA_def_property_ui_text(prop, "Keep On Top",
"Keep the original stroke in front of new instances (only affect by layer)");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");