diff options
author | Hans Goudey <h.goudey@me.com> | 2020-06-10 18:08:58 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-06-10 18:08:58 +0300 |
commit | b0ac7a89b0ed4494e81520d8f02ab60c861be002 (patch) | |
tree | 15bdfd9c4b9562d6600317367894e2bd09c0ce43 /source/blender/makesrna/intern | |
parent | 9b784668aea49d019040451618ca83fa3248b2e9 (diff) |
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.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 92eec6190da..a7faef520bf 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -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); |