Blender V5.3
tree_element_grease_pencil_node.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_listbase.hh"
10
11#include "BKE_grease_pencil.hh"
12
13#include "DNA_outliner_types.h"
14
15#include "../outliner_intern.hh"
16
17#include "tree_display.hh"
19
20namespace blender::ed::outliner {
21
23 GreasePencil &owner_grease_pencil,
25 : AbstractTreeElement(legacy_te), owner_grease_pencil_(owner_grease_pencil), node_(node)
26{
28 legacy_te.name = node.name().c_str();
29}
30
31void TreeElementGreasePencilNode::expand(SpaceOutliner & /*space_outliner*/) const
32{
33 if (!node_.is_group()) {
34 return;
35 }
36 int index = 0;
37 for (GreasePencilLayerTreeNode &child : node_.as_group().children.items_reversed()) {
39 {.index = index++}, owner_grease_pencil_, child.wrap());
40 }
41}
42
45{
46 return &owner_grease_pencil.id;
47}
48
53
54std::optional<BIFIconID> TreeElementGreasePencilNode::get_icon() const
55{
56 BIFIconID icon = ICON_OUTLINER_DATA_GP_LAYER;
57 if (node_.is_group()) {
58 const bke::greasepencil::LayerGroup &group = node_.as_group();
59
60 icon = ICON_GREASEPENCIL_LAYER_GROUP;
61 if (group.color_tag != LAYERGROUP_COLOR_NONE) {
62 icon = ICON_LAYERGROUP_COLOR_01 + int(group.color_tag);
63 }
64 }
65 return icon;
66}
67} // namespace blender::ed::outliner
Low-level operations for grease pencil.
TreeElement * add_element(const TreeElementAddParams &params, Args &&...args) const
static ID * owner_id(GreasePencil &owner_grease_pencil, bke::greasepencil::TreeNode &node)
TreeElementGreasePencilNode(TreeElement &legacy_te, GreasePencil &owner_grease_pencil, bke::greasepencil::TreeNode &node)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int BIFIconID
Definition ED_asset.hh:30
Establish and manage Outliner trees for different display modes.