UI: Only set first bit of modifier expansion fag with Python

Only the flag for the top level panels is exposed with RNA, so this adds
a set method to only change that bit.
This commit is contained in:
Hans Goudey 2020-06-10 11:08:58 -04:00
parent 9b784668ae
commit b0ac7a89b0
1 changed files with 16 additions and 0 deletions

View File

@ -1643,6 +1643,21 @@ static void rna_SimulationModifier_simulation_update(Main *bmain, Scene *scene,
}
# endif
/**
* Special set callback that just changes the first bit of the expansion flag.
* This way the expansion state of all the subpanels is not changed by RNA.
*/
static void rna_Modifier_show_expanded_set(PointerRNA *ptr, bool value)
{
ModifierData *md = ptr->data;
if (value) {
md->ui_expand_flag |= (1 << 0);
}
else {
md->ui_expand_flag &= ~(1 << 0);
}
}
#else
/* NOTE: *MUST* return subdivision_type property. */
@ -6872,6 +6887,7 @@ void RNA_def_modifier(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_Modifier_show_expanded_set");
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);