Cleanup: Remove dead outliner tree element code, replace with assert

Only the ID base tree element type doesn't yet use the polymorphic
tree element design yet, and this case is handled in an earlier branch
excluding this `else` block. So this would be dead code.

Add assert to protect from future changes breaking this assumption.
This commit is contained in:
Julian Eisel
2023-08-31 13:10:03 +02:00
parent 9ab3a8f840
commit 4a689ea7ee

View File

@@ -383,12 +383,12 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
else {
/* Other cases must be caught above. */
BLI_assert(TSE_IS_REAL_ID(tselem));
BLI_assert_msg(te->abstract_element != nullptr,
"Element type should use `AbstractTreeElement` to for correct initialization "
"of its `TreeElement` data");
/* The new type design sets the name already, don't override that here. We need to figure out
* how to deal with the idcode for non-TSE_SOME_ID types still. Some rely on it... */
if (!te->abstract_element) {
te->name = id->name + 2; /* Default, can be overridden by Library or non-ID data. */
}
te->idcode = GS(id->name);
}