Blender V5.3
editors/space_outliner/tree/common.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
10
11#include "BLI_listbase.hh"
12
13#include "BKE_idtype.hh"
14
15#include "DNA_anim_types.h"
16#include "DNA_object_types.h"
17#include "DNA_outliner_types.h"
18
19#include "RNA_access.hh"
20#include "RNA_prototypes.hh"
21
22#include "../outliner_intern.hh"
23#include "common.hh"
24
25namespace blender::ed::outliner {
26
27/* -------------------------------------------------------------------- */
30
31const char *outliner_idcode_to_plural(short idcode)
32{
33 const char *propname = BKE_idtype_idcode_to_name_plural(idcode);
34 PropertyRNA *prop = RNA_struct_type_find_property(RNA_BlendData, propname);
35 return (prop) ? RNA_property_ui_name(prop) : "UNKNOWN";
36}
37
39
40void outliner_make_object_parent_hierarchy(ListBaseT<TreeElement> *lb)
41{
42 /* build hierarchy */
43 /* XXX also, set extents here... */
44 TreeElement *te = lb->first();
45 while (te) {
46 TreeElement *ten = te->next;
47 TreeStoreElem *tselem = TREESTORE(te);
48
49 if ((tselem->type == TSE_SOME_ID) && te->idcode == ID_OB) {
50 Object *ob = id_cast<Object *>(tselem->id);
51 if (ob->parent && ob->parent->id.newid) {
52 BLI_remlink(lb, te);
53 TreeElement *tep = reinterpret_cast<TreeElement *>(ob->parent->id.newid);
54 BLI_addtail(&tep->subtree, te);
55 te->parent = tep;
56 }
57 }
58 te = ten;
59 }
60}
61
63{
64 if (adt) {
65 return (adt->action || adt->drivers.first() || adt->nla_tracks.first());
66 }
67 return false;
68}
69
70} // namespace blender::ed::outliner
Object is a sort of wrapper for general info.
bool outliner_animdata_test(const AnimData *adt)
const char * outliner_idcode_to_plural(short idcode)
void outliner_make_object_parent_hierarchy(ListBaseT< TreeElement > *lb)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:138
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
const char * BKE_idtype_idcode_to_name_plural(short idcode)
Definition idtype.cc:268
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
const char * RNA_property_ui_name(const PropertyRNA *prop, const PointerRNA *ptr)
#define TREESTORE(a)
ListBaseT< FCurve > drivers
ListBaseT< NlaTrack > nla_tracks
struct ID * newid
Definition DNA_ID.h:419
struct Object * parent