Fix T89081: Freestyle noise seed of zero crash

This leads to division by zero in Freestyle's NoiseShader which also
crashes blender.

Not sure if we really need a do_version patch for old files, as an
alternative we could also force a positive number in the NoiseShader.
This patch does not do either, just force a positive range in RNA from
now on.

Maniphest Tasks: T89081

Differential Revision: https://developer.blender.org/D13332
This commit is contained in:
Philipp Oeser 2021-11-23 12:27:17 +01:00
parent a773cd3850
commit ef88047a97
Notes: blender-bot 2023-02-14 11:07:28 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #89081, Freestyle seed in noise modifier can be zero (leading to crash)
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 6 additions and 3 deletions

View File

@ -949,8 +949,9 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Period", "Period of the noise");
RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "seed");
RNA_def_property_range(prop, 1, SHRT_MAX);
RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
@ -1051,8 +1052,9 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Period", "Period of the noise");
RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "seed");
RNA_def_property_range(prop, 1, SHRT_MAX);
RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
@ -1191,8 +1193,9 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Period", "Period of the noise");
RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "seed");
RNA_def_property_range(prop, 1, SHRT_MAX);
RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");