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:
authorHans Goudey <h.goudey@me.com>2020-10-01 17:38:00 +0300
committerHans Goudey <h.goudey@me.com>2020-10-01 17:38:00 +0300
commit83980506957cd4e31e8dc7041672efb256b5c28c (patch)
tree15224c5527a82ee5db618a28bbd3e0c178e6095e /source/blender/makesrna
parent551204a17f14b94b4e222546231f4e5846762ce7 (diff)
Use DNA defaults system for modifiers
As noted in T80164, there are quite a few area of Blender where the "Reset to Default Value" operator in button context menus doesn't work. Modifiers are one of them, because the DNA defaults system was never set up for them. Additionally, this should make modifier versioning easier. Whenever a new field is added it should be automatically initialized to the default value. I had to make some ordering changes in the following modifiers to work around an error with `-Wsign-conversion` in the macros: - Solidify Modifier - Corrective Smooth Modifier - Screw Modifier Some modifiers are special cases and are skipped in this commit: - Data Transfer Modifier - Cloth Modifier - Fluid Modifier - Softbody Modifier Differential Revision: https://developer.blender.org/D8747
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 97d6f09d492..3fff2feb10d 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -3742,7 +3742,6 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
prop = RNA_def_property(srna, "particle_amount", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(prop, "Particle Amount", "Amount of particles to use for instancing");
- RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "particle_offset", PROP_FLOAT, PROP_FACTOR);
@@ -3751,7 +3750,6 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
"Particle Offset",
"Relative offset of particles to use for instancing, to avoid overlap "
"of multiple instances");
- RNA_def_property_float_default(prop, 0.0f);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "index_layer_name", PROP_STRING, PROP_NONE);
@@ -4515,7 +4513,6 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "factor");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_float_default(prop, DEG2RADF(45.0f));
RNA_def_property_ui_range(prop, DEG2RAD(-360.0), DEG2RAD(360.0), 10.0, 3);
RNA_def_property_ui_text(prop, "Angle", "Angle of deformation");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -6685,7 +6682,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna)
prop = RNA_def_float_factor(
srna,
"mix_factor",
- 1.0f,
+ 0.0f,
0.0f,
1.0f,
"Mix Factor",
@@ -6775,27 +6772,15 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mix Mode", "How to mix generated normals with existing ones");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_float(srna,
- "mix_factor",
- 1.0f,
- 0.0f,
- 1.0f,
- "Mix Factor",
- "How much of generated normals to mix with exiting ones",
- 0.0f,
- 1.0f);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_float(srna,
- "mix_limit",
- 1.0f,
- 0.0f,
- DEG2RADF(180.0f),
- "Max Angle",
- "Maximum angle between old and new normals",
- 0.0f,
- DEG2RADF(180.0f));
- RNA_def_property_subtype(prop, PROP_ANGLE);
+ prop = RNA_def_property(srna, "mix_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(
+ prop, "Mix Factor", "How much of generated normals to mix with exiting ones");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mix_limit", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, 0.0, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle between old and new normals");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "no_polynors_fix", PROP_BOOLEAN, PROP_NONE);