Banuba SDK
BNBEntity.h
Go to the documentation of this file.
1 // AUTOGENERATED FILE - DO NOT MODIFY!
2 // This file was generated by Djinni from scene.djinni
3 
4 #import "BNBComponentType.h"
5 #import <Foundation/Foundation.h>
6 @class BNBComponent;
7 @class BNBEntity;
8 @class BNBLayer;
9 
10 
11 /**
12  * A structure element of the scene.
13  *
14  * To construct a scene, you should form a hierarchy of entities to create its
15  * structure, then add different components such as lights, cameras, and
16  * geometry to entities to create visible content.
17  *
18  * Each entity has a name which could be used for finding the entity in a hierarchy.
19  *
20  * Entities in the scene form a tree hierarchy between parents and children.
21  *
22  * Each entity could be in an enabled or disabled state. The disabling of the entity
23  * is equivalent to removing the entity and all its children from the hierarchy.
24  *
25  * An entity is a container for components. Each entity could contain several components,
26  * but only one component of each component type. The Transform component is mandatory
27  * and it implicitly placed in each entity.
28  *
29  */
30 
31 #ifndef DJINNI_EXPORT
32  #define DJINNI_EXPORT __attribute__((__visibility__("default")))
33 #endif
34 
36 @interface BNBEntity : NSObject
37 
38 /**
39  * Set a new name to the entity. Name could be empty.
40  *@param name (string): new entity name.
41  */
42 - (void)setName:(nonnull NSString *)name;
43 
44 /**@return entity name (string) */
45 - (nonnull NSString *)getName;
46 
47 /**
48  *add entiy as child to hierarchy
49  *@param child (entity): child entity.
50  */
51 - (void)addChild:(nullable BNBEntity *)child;
52 
53 /**
54  *remove entiy as child to hierarchy
55  *@param child (entity): child entity.
56  */
57 - (void)removeChild:(nullable BNBEntity *)child;
58 
59 /**get all child entites list. */
60 - (nonnull NSArray<BNBEntity *> *)getChildren;
61 
62 /**remove all child entites list. */
63 - (void)clearChildren;
64 
65 /**
66  * Perform depth-first traverse of entity tree.
67  * Return first found child with name `entityName` or NULL if such an entity doesn't exist.
68  *@param entityName (string): name of desired entity
69  *@return found entity (entity) or null
70  */
71 - (nullable BNBEntity *)findChildByName:(nonnull NSString *)entityName;
72 
73 /**@return parent entity and null if given entity is root. */
74 - (nullable BNBEntity *)getParent;
75 
76 /**
77  *Set enable/disable entity flag. The disabling of the entity is equivalent to removing the entity and all its children from the hierarchy.
78  *@param active (bool) activity flag.
79  */
80 - (void)setActive:(BOOL)active;
81 
82 /**@return activity flag (bool) */
83 - (BOOL)isActive;
84 
85 /**
86  *Add entity for given layer if it is wasn't added before.
87  *@param layer (layer): layer to add.
88  */
89 - (void)addIntoLayer:(nullable BNBLayer *)layer;
90 
91 /**
92  *Removes entity from given layer if it is was added before.
93  *@params layer (layer): layer from remove.
94  */
95 - (void)removeFromLayer:(nullable BNBLayer *)layer;
96 
97 /**returns list of layers in which entity was added. */
98 - (nonnull NSArray<BNBLayer *> *)getLayers;
99 
100 /**
101  *add given component to entity if component of given type wasn't added before.
102  *@param component (component): component to add.
103  */
104 - (void)addComponent:(nullable BNBComponent *)component;
105 
106 /**
107  *check if component of given type was added.
108  *@param component_type (component_type): component type to check.
109  *@return flag (bool)
110  */
111 - (BOOL)hasComponent:(BNBComponentType)type;
112 
113 /**
114  *get component of given type.
115  *@param component_type (component_type): component type to get.
116  *@return component of given type (component)
117  */
118 - (nullable BNBComponent *)getComponent:(BNBComponentType)type;
119 
120 /**
121  *remove given component to entity if component of given component was added before.
122  *@param component (component): component to remove.
123  */
124 - (void)removeComponent:(nullable BNBComponent *)component;
125 
126 @end
DJINNI_EXPORT
#define DJINNI_EXPORT
A structure element of the scene.
Definition: BNBEntity.h:32
-[BNBEntity getName]
nonnull NSString * getName()
-[BNBEntity getLayers]
nonnull NSArray< BNBLayer * > * getLayers()
returns list of layers in which entity was added.
-[BNBEntity isActive]
BOOL isActive()
BNBComponent
Definition: BNBComponent.h:21
-[BNBEntity getChildren]
nonnull NSArray< BNBEntity * > * getChildren()
get all child entites list.
-[BNBEntity clearChildren]
void clearChildren()
remove all child entites list.
-[BNBEntity getParent]
nullable BNBEntity * getParent()
BNBLayer
Definition: BNBLayer.h:18
BNBEntity
Definition: BNBEntity.h:36
BNBComponentType.h