Outliner: Port layer collection elements to new tree-element code design #111220
|
@ -71,6 +71,7 @@ set(SRC
|
|||
tree/tree_element_id_scene.cc
|
||||
tree/tree_element_id_texture.cc
|
||||
tree/tree_element_label.cc
|
||||
tree/tree_element_layer_collection.cc
|
||||
tree/tree_element_linked_object.cc
|
||||
tree/tree_element_nla.cc
|
||||
tree/tree_element_modifier.cc
|
||||
|
@ -112,6 +113,7 @@ set(SRC
|
|||
tree/tree_element_id_scene.hh
|
||||
tree/tree_element_id_texture.hh
|
||||
tree/tree_element_label.hh
|
||||
tree/tree_element_layer_collection.hh
|
||||
tree/tree_element_linked_object.hh
|
||||
tree/tree_element_nla.hh
|
||||
tree/tree_element_modifier.hh
|
||||
|
|
|
@ -271,6 +271,9 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
|||
else if (type == TSE_R_LAYER) {
|
||||
id = &static_cast<ViewLayerElementCreateData *>(idv)->scene->id;
|
||||
}
|
||||
else if (type == TSE_LAYER_COLLECTION) {
|
||||
id = &static_cast<LayerCollection *>(idv)->collection->id;
|
||||
}
|
||||
else if (type == TSE_MODIFIER) {
|
||||
id = &static_cast<ModifierCreateElementData *>(idv)->object->id;
|
||||
}
|
||||
|
@ -424,7 +427,8 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
|||
TSE_MODIFIER,
|
||||
TSE_MODIFIER_BASE,
|
||||
TSE_GREASE_PENCIL_NODE,
|
||||
TSE_LINKED_OB))
|
||||
TSE_LINKED_OB,
|
||||
TSE_LAYER_COLLECTION))
|
||||
{
|
||||
BLI_assert_msg(false, "Element type should already use new AbstractTreeElement design");
|
||||
}
|
||||
|
|
|
@ -153,10 +153,7 @@ void TreeDisplayViewLayer::add_layer_collections_recursive(ListBase &tree,
|
|||
else {
|
||||
ID *id = &lc->collection->id;
|
||||
ten = outliner_add_element(
|
||||
&space_outliner_, &tree, id, &parent_ten, TSE_LAYER_COLLECTION, 0);
|
||||
|
||||
ten->name = id->name + 2;
|
||||
ten->directdata = lc;
|
||||
&space_outliner_, &tree, lc, &parent_ten, TSE_LAYER_COLLECTION, 0);
|
||||
|
||||
/* Open by default, except linked collections, which may contain many elements. */
|
||||
TreeStoreElem *tselem = TREESTORE(ten);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "tree_element_grease_pencil_node.hh"
|
||||
#include "tree_element_id.hh"
|
||||
#include "tree_element_label.hh"
|
||||
#include "tree_element_layer_collection.hh"
|
||||
#include "tree_element_linked_object.hh"
|
||||
#include "tree_element_modifier.hh"
|
||||
#include "tree_element_nla.hh"
|
||||
|
@ -178,6 +179,9 @@ std::unique_ptr<AbstractTreeElement> AbstractTreeElement::createFromType(const i
|
|||
}
|
||||
case TSE_LINKED_OB:
|
||||
return std::make_unique<TreeElementLinkedObject>(legacy_te, *static_cast<ID *>(idv));
|
||||
case TSE_LAYER_COLLECTION:
|
||||
return std::make_unique<TreeElementLayerCollection>(legacy_te,
|
||||
*static_cast<LayerCollection *>(idv));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#include "DNA_collection_types.h"
|
||||
#include "DNA_outliner_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "../outliner_intern.hh"
|
||||
|
||||
#include "tree_element_layer_collection.hh"
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
TreeElementLayerCollection::TreeElementLayerCollection(TreeElement &legacy_te, LayerCollection &lc)
|
||||
: AbstractTreeElement(legacy_te), lc_(lc)
|
||||
{
|
||||
BLI_assert(legacy_te.store_elem->type == TSE_LAYER_COLLECTION);
|
||||
legacy_te.name = lc_.collection->id.name + 2;
|
||||
legacy_te.directdata = &lc_;
|
||||
}
|
||||
|
||||
} // namespace blender::ed::outliner
|
|
@ -0,0 +1,22 @@
|
|||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tree_element.hh"
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
class TreeElementLayerCollection final : public AbstractTreeElement {
|
||||
LayerCollection &lc_;
|
||||
|
||||
public:
|
||||
TreeElementLayerCollection(TreeElement &legacy_te, LayerCollection &lc);
|
||||
};
|
||||
|
||||
} // namespace blender::ed::outliner
|
Loading…
Reference in New Issue