Blender V4.3
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
11#include "BLI_listbase.h"
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/* -------------------------------------------------------------------- */
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
41{
42 /* build hierarchy */
43 /* XXX also, set extents here... */
44 TreeElement *te = static_cast<TreeElement *>(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 = (Object *)tselem->id;
51 if (ob->parent && ob->parent->id.newid) {
52 BLI_remlink(lb, te);
53 TreeElement *tep = (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
const char * BKE_idtype_idcode_to_name_plural(short idcode)
Definition idtype.cc:175
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:130
@ ID_OB
Object is a sort of wrapper for general info.
@ TSE_SOME_ID
bool outliner_animdata_test(const AnimData *adt)
Definition common.cc:62
const char * outliner_idcode_to_plural(short idcode)
Definition common.cc:31
void outliner_make_object_parent_hierarchy(ListBase *lb)
Definition common.cc:40
#define TREESTORE(a)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
const char * RNA_property_ui_name(const PropertyRNA *prop)
bAction * action
ListBase drivers
ListBase nla_tracks
struct ID * newid
Definition DNA_ID.h:417
void * first
struct Object * parent