Fix T78902: Only check main modifier panel for expansion property

Internally the "show_expanded" property stores the expansion for every
subpanel, but for RNA we should only check the first bit of the flag that
corresponds to the main panel.
This commit is contained in:
Hans Goudey 2020-07-13 20:10:49 -04:00
parent 0b24930541
commit b818f6b55f
Notes: blender-bot 2023-02-14 07:45:38 +01:00
Referenced by issue #78902, Modifier panel panel expansion RNA property always returns true if subpanels are expanded
1 changed files with 13 additions and 1 deletions

View File

@ -1688,6 +1688,17 @@ static void rna_Modifier_show_expanded_set(PointerRNA *ptr, bool value)
}
}
/**
* Only check the first bit of the expansion flag for the main panel's expansion,
* maintaining compatibility with older versions where there was only one expansion
* value.
*/
static bool rna_Modifier_show_expanded_get(PointerRNA *ptr)
{
ModifierData *md = ptr->data;
return md->ui_expand_flag & (1 << 0);
}
#else
/* NOTE: *MUST* return subdivision_type property. */
@ -6959,7 +6970,8 @@ 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_boolean_funcs(
prop, "rna_Modifier_show_expanded_get", "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);