From 4fa4132e45c97df24108b14fa3c11b2b4b04d22c Mon Sep 17 00:00:00 2001 From: Luca Rood Date: Mon, 27 Feb 2017 12:39:14 -0300 Subject: Surface Deform Modifier (SDef) Implementation of the SDef modifier, which allows meshes to be bound by surface, thus allowing things such as cloth simulation proxies. User documentation: https://wiki.blender.org/index.php/User:Lucarood/SurfaceDeform Reviewers: mont29, sergey Subscribers: Severin, dfelinto, plasmasolutions, kjym3 Differential Revision: https://developer.blender.org/D2462 --- source/blender/makesrna/intern/rna_modifier.c | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index c4f0db38a16..47c4b425155 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -105,6 +105,7 @@ EnumPropertyItem rna_enum_object_modifier_type_items[] = { {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""}, {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""}, {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""}, + {eModifierType_SurfaceDeform, "SURFACE_DEFORM", ICON_MOD_MESHDEFORM, "Surface Deform", ""}, {eModifierType_Warp, "WARP", ICON_MOD_WARP, "Warp", ""}, {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""}, {0, "", 0, N_("Simulate"), ""}, @@ -408,6 +409,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_CorrectiveSmoothModifier; case eModifierType_MeshSequenceCache: return &RNA_MeshSequenceCacheModifier; + case eModifierType_SurfaceDeform: + return &RNA_SurfaceDeformModifier; /* Default */ case eModifierType_None: case eModifierType_ShapeKey: @@ -573,6 +576,7 @@ RNA_MOD_OBJECT_SET(MeshDeform, object, OB_MESH); RNA_MOD_OBJECT_SET(NormalEdit, target, OB_EMPTY); RNA_MOD_OBJECT_SET(Shrinkwrap, target, OB_MESH); RNA_MOD_OBJECT_SET(Shrinkwrap, auxTarget, OB_MESH); +RNA_MOD_OBJECT_SET(SurfaceDeform, target, OB_MESH); static void rna_HookModifier_object_set(PointerRNA *ptr, PointerRNA value) { @@ -1131,6 +1135,11 @@ static int rna_CorrectiveSmoothModifier_is_bind_get(PointerRNA *ptr) return (csmd->bind_coords != NULL); } +static int rna_SurfaceDeformModifier_is_bound_get(PointerRNA *ptr) +{ + return (((SurfaceDeformModifierData *)ptr->data)->verts != NULL); +} + static void rna_MeshSequenceCache_object_path_update(Main *bmain, Scene *scene, PointerRNA *ptr) { #ifdef WITH_ALEMBIC @@ -4702,6 +4711,33 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); } +static void rna_def_modifier_surfacedeform(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SurfaceDeformModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "SurfaceDeform Modifier", "blablabla"); + RNA_def_struct_sdna(srna, "SurfaceDeformModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM); + + prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Target", "Mesh object to deform with"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_SurfaceDeformModifier_target_set", NULL, "rna_Mesh_object_poll"); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); + RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); + + prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 2.0f, 16.0f); + RNA_def_property_ui_text(prop, "Interpolation falloff", "Controls how much nearby polygons influence deformation"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_SurfaceDeformModifier_is_bound_get", NULL); + RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to target mesh"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); +} + void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -4819,6 +4855,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_datatransfer(brna); rna_def_modifier_normaledit(brna); rna_def_modifier_meshseqcache(brna); + rna_def_modifier_surfacedeform(brna); } #endif -- cgit v1.2.3 From df76616d7450b99938f265283fad443186da4039 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 19 Mar 2017 17:31:07 +0100 Subject: Usual UI/i18n message fixes. Please provide valid description for SurfaceDeform modifier tooltip. Such place-holders should not pass final checks before merging in master! --- source/blender/makesrna/intern/rna_modifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 47c4b425155..36cf909b299 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -4717,7 +4717,7 @@ static void rna_def_modifier_surfacedeform(BlenderRNA *brna) PropertyRNA *prop; srna = RNA_def_struct(brna, "SurfaceDeformModifier", "Modifier"); - RNA_def_struct_ui_text(srna, "SurfaceDeform Modifier", "blablabla"); + RNA_def_struct_ui_text(srna, "SurfaceDeform Modifier", ""); RNA_def_struct_sdna(srna, "SurfaceDeformModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM); -- cgit v1.2.3 From 31e62492564b32309ce5100ae40a6664b38d7baa Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 30 Mar 2017 12:39:51 +1100 Subject: Mirror Modifier: Add offsets for mirrored UVs The mirror modifier now has two fields that specify a -1 to 1 offset for the U and V axes when mirroring their coordinates. D1844 by @circuitfox --- source/blender/makesrna/intern/rna_modifier.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 36cf909b299..1a8dd05a7b5 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1526,6 +1526,20 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mirror V", "Mirror the V texture coordinate around the 0.5 point"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "mirror_offset_u", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "uv_offset[0]"); + RNA_def_property_range(prop, -1, 1); + RNA_def_property_ui_range(prop, -1, 1, 2, 4); + RNA_def_property_ui_text(prop, "U Offset", "Amount to offset mirrored UVs from the 0.5 point on the U axis"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "mirror_offset_v", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "uv_offset[1]"); + RNA_def_property_range(prop, -1, 1); + RNA_def_property_ui_range(prop, -1, 1, 2, 4); + RNA_def_property_ui_text(prop, "V Offset", "Amount to offset mirrored UVs from the 0.5 point on the V axis"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "tolerance"); RNA_def_property_range(prop, 0, FLT_MAX); -- cgit v1.2.3 From 584523e0adeb2663077602953f0d3288c4c60fe4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Sep 2017 00:10:13 +1000 Subject: Screw Modifier: remove doubles option Vertices on the axis can be optionally merged, nice for creating objects which close at the end-points. --- source/blender/makesrna/intern/rna_modifier.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 1a8dd05a7b5..e53237ae2c1 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -3413,6 +3413,13 @@ static void rna_def_modifier_screw(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Screw", "Offset the revolution along its axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "merge_dist"); + RNA_def_property_range(prop, 0, FLT_MAX); + RNA_def_property_ui_range(prop, 0, 1, 1, 4); + RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "use_normal_flip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_FLIP); RNA_def_property_ui_text(prop, "Flip", "Flip normals of lathed faces"); @@ -3428,6 +3435,12 @@ static void rna_def_modifier_screw(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Object Screw", "Use the distance between the objects to make a screw"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + /* Vertex merging parameters */ + prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_MERGE); + RNA_def_property_ui_text(prop, "Merge Vertices", "Merge adjacent vertices (screw offset must be zero)"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_SMOOTH_SHADING); RNA_def_property_ui_text(prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded"); -- cgit v1.2.3 From 785e96a11d452b2ea67cfc0be573ccd0f5cbdb8f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 18 Sep 2017 19:18:02 +0200 Subject: Fix (irc-reported by @sergey) invalid precision value in a float RNA property. Maximum allowed UI float precision value is 6 (which means 7 digits). Will change code checking on that in next commit. --- source/blender/makesrna/intern/rna_modifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index e53237ae2c1..96b88d98270 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1974,7 +1974,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "double_threshold"); RNA_def_property_range(prop, 0, 1.0f); - RNA_def_property_ui_range(prop, 0, 1, 0.0001, 7); + RNA_def_property_ui_range(prop, 0, 1, 0.0001, 6); RNA_def_property_ui_text(prop, "Overlap Threshold", "Threshold for checking overlapping geometry"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); } -- cgit v1.2.3 From 215651af1b09571eaceafd1c4269d559eb5328ca Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Sep 2017 18:29:52 +1000 Subject: Boolean Modifier: add debug options Only show & use when running in debug mode. --- source/blender/makesrna/intern/rna_modifier.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 96b88d98270..4db8b9e9de9 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1977,6 +1977,23 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0, 1, 0.0001, 6); RNA_def_property_ui_text(prop, "Overlap Threshold", "Threshold for checking overlapping geometry"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + /* BMesh debugging options, only used when G_DEBUG is set */ + + /* BMesh intersection options */ + static EnumPropertyItem debug_items[] = { + {eBooleanModifierBMeshFlag_BMesh_Separate, "SEPARATE", 0, "Separate", ""}, + {eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "NoDissolve", ""}, + {eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "NoConnectRegions", ""}, + {0, NULL, 0, NULL, NULL} + }; + + prop = RNA_def_property(srna, "debug_options", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, debug_items); + RNA_def_property_enum_sdna(prop, NULL, "bm_flag"); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Debug", "Debugging options, only when started with '-d'"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); } static void rna_def_modifier_array(BlenderRNA *brna) -- cgit v1.2.3 From 1c5f5fb95f13c81fcfad0a7cf89653f86f5bdf82 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Sep 2017 14:11:27 +1000 Subject: Mirror Modifier: option to offset UV's Useful for baking, so UV's can be moved outside the image and not used to bake pixels (but still used for display). D2801 by @Zuorion --- source/blender/makesrna/intern/rna_modifier.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 4db8b9e9de9..74aa3759d2d 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1518,26 +1518,40 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) prop = RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_U); - RNA_def_property_ui_text(prop, "Mirror U", "Mirror the U texture coordinate around the 0.5 point"); + RNA_def_property_ui_text(prop, "Mirror U", "Mirror the U texture coordinate around the flip offset point"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "use_mirror_v", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_V); - RNA_def_property_ui_text(prop, "Mirror V", "Mirror the V texture coordinate around the 0.5 point"); + RNA_def_property_ui_text(prop, "Mirror V", "Mirror the V texture coordinate around the flip offset point"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "mirror_offset_u", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "uv_offset[0]"); RNA_def_property_range(prop, -1, 1); RNA_def_property_ui_range(prop, -1, 1, 2, 4); - RNA_def_property_ui_text(prop, "U Offset", "Amount to offset mirrored UVs from the 0.5 point on the U axis"); + RNA_def_property_ui_text(prop, "Flip U Offset", "Amount to offset mirrored UVs flipping point from the 0.5 on the U axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "mirror_offset_v", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "uv_offset[1]"); RNA_def_property_range(prop, -1, 1); RNA_def_property_ui_range(prop, -1, 1, 2, 4); - RNA_def_property_ui_text(prop, "V Offset", "Amount to offset mirrored UVs from the 0.5 point on the V axis"); + RNA_def_property_ui_text(prop, "Flip V Offset", "Amount to offset mirrored UVs flipping point from the 0.5 point on the V axis"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "offset_u", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "uv_offset_copy[0]"); + RNA_def_property_range(prop, -10000.0f, 10000.0f); + RNA_def_property_ui_range(prop, -1, 1, 2, 4); + RNA_def_property_ui_text(prop, "U Offset", "Mirrored UV offset on the U axis"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "offset_v", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "uv_offset_copy[1]"); + RNA_def_property_range(prop, -10000.0f, 10000.0f); + RNA_def_property_ui_range(prop, -1, 1, 2, 4); + RNA_def_property_ui_text(prop, "V Offset", "Mirrored UV offset on the V axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE); -- cgit v1.2.3 From a22af1a84b3f15e300a1099cf4cc958d8abcc3dd Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 4 Oct 2017 12:38:40 +0200 Subject: Fix i18n messages extraction script, and a few more UI messages... --- source/blender/makesrna/intern/rna_modifier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna/intern/rna_modifier.c') diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 74aa3759d2d..a35d518b786 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1997,8 +1997,8 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) /* BMesh intersection options */ static EnumPropertyItem debug_items[] = { {eBooleanModifierBMeshFlag_BMesh_Separate, "SEPARATE", 0, "Separate", ""}, - {eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "NoDissolve", ""}, - {eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "NoConnectRegions", ""}, + {eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "No Dissolve", ""}, + {eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "No Connect Regions", ""}, {0, NULL, 0, NULL, NULL} }; -- cgit v1.2.3