[Bf-blender-cvs] [07c55e2543d] modifier-panels-ui: More cleanup, versioning

Hans Goudey noreply at git.blender.org
Wed Apr 22 23:58:31 CEST 2020


Commit: 07c55e2543d063530d28c6f98fc1b636f36dc5bf
Author: Hans Goudey
Date:   Wed Apr 22 16:58:21 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB07c55e2543d063530d28c6f98fc1b636f36dc5bf

More cleanup, versioning

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

M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/draw/engines/overlay/overlay_extra.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/makesdna/DNA_constraint_types.h
M	source/blender/makesrna/intern/rna_constraint.c

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

diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 4f902e26e67..21722a413c5 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -5248,7 +5248,8 @@ static bConstraint *add_new_constraint_internal(const char *name, short type)
 
   /* Set up a generic constraint data-block. */
   con->type = type;
-  con->flag |= CONSTRAINT_EXPAND | CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
+  con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
+  con->ui_expand_flag = 1;
   con->enforce = 1.0f;
 
   /* Only open the main panel when constraints are created, not the subpanels.
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 0ce3cf405cd..940db2b0f39 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -23,7 +23,9 @@
 #include "BLI_listbase.h"
 #include "BLI_utildefines.h"
 
+#include "DNA_constraint_types.h"
 #include "DNA_genfile.h"
+#include "DNA_modifier_types.h"
 #include "DNA_screen_types.h"
 
 #include "BKE_collection.h"
@@ -62,5 +64,33 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
         }
       }
     }
+
+    /* Transition to saving expansion for all of a modifier's subpanels. */
+    if (!DNA_struct_elem_find(fd->filesdna, "bSizeLikeConstraint", "short", "ui_expand_flag")) {
+      for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
+        LISTBASE_FOREACH (bConstraint *, con, &object->constraints) {
+          if (con->flag & CONSTRAINT_EXPAND_DEPRECATED) {
+            con->ui_expand_flag = 1;
+          }
+          else {
+            con->ui_expand_flag = 0;
+          }
+        }
+      }
+    }
+
+    /* Transition to saving expansion for all of a modifier's subpanels. */
+    if (!DNA_struct_elem_find(fd->filesdna, "SolidifyModifierData", "short", "ui_expand_flag")) {
+      for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
+        LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
+          if (md->mode & eModifierMode_Expanded_DEPRECATED) {
+            md->ui_expand_flag = 1;
+          }
+          else {
+            md->ui_expand_flag = 0;
+          }
+        }
+      }
+    }
   }
 }
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c
index 566c8cad528..dc051b9488f 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.c
+++ b/source/blender/draw/engines/overlay/overlay_extra.c
@@ -1316,7 +1316,7 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
       else {
         const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon);
 
-        if ((cti && cti->get_constraint_targets) && (curcon->flag & CONSTRAINT_EXPAND)) {
+        if ((cti && cti->get_constraint_targets) && (curcon->ui_expand_flag)) {
           ListBase targets = {NULL, NULL};
           bConstraintTarget *ct;
 
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index bc30c4fd449..de6338e9576 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2667,11 +2667,6 @@ static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *co
     UI_block_lock_set(block, true, TIP_("Cannot edit Proxy-Protected Constraint"));
   }
 
-  /* Draw constraint data */
-  if ((con->flag & CONSTRAINT_EXPAND) == 0) {
-    (yco) -= 10.5f * UI_UNIT_Y;
-  }
-
   /* clear any locks set up for proxies/lib-linking */
   UI_block_lock_clear(block);
 }
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 9209dd698a5..e8b2f883d6c 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -690,8 +690,8 @@ typedef enum eBConstraint_Types {
 /* flag 0x20 (1 << 5) was used to indicate that a constraint was evaluated
  *                  using a 'local' hack for posebones only. */
 typedef enum eBConstraint_Flags {
-  /* expand for UI. Deprecated */
-  CONSTRAINT_EXPAND = (1 << 0),
+  /* Expansion for old box constraint layouts. Just for versioning. */
+  CONSTRAINT_EXPAND_DEPRECATED = (1 << 0),
   /* pre-check for illegal object name or bone name */
   CONSTRAINT_DISABLE = (1 << 2),
   /* to indicate which Ipo should be shown, maybe for 3d access later too */
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 04a859e6543..9f627f9d407 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -3263,12 +3263,12 @@ void RNA_def_constraint(BlenderRNA *brna)
   RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
   RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
 
-  // prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
-  // RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
-  // RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND);
-  // RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
-  // RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
-  // RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+  prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+  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);
+  RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
+  RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
 
   /* XXX this is really an internal flag,
    * but it may be useful for some tools to be able to access this... */



More information about the Bf-blender-cvs mailing list