[Bf-blender-cvs] [b0ac7a89b0e] master: UI: Only set first bit of modifier expansion fag with Python

Hans Goudey noreply at git.blender.org
Wed Jun 10 17:10:04 CEST 2020


Commit: b0ac7a89b0ed4494e81520d8f02ab60c861be002
Author: Hans Goudey
Date:   Wed Jun 10 11:08:58 2020 -0400
Branches: master
https://developer.blender.org/rBb0ac7a89b0ed4494e81520d8f02ab60c861be002

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.

===================================================================

M	source/blender/makesrna/intern/rna_modifier.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list