diff options
author | Alexander Pinzon <apinzonf@gmail.com> | 2013-11-24 00:00:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-24 00:10:42 +0400 |
commit | 673bd9a009062807c16cc31a263018737c148a96 (patch) | |
tree | 4ab6bc0cf8d9a7f6fb60b4ea2d61a6374c97794d /source/blender/makesrna | |
parent | 4c52e737df39e538d3b41a232035a4a1e240505d (diff) |
Mesh Modifiers: Added Laplacian Deform
Part of soc-2013-sketch_mesh branch
See: http://wiki.blender.org/index.php/User:Apinzonf/Doc:2.6/Manual/Modifiers/Deform/Laplacian_Deform
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 46 |
2 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index d82bae1ce57..5fa41c14932 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -296,6 +296,7 @@ extern StructRNA RNA_KinematicConstraint; extern StructRNA RNA_Lamp; extern StructRNA RNA_LampSkySettings; extern StructRNA RNA_LampTextureSlot; +extern StructRNA RNA_LaplacianDeformModifier; extern StructRNA RNA_LaplacianSmoothModifier; extern StructRNA RNA_Lattice; extern StructRNA RNA_LatticeModifier; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index eee7692e2ed..9df18961a82 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -87,6 +87,7 @@ EnumPropertyItem modifier_type_items[] = { {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""}, {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""}, {eModifierType_LaplacianSmooth, "LAPLACIANSMOOTH", ICON_MOD_SMOOTH, "Laplacian Smooth", ""}, + {eModifierType_LaplacianDeform, "LAPLACIANDEFORM", ICON_MOD_MESHDEFORM, "Laplacian Deform", ""}, {eModifierType_Lattice, "LATTICE", ICON_MOD_LATTICE, "Lattice", ""}, {eModifierType_MeshDeform, "MESH_DEFORM", ICON_MOD_MESHDEFORM, "Mesh Deform", ""}, {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""}, @@ -238,6 +239,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_UVWarpModifier; case eModifierType_MeshCache: return &RNA_MeshCacheModifier; + case eModifierType_LaplacianDeform: + return &RNA_LaplacianDeformModifier; /* Default */ case eModifierType_None: case eModifierType_ShapeKey: @@ -786,6 +789,18 @@ static void rna_UVWarpModifier_uvlayer_set(PointerRNA *ptr, const char *value) rna_object_uvlayer_name_set(ptr, value, umd->uvlayer_name, sizeof(umd->uvlayer_name)); } +static void rna_LaplacianDeformModifier_vgroup_set(PointerRNA *ptr, const char *value) +{ + LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data; + rna_object_vgroup_name_set(ptr, value, lmd->anchor_grp_name, sizeof(lmd->anchor_grp_name)); +} + +static int rna_LaplacianDeformModifier_is_bind_get(PointerRNA *ptr) +{ + LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data; + return ((lmd->flag & MOD_LAPLACIANDEFORM_BIND) && (lmd->cache_system != NULL)); +} + #else static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[]) @@ -3681,6 +3696,36 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); } +static void rna_def_modifier_laplaciandeform(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "LaplacianDeformModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Laplacian Deform Modifier", "Mesh deform modifier"); + RNA_def_struct_sdna(srna, "LaplacianDeformModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM); + + prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "anchor_grp_name"); + RNA_def_property_ui_text(prop, "Vertex Group for Anchors", + "Name of Vertex Group which determines Anchors"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianDeformModifier_vgroup_set"); + + prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "repeat"); + RNA_def_property_ui_range(prop, 1, 50, 1, -1); + RNA_def_property_ui_text(prop, "Repeat", ""); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_LaplacianDeformModifier_is_bind_get", NULL); + RNA_def_property_ui_text(prop, "Bind", "Whether geometry has been bind to anchors"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + RNA_def_property_update(prop, 0, "rna_Modifier_update"); +} + void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -3791,6 +3836,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_laplaciansmooth(brna); rna_def_modifier_triangulate(brna); rna_def_modifier_meshcache(brna); + rna_def_modifier_laplaciandeform(brna); } #endif |