GPencil: Fix Noise modifier versioning
The versioning was setting the factor for all modes without checking flags. Also cleanup some unused code.
This commit is contained in:
parent
91ca3c3c0b
commit
cf9b3310c0
|
@ -4644,10 +4644,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
case eGpencilModifierType_Noise: {
|
||||
NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md;
|
||||
mmd->factor /= 25.0f;
|
||||
mmd->factor_thickness = mmd->factor;
|
||||
mmd->factor_strength = mmd->factor;
|
||||
mmd->factor_uvs = mmd->factor;
|
||||
float factor = mmd->factor / 25.0f;
|
||||
mmd->factor = (mmd->flag & GP_NOISE_MOD_LOCATION) ? factor : 0.0f;
|
||||
mmd->factor_thickness = (mmd->flag & GP_NOISE_MOD_STRENGTH) ? factor : 0.0f;
|
||||
mmd->factor_strength = (mmd->flag & GP_NOISE_MOD_THICKNESS) ? factor : 0.0f;
|
||||
mmd->factor_uvs = (mmd->flag & GP_NOISE_MOD_UV) ? factor : 0.0f;
|
||||
|
||||
mmd->noise_scale = (mmd->flag & GP_NOISE_FULL_STROKE) ? 0.0f : 1.0f;
|
||||
|
||||
if (mmd->curve_intensity == NULL) {
|
||||
|
|
|
@ -55,7 +55,6 @@ static void initData(GpencilModifierData *md)
|
|||
{
|
||||
NoiseGpencilModifierData *gpmd = (NoiseGpencilModifierData *)md;
|
||||
gpmd->pass_index = 0;
|
||||
gpmd->flag |= GP_NOISE_MOD_LOCATION;
|
||||
gpmd->flag |= GP_NOISE_FULL_STROKE;
|
||||
gpmd->flag |= GP_NOISE_USE_RANDOM;
|
||||
gpmd->factor = 0.5f;
|
||||
|
|
|
@ -105,15 +105,15 @@ typedef struct NoiseGpencilModifierData {
|
|||
|
||||
typedef enum eNoiseGpencil_Flag {
|
||||
GP_NOISE_USE_RANDOM = (1 << 0),
|
||||
GP_NOISE_MOD_LOCATION = (1 << 1),
|
||||
GP_NOISE_MOD_STRENGTH = (1 << 2),
|
||||
GP_NOISE_MOD_THICKNESS = (1 << 3),
|
||||
GP_NOISE_MOD_LOCATION = (1 << 1), /* Deprecated (only for versioning). */
|
||||
GP_NOISE_MOD_STRENGTH = (1 << 2), /* Deprecated (only for versioning). */
|
||||
GP_NOISE_MOD_THICKNESS = (1 << 3), /* Deprecated (only for versioning). */
|
||||
GP_NOISE_FULL_STROKE = (1 << 4),
|
||||
GP_NOISE_CUSTOM_CURVE = (1 << 5),
|
||||
GP_NOISE_INVERT_LAYER = (1 << 6),
|
||||
GP_NOISE_INVERT_PASS = (1 << 7),
|
||||
GP_NOISE_INVERT_VGROUP = (1 << 8),
|
||||
GP_NOISE_MOD_UV = (1 << 9),
|
||||
GP_NOISE_MOD_UV = (1 << 9), /* Deprecated (only for versioning). */
|
||||
GP_NOISE_INVERT_LAYERPASS = (1 << 10),
|
||||
GP_NOISE_INVERT_MATERIAL = (1 << 11),
|
||||
} eNoiseGpencil_Flag;
|
||||
|
|
|
@ -478,12 +478,6 @@ static void rna_def_modifier_gpencilnoise(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Seed", "Random seed");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_edit_position", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_LOCATION);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Affect Position", "The modifier affects the position of the point");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "noise_scale");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
|
|
Loading…
Reference in New Issue