[Bf-blender-cvs] [fade765bf34] master: Outliner: Add assert to make assumption for new code design explicit

Julian Eisel noreply at git.blender.org
Thu Mar 11 13:22:25 CET 2021


Commit: fade765bf3488676141b28556969130eef9b70bb
Author: Julian Eisel
Date:   Thu Mar 11 13:19:25 2021 +0100
Branches: master
https://developer.blender.org/rBfade765bf3488676141b28556969130eef9b70bb

Outliner: Add assert to make assumption for new code design explicit

There was an implicit assumption that tree element types using the new code
design set their name on creation. Use an assert to make this explicit. See
f59ff9e03a633, which was an error because of this broken assumption.

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

M	source/blender/editors/space_outliner/outliner_tree.c

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

diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 6319b890b3b..36a9549c9b2 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -889,6 +889,10 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
   /* New C++ based type handle (`TreeElementType` in C, `AbstractTreeElement` in C++). Only some
    * support this, eventually this should replace `TreeElement` entirely. */
   te->type = outliner_tree_element_type_create(type, te, idv);
+  if (te->type) {
+    /* Element types ported to the new design are expected to have their name set at this point! */
+    BLI_assert(te->name != NULL);
+  }
 
   if (ELEM(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
     /* pass */



More information about the Bf-blender-cvs mailing list