diff options
Diffstat (limited to 'source')
7 files changed, 199 insertions, 84 deletions
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_scene.hh b/source/blender/editors/space_outliner/tree/tree_element_id_scene.hh new file mode 100644 index 00000000000..3340bacd307 --- /dev/null +++ b/source/blender/editors/space_outliner/tree/tree_element_id_scene.hh @@ -0,0 +1,43 @@ +/* + * 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 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 |