Cleanup: factorize duplicated code in WVG modifiers' RNA.

This commit is contained in:
Bastien Montagne 2020-06-02 17:15:36 +02:00
parent 5ef44dd83f
commit 9d9f35d946
1 changed files with 15 additions and 22 deletions

View File

@ -4760,6 +4760,7 @@ static void rna_def_modifier_uvwarp(BlenderRNA *brna)
static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna),
StructRNA *srna,
const char *mask_flags,
const char *mask_vgroup_setter,
const char *mask_uvlayer_setter)
{
@ -4802,6 +4803,11 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna),
RNA_def_property_string_funcs(prop, NULL, NULL, mask_vgroup_setter);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "invert_mask_vertex_group", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, mask_flags, MOD_WVG_EDIT_INVERT_VGROUP_MASK);
RNA_def_property_ui_text(prop, "Invert", "Invert vertex group mask influence");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Masking Tex", "Masking texture");
RNA_def_property_flag(prop, PROP_EDITABLE);
@ -4949,13 +4955,9 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
/* Common masking properties. */
rna_def_modifier_weightvg_mask(brna,
srna,
"edit_flags",
"rna_WeightVGEditModifier_mask_defgrp_name_set",
"rna_WeightVGEditModifier_mask_tex_uvlayer_name_set");
prop = RNA_def_property(srna, "invert_mask_vertex_group", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_INVERT_VGROUP_MASK);
RNA_def_property_ui_text(prop, "Invert", "Invert vertex group mask influence");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
@ -5053,17 +5055,6 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Vertex Set", "Which vertices should be affected");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
/* Common masking properties. */
rna_def_modifier_weightvg_mask(brna,
srna,
"rna_WeightVGMixModifier_mask_defgrp_name_set",
"rna_WeightVGMixModifier_mask_tex_uvlayer_name_set");
prop = RNA_def_property(srna, "invert_mask_vertex_group", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WVG_MIX_INVERT_VGROUP_MASK);
RNA_def_property_ui_text(prop, "Invert", "Invert vertex group mask influence");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "normalize", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WVG_MIX_WEIGHTS_NORMALIZE);
RNA_def_property_ui_text(
@ -5071,6 +5062,13 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
"Normalize Weights",
"Normalize the resulting weights (otherwise they are only clamped within [0.0, 1.0] range)");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
/* Common masking properties. */
rna_def_modifier_weightvg_mask(brna,
srna,
"flag",
"rna_WeightVGMixModifier_mask_defgrp_name_set",
"rna_WeightVGMixModifier_mask_tex_uvlayer_name_set");
}
static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
@ -5189,14 +5187,9 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
/* Common masking properties. */
rna_def_modifier_weightvg_mask(brna,
srna,
"proximity_flags",
"rna_WeightVGProximityModifier_mask_defgrp_name_set",
"rna_WeightVGProximityModifier_mask_tex_uvlayer_name_set");
prop = RNA_def_property(srna, "invert_mask_vertex_group", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(
prop, NULL, "proximity_flags", MOD_WVG_PROXIMITY_INVERT_VGROUP_MASK);
RNA_def_property_ui_text(prop, "Invert", "Invert vertex group mask influence");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_remesh(BlenderRNA *brna)