Blender V5.3
tree_element_constraint.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
10#include "DNA_object_types.h"
11#include "DNA_outliner_types.h"
12
13#include "RNA_access.hh"
14#include "RNA_prototypes.hh"
15
16#include "BLT_translation.hh"
17
18#include "../outliner_intern.hh"
19
21
22namespace blender::ed::outliner {
23
25 : AbstractTreeElement(legacy_te) /* , object_(object) */
26{
28 legacy_te.name = IFACE_("Constraints");
29}
30
32{
33 return &object.id;
34}
35
37 Object & /*object*/,
38 bConstraint &con)
39 : AbstractTreeElement(legacy_te), /* object_(object), */ con_(con)
40{
42 legacy_te.name = con_.name;
43 legacy_te.directdata = &con_;
44}
45
47{
48 return &object.id;
49}
50
51std::optional<BIFIconID> TreeElementConstraint::get_icon() const
52{
53 bConstraint *con = static_cast<bConstraint *>(legacy_te_.directdata);
54 Object *ob = reinterpret_cast<Object *>(legacy_te_.store_elem->id);
55 const PointerRNA ptr = RNA_pointer_create_discrete(&ob->id, RNA_Constraint, con);
56 return RNA_struct_ui_icon(ptr.type);
57}
58} // namespace blender::ed::outliner
#define IFACE_(msgid)
Object is a sort of wrapper for general info.
TreeElementConstraintBase(TreeElement &legacy_te, Object &object)
static ID * owner_id(Object &object, bConstraint &con)
std::optional< BIFIconID > get_icon() const override
TreeElementConstraint(TreeElement &legacy_te, Object &object, bConstraint &con)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
int RNA_struct_ui_icon(const StructRNA *type)
StructRNA * type
Definition RNA_types.hh:63