[Bf-blender-cvs] [fc0de69471f] master: Cleanup: Split up new files for Outliner ID tree-elements

Julian Eisel noreply at git.blender.org
Mon Mar 8 18:38:31 CET 2021


Commit: fc0de69471f0e6a69ae6ffd01ca27156e524ce40
Author: Julian Eisel
Date:   Mon Mar 8 18:34:53 2021 +0100
Branches: master
https://developer.blender.org/rBfc0de69471f0e6a69ae6ffd01ca27156e524ce40

Cleanup: Split up new files for Outliner ID tree-elements

Splits up `tree_element_id.cc`/`tree_element_id.hh`.
If we move all ID types into this one file, it will become rather big. Smaller
files are probably easier to work with. We could still keep small classes like
`TreeElementIDLibrary` in the general file, don't mind really, but this creates
separate files for that too.

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

M	source/blender/editors/space_outliner/CMakeLists.txt
M	source/blender/editors/space_outliner/tree/tree_element_id.cc
M	source/blender/editors/space_outliner/tree/tree_element_id.hh
A	source/blender/editors/space_outliner/tree/tree_element_id_library.cc
A	source/blender/editors/space_outliner/tree/tree_element_id_library.hh
A	source/blender/editors/space_outliner/tree/tree_element_id_scene.cc
A	source/blender/editors/space_outliner/tree/tree_element_id_scene.hh

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

diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 0306807d9ad..eb3371e989a 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -60,6 +60,8 @@ set(SRC
   tree/tree_element_driver.cc
   tree/tree_element_gpencil_layer.cc
   tree/tree_element_id.cc
+  tree/tree_element_id_library.cc
+  tree/tree_element_id_scene.cc
   tree/tree_element_nla.cc
   tree/tree_element_scene_objects.cc
   tree/tree_element_view_layer.cc
@@ -74,6 +76,8 @@ set(SRC
   tree/tree_element_driver.hh
   tree/tree_element_gpencil_layer.hh
   tree/tree_element_id.hh
+  tree/tree_element_id_library.hh
+  tree/tree_element_id_scene.hh
   tree/tree_element_nla.hh
   tree/tree_element_scene_objects.hh
   tree/tree_element_view_layer.hh
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id.cc b/source/blender/editors/space_outliner/tree/tree_element_id.cc
index a061c084027..31dfed35d8a 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_id.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_id.cc
@@ -31,6 +31,8 @@
 
 #include "../outliner_intern.h"
 #include "tree_display.h"
+#include "tree_element_id_library.hh"
+#include "tree_element_id_scene.hh"
 
 #include "tree_element_id.hh"
 
@@ -162,65 +164,4 @@ void TreeElementID::expand_animation_data(SpaceOutliner &space_outliner,
   }
 }
 
-/* -------------------------------------------------------------------- */
-/* Library Tree-Element */
-
-TreeElementIDLibrary::TreeElementIDLibrary(TreeElement &legacy_te, Library &library)
-    : TreeElementID(legacy_te, library.id)
-{
-  legacy_te.name = library.filepath;
-}
-
-bool TreeElementIDLibrary::isExpandValid() const
-{
-  return true;
-}
-
-/* -------------------------------------------------------------------- */
-/* Scene Tree-Element */
-
-TreeElementIDScene::TreeElementIDScene(TreeElement &legacy_te, Scene &scene)
-    : TreeElementID(legacy_te, scene.id), scene_(scene)
-{
-}
-
-bool TreeElementIDScene::isExpandValid() const
-{
-  return true;
-}
-
-void TreeElementIDScene::expand(SpaceOutliner &space_outliner) const
-{
-  expandViewLayers(space_outliner);
-  expandWorld(space_outliner);
-  expandCollections(space_outliner);
-  expandObjects(space_outliner);
-
-  expand_animation_data(space_outliner, scene_.adt);
-}
-
-void TreeElementIDScene::expandViewLayers(SpaceOutliner &space_outliner) const
-{
-  outliner_add_element(
-      &space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_R_LAYER_BASE, 0);
-}
-
-void TreeElementIDScene::expandWorld(SpaceOutliner &space_outliner) const
-{
-  outliner_add_element(
-      &space_outliner, &legacy_te_.subtree, scene_.world, &legacy_te_, TSE_SOME_ID, 0);
-}
-
-void TreeElementIDScene::expandCollections(SpaceOutliner &space_outliner) const
-{
-  outliner_add_element(
-      &space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_SCENE_COLLECTION_BASE, 0);
-}
-
-void TreeElementIDScene::expandObjects(SpaceOutliner &space_outliner) const
-{
-  outliner_add_element(
-      &space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_SCENE_OBJECTS_BASE, 0);
-}
-
 }  // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id.hh b/source/blender/editors/space_outliner/tree/tree_element_id.hh
index 21bc25564fd..2d077464b6d 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_id.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element_id.hh
@@ -16,6 +16,8 @@
 
 /** \file
  * \ingroup spoutliner
+ *
+ * Tree element classes for the tree elements directly representing an ID (#TSE_SOME_ID).
  */
 
 #pragma once
@@ -53,27 +55,4 @@ class TreeElementID : public AbstractTreeElement {
   void expand_library_overrides(SpaceOutliner &) const;
 };
 
-class TreeElementIDLibrary final : public TreeElementID {
- public:
-  TreeElementIDLibrary(TreeElement &legacy_te, Library &library);
-
-  bool isExpandValid() const override;
-};
-
-class TreeElementIDScene final : public TreeElementID {
-  Scene &scene_;
-
- public:
-  TreeElementIDScene(TreeElement &legacy_te, Scene &scene);
-
-  void expand(SpaceOutliner &) const override;
-  bool isExpandValid() const override;
-
- private:
-  void expandViewLayers(SpaceOutliner &) const;
-  void expandWorld(SpaceOutliner &) const;
-  void expandCollections(SpaceOutliner &) const;
-  void expandObjects(SpaceOutliner &) const;
-};
-
 }  // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_library.cc b/source/blender/editors/space_outliner/tree/tree_element_id_library.cc
new file mode 100644
index 00000000000..36f536c9845
--- /dev/null
+++ b/source/blender/editors/space_outliner/tree/tree_element_id_library.cc
@@ -0,0 +1,40 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup spoutliner
+ */
+
+#include "DNA_listBase.h"
+
+#include "../outliner_intern.h"
+
+#include "tree_element_id_library.hh"
+
+namespace blender::ed::outliner {
+
+TreeElementIDLibrary::TreeElementIDLibrary(TreeElement &legacy_te, Library &library)
+    : TreeElementID(legacy_te, library.id)
+{
+  legacy_te.name = library.filepath;
+}
+
+bool TreeElementIDLibrary::isExpandValid() const
+{
+  return true;
+}
+
+}  // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_library.hh b/source/blender/editors/space_outliner/tree/tree_element_id_library.hh
new file mode 100644
index 00000000000..88660cd8aa9
--- /dev/null
+++ b/source/blender/editors/space_outliner/tree/tree_element_id_library.hh
@@ -0,0 +1,34 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup spoutliner
+ */
+
+#pragma once
+
+#include "tree_element_id.hh"
+
+namespace blender::ed::outliner {
+
+class TreeElementIDLibrary final : public TreeElementID {
+ public:
+  TreeElementIDLibrary(TreeElement &legacy_te, Library &library);
+
+  bool isExpandValid() const override;
+};
+
+}  // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id_scene.cc b/source/blender/editors/space_outliner/tree/tree_element_id_scene.cc
new file mode 100644
index 00000000000..ae81b44a1e4
--- /dev/null
+++ b/source/blender/editors/space_outliner/tree/tree_element_id_scene.cc
@@ -0,0 +1,74 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup spoutliner
+ */
+
+#include "DNA_listBase.h"
+
+#include "../outliner_intern.h"
+#include "tree_display.h"
+
+#include "tree_element_id_scene.hh"
+
+namespace blender::ed::outliner {
+
+TreeElementIDScene::TreeElementIDScene(TreeElement &legacy_te, Scene &scene)
+    : TreeElementID(legacy_te, scene.id), scene_(scene)
+{
+}
+
+bool TreeElementIDScene::isExpandValid() const
+{
+  return true;
+}
+
+void TreeElementIDScene::expand(SpaceOutliner &space_outliner) const
+{
+  expandViewLayers(space_outliner);
+  expandWorld(space_outliner);
+  expandCollections(space_outliner);
+  expandObjects(space_outliner);
+
+  expand_animation_data(space_outliner, scene_.adt);
+}
+
+void TreeElementIDScene::expandViewLayers(SpaceOutliner &space_outliner) const
+{
+  outliner_add_element(
+      &space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_R_LAYER_BASE, 0);
+}
+
+void TreeElementIDScene::expandWorld(SpaceOutliner &space_outliner) const
+{
+  outliner_add_element(
+      &space_outliner, &legacy_te_.subtree, scene_.world, &legacy_te_, TSE_SOME_ID, 0);
+}
+
+void TreeElementIDScene::expandCollections(SpaceOutliner &space_outliner) const
+{
+  outliner_add_element(
+      &space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_SCENE_COLLECTION_BASE, 0);
+}
+
+void TreeElementIDScene::expandObjects(SpaceOutliner &space_outliner) const
+{
+  outliner_add_element(
+      &space_outliner, &legacy_te_.subtree, &scene_, &legacy_te_, TSE_SCENE_OBJECTS_BASE, 0);
+}
+
+}  // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_element_id.hh b/source/blender/editors/space_outliner/tree/tree_element_id_scene.

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list