Blender  V3.3
common.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
9 #include "BLI_listbase.h"
10 
11 #include "BKE_idtype.h"
12 
13 #include "DNA_anim_types.h"
14 #include "DNA_object_types.h"
15 #include "DNA_outliner_types.h"
16 
17 #include "RNA_access.h"
18 #include "RNA_prototypes.h"
19 
20 #include "../outliner_intern.hh"
21 #include "common.hh"
22 #include "tree_display.hh"
23 
24 /* -------------------------------------------------------------------- */
28 const char *outliner_idcode_to_plural(short idcode)
29 {
30  const char *propname = BKE_idtype_idcode_to_name_plural(idcode);
31  PropertyRNA *prop = RNA_struct_type_find_property(&RNA_BlendData, propname);
32  return (prop) ? RNA_property_ui_name(prop) : "UNKNOWN";
33 }
34 
38 {
39  /* build hierarchy */
40  /* XXX also, set extents here... */
41  TreeElement *te = reinterpret_cast<TreeElement *>(lb->first);
42  while (te) {
43  TreeElement *ten = te->next;
44  TreeStoreElem *tselem = TREESTORE(te);
45 
46  if ((tselem->type == TSE_SOME_ID) && te->idcode == ID_OB) {
47  Object *ob = (Object *)tselem->id;
48  if (ob->parent && ob->parent->id.newid) {
49  BLI_remlink(lb, te);
50  TreeElement *tep = (TreeElement *)ob->parent->id.newid;
51  BLI_addtail(&tep->subtree, te);
52  te->parent = tep;
53  }
54  }
55  te = ten;
56  }
57 }
58 
60 {
61  if (adt) {
62  return (adt->action || adt->drivers.first || adt->nla_tracks.first);
63  }
64  return false;
65 }
const char * BKE_idtype_idcode_to_name_plural(short idcode)
Definition: idtype.c:149
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:100
@ ID_OB
Definition: DNA_ID_enums.h:47
Object is a sort of wrapper for general info.
@ TSE_SOME_ID
bool outliner_animdata_test(const AnimData *adt)
Definition: common.cc:59
void outliner_make_object_parent_hierarchy(ListBase *lb)
Definition: common.cc:37
const char * outliner_idcode_to_plural(short idcode)
Definition: common.cc:28
#define TREESTORE(a)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
Definition: rna_access.c:806
const char * RNA_property_ui_name(const PropertyRNA *prop)
Definition: rna_access.c:1875
bAction * action
ListBase drivers
ListBase nla_tracks
struct ID * newid
Definition: DNA_ID.h:370
void * first
Definition: DNA_listBase.h:31
struct Object * parent
struct TreeElement * parent
ListBase subtree
struct TreeElement * next
Establish and manage Outliner trees for different display modes.