Blender V5.3
tree_element_id_object.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 "DNA_ID.h"
12#include "DNA_object_types.h"
13#include "DNA_outliner_types.h"
14
15#include "BKE_deform.hh"
16
17#include "../outliner_intern.hh"
18
19#include "tree_display.hh"
25#include "tree_element_pose.hh"
26
27namespace blender {
28
29struct bConstraint;
30
31namespace ed::outliner {
32
34 : TreeElementID(legacy_te, object.id), object_(object)
35{
36}
37
38void TreeElementIDObject::expand(SpaceOutliner & /*space_outliner*/) const
39{
40 /* tuck pointer back in object, to construct hierarchy */
41 object_.id.newid = reinterpret_cast<ID *>(&legacy_te_);
42
43 expand_animation_data(object_.adt);
44 expand_pose();
45 expand_data();
46 expand_materials();
47 expand_constraints();
48 expand_modifiers();
49 expand_gpencil_modifiers();
50 expand_gpencil_effects();
51 expand_vertex_groups();
52 expand_duplicated_group();
53}
54
55void TreeElementIDObject::expand_data() const
56{
57 add_id_element({}, object_.data);
58}
59
60void TreeElementIDObject::expand_pose() const
61{
62 if (!object_.pose) {
63 return;
64 }
66}
67
68void TreeElementIDObject::expand_materials() const
69{
70 for (int a = 0; a < object_.totcol; a++) {
71 add_id_element({.index = a}, reinterpret_cast<ID *>(object_.mat[a]));
72 }
73}
74
75void TreeElementIDObject::expand_constraints() const
76{
77 if (object_.constraints.is_empty()) {
78 return;
79 }
80 TreeElement *tenla = add_element<TreeElementConstraintBase>({}, object_);
81
82 for (const auto [index, con] : object_.constraints.enumerate()) {
83 add_element<TreeElementConstraint>({.parent = tenla, .index = index}, object_, con);
84 /* possible add all other types links? */
85 }
86}
87
88void TreeElementIDObject::expand_modifiers() const
89{
90 if (object_.modifiers.is_empty()) {
91 return;
92 }
94}
95
96void TreeElementIDObject::expand_gpencil_modifiers() const
97{
98 if (object_.greasepencil_modifiers.is_empty()) {
99 return;
100 }
102}
103
104void TreeElementIDObject::expand_gpencil_effects() const
105{
106 if (object_.shader_fx.is_empty()) {
107 return;
108 }
110}
111
112void TreeElementIDObject::expand_vertex_groups() const
113{
114 if (!ELEM(object_.type, OB_MESH, OB_LATTICE, OB_GREASE_PENCIL)) {
115 return;
116 }
117 const ListBaseT<bDeformGroup> *defbase = BKE_object_defgroup_list(&object_);
118 if (defbase->is_empty()) {
119 return;
120 }
122}
123
124void TreeElementIDObject::expand_duplicated_group() const
125{
126 if (object_.instance_collection && (object_.transflag & OB_DUPLICOLLECTION)) {
127 add_id_element({}, reinterpret_cast<ID *>(object_.instance_collection));
128 }
129}
130
131} // namespace ed::outliner
132} // namespace blender
support for deformation groups and hooks.
ID and Library types, which are fundamental for SDNA.
Object is a sort of wrapper for general info.
#define ELEM(...)
TreeElement * add_element(const TreeElementAddParams &params, Args &&...args) const
TreeElement * add_id_element(const TreeElementAddParams &params, ID *id) const
TreeElementIDObject(TreeElement &legacy_te, Object &object)
void expand(SpaceOutliner &) const override
TreeElementID(TreeElement &legacy_te, ID &id)
void expand_animation_data(AnimData *) const
#define index(i)
BMesh Iterators.
const ListBaseT< bDeformGroup > * BKE_object_defgroup_list(const Object *ob)
Definition deform.cc:591
struct bPose * pose
Establish and manage Outliner trees for different display modes.