[Bf-blender-cvs] [17301a3163c] master: Fix incorrect Outliner tree-display type returned

Julian Eisel noreply at git.blender.org
Thu Feb 24 17:10:27 CET 2022


Commit: 17301a3163c9b44c42f8032a575681a0c9fa1b8c
Author: Julian Eisel
Date:   Thu Feb 24 17:02:14 2022 +0100
Branches: master
https://developer.blender.org/rB17301a3163c9b44c42f8032a575681a0c9fa1b8c

Fix incorrect Outliner tree-display type returned

Reverts 6d97fdc37eef. A function like this should not return a different
tree-display object than of the requested type. This may hide errors,
and leaves the Outliner in an undefined state (where the stored display
mode doesn't match the tree-display object). I rather don't hide the
fact that all display-modes should be handled here, and emit a clear
error if one isn't.

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

M	source/blender/editors/space_outliner/tree/tree_display.cc

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

diff --git a/source/blender/editors/space_outliner/tree/tree_display.cc b/source/blender/editors/space_outliner/tree/tree_display.cc
index 6b68f1ee4a4..f9141dffd6a 100644
--- a/source/blender/editors/space_outliner/tree/tree_display.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display.cc
@@ -7,6 +7,8 @@
 #include "DNA_listBase.h"
 #include "DNA_space_types.h"
 
+#include "BLI_utildefines.h"
+
 #include "tree_display.hh"
 
 using namespace blender::ed::outliner;
@@ -30,11 +32,11 @@ std::unique_ptr<AbstractTreeDisplay> AbstractTreeDisplay::createFromDisplayMode(
     case SO_OVERRIDES_LIBRARY:
       return std::make_unique<TreeDisplayOverrideLibrary>(space_outliner);
     case SO_VIEW_LAYER:
-      /* FIXME(Julian): this should not be the default! Return nullptr and handle that as valid
-       * case. */
-    default:
       return std::make_unique<TreeDisplayViewLayer>(space_outliner);
   }
+
+  BLI_assert_unreachable();
+  return nullptr;
 }
 
 bool AbstractTreeDisplay::hasWarnings() const



More information about the Bf-blender-cvs mailing list