diff options
5 files changed, 27 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 9070aa5faee..3cefbee8c17 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -1677,7 +1677,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.prop(md, "factor", text="Factor") layout.prop(md, "iterations") - + layout.prop(md, "scale") row = layout.row() row.prop(md, "smooth_type") diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 2d1c57b1495..ca22cc71613 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -4819,5 +4819,17 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) br->automasking_boundary_edges_propagation_steps = 1; } } + + /* Corrective smooth modifier scale*/ + if (!DNA_struct_elem_find(fd->filesdna, "CorrectiveSmoothModifierData", "float", "scale")) { + for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { + for (ModifierData *md = ob->modifiers.first; md; md = md->next) { + if (md->type == eModifierType_CorrectiveSmooth) { + CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md; + csmd->scale = 1.0f; + } + } + } + } } } diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 36d21b28b1f..042cf7e874f 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -1684,10 +1684,10 @@ typedef struct CorrectiveSmoothDeltaCache { /* Value of settings when creating the cache. * These are used to check if the cache should be recomputed. */ - float lambda; + float lambda, scale; short repeat, flag; char smooth_type, rest_source; - char _pad[2]; + char _pad[6]; } CorrectiveSmoothDeltaCache; typedef struct CorrectiveSmoothModifierData { @@ -1700,10 +1700,10 @@ typedef struct CorrectiveSmoothModifierData { /* note: -1 is used to bind */ unsigned int bind_coords_num; - float lambda; + float lambda, scale; short repeat, flag; char smooth_type, rest_source; - char _pad[2]; + char _pad[6]; /** MAX_VGROUP_NAME. */ char defgrp_name[64]; diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 025cae42033..396c5a4e854 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -3109,6 +3109,13 @@ static void rna_def_modifier_correctivesmooth(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Repeat", ""); RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update"); + prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "scale"); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0, 10.0, 5, 3); + RNA_def_property_ui_text(prop, "Scale", "Compensate for scale applied by other modifiers"); + RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update"); + prop = RNA_def_property(srna, "rest_source", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rest_source"); RNA_def_property_enum_items(prop, modifier_rest_source_items); diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index 0afe95a3ca3..d35873728db 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -64,6 +64,7 @@ static void initData(ModifierData *md) csmd->bind_coords_num = 0; csmd->lambda = 0.5f; + csmd->scale = 1.0f; csmd->repeat = 5; csmd->flag = 0; csmd->smooth_type = MOD_CORRECTIVESMOOTH_SMOOTH_SIMPLE; @@ -696,7 +697,7 @@ static void correctivesmooth_modifier_do(ModifierData *md, uint i; float(*tangent_spaces)[3][3]; - + const float scale = csmd->scale; /* calloc, since values are accumulated */ tangent_spaces = MEM_calloc_arrayN(numVerts, sizeof(float[3][3]), __func__); @@ -710,7 +711,7 @@ static void correctivesmooth_modifier_do(ModifierData *md, #endif mul_v3_m3v3(delta, tangent_spaces[i], csmd->delta_cache.deltas[i]); - add_v3_v3(vertexCos[i], delta); + madd_v3_v3fl(vertexCos[i], delta, scale); } MEM_freeN(tangent_spaces); |