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-08-30 13:22:55 +0300
committerAntonioya <blendergit@gmail.com>2018-08-30 13:23:08 +0300
commit9a646b6a2060dbc3b2f4031f7933842c597d0716 (patch)
treec9e02dd7168547a246c11177c977311f24435a8d /source/blender/makesrna/intern/rna_gpencil_modifier.c
parent9d00b0f7963508c3f8de8eff6a376dcb085da438 (diff)
GP: New Armature modifier and tools to handle weights
This commit adds a new armature modifier for grease pencil. The deformations are done reusing the mesh deform routines. There is also a new operator in weight paint mode to help the artist to generate weights base on armatures. This operator is required because 2D animation workflow is not equal to meshes when parent an object to armatures. In the drawing engine has been added the option to handle the Fade object parameter used in armatures to see the strokes while move the bones. When rename bones, all related data of grease pencil is renamed too. This not only affect new armature code, but also layers parented and hook modifiers. Thanks @aligorith for his review and help.
Diffstat (limited to 'source/blender/makesrna/intern/rna_gpencil_modifier.c')
-rw-r--r--source/blender/makesrna/intern/rna_gpencil_modifier.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index c4d1e93a2ef..ec8adeaddda 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -67,6 +67,7 @@ const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = {
{eGpencilModifierType_Simplify, "GP_SIMPLIFY", ICON_MOD_DECIM, "Simplify", "Simplify stroke reducing number of points"},
{eGpencilModifierType_Subdiv, "GP_SUBDIV", ICON_MOD_SUBSURF, "Subdivide", "Subdivide stroke adding more control points"},
{0, "", 0, N_("Deform"), "" },
+ {eGpencilModifierType_Armature, "GP_ARMATURE", ICON_MOD_ARMATURE, "Armature", "Deform stroke points using armature object"},
{eGpencilModifierType_Hook, "GP_HOOK", ICON_HOOK, "Hook", "Deform stroke points using objects"},
{eGpencilModifierType_Lattice, "GP_LATTICE", ICON_MOD_LATTICE, "Lattice", "Deform strokes using lattice"},
{eGpencilModifierType_Mirror, "GP_MIRROR", ICON_MOD_MIRROR, "Mirror", "Duplicate strokes like a mirror"},
@@ -160,6 +161,8 @@ static StructRNA *rna_GpencilModifier_refine(struct PointerRNA *ptr)
return &RNA_HookGpencilModifier;
case eGpencilModifierType_Offset:
return &RNA_OffsetGpencilModifier;
+ case eGpencilModifierType_Armature:
+ return &RNA_ArmatureGpencilModifier;
/* Default */
case eGpencilModifierType_None:
case NUM_GREASEPENCIL_MODIFIER_TYPES:
@@ -227,6 +230,7 @@ RNA_GP_MOD_VGROUP_NAME_SET(Lattice, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Smooth, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Hook, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Offset, vgname);
+RNA_GP_MOD_VGROUP_NAME_SET(Armature, vgname);
#undef RNA_GP_MOD_VGROUP_NAME_SET
@@ -251,6 +255,7 @@ static void rna_##_type##GpencilModifier_##_prop##_set(PointerRNA *ptr, PointerR
greasepencil_modifier_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
}
+RNA_GP_MOD_OBJECT_SET(Armature, object, OB_ARMATURE);
RNA_GP_MOD_OBJECT_SET(Lattice, object, OB_LATTICE);
RNA_GP_MOD_OBJECT_SET(Mirror, object, OB_EMPTY);
@@ -1261,6 +1266,60 @@ static void rna_def_modifier_gpencilhook(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Uniform Falloff", "Compensate for non-uniform object scale");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
+
+static void rna_def_modifier_gpencilarmature(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ArmatureGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Armature Modifier", "Change stroke using armature to deform modifier");
+ RNA_def_struct_sdna(srna, "ArmatureGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureGpencilModifier_object_set", NULL, "rna_Armature_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
+ RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
+ RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
+ RNA_def_property_ui_text(prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+#if 0 /* GPXX keep disabled now */
+ prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
+ RNA_def_property_ui_text(prop, "Multi Modifier",
+ "Use same input as previous modifier, and mix results using overall vgroup");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+#endif
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+}
+
void RNA_def_greasepencil_modifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1330,6 +1389,7 @@ void RNA_def_greasepencil_modifier(BlenderRNA *brna)
rna_def_modifier_gpencillattice(brna);
rna_def_modifier_gpencilmirror(brna);
rna_def_modifier_gpencilhook(brna);
+ rna_def_modifier_gpencilarmature(brna);
}
#endif