Skip to content

Commit 10693e9

Browse files
committed
Added Scene::Tag::Associative for marking relation with no data.
1 parent c716f26 commit 10693e9

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

Foundation/Public/Aurora.Scene/Common.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,8 @@ namespace Scene
6969

7070
// -=(Undocumented)=-
7171
Toggleable = 0b00001000,
72+
73+
// -=(Undocumented)=-
74+
Associative = 0b00010000,
7275
};
7376
}

Foundation/Public/Aurora.Scene/Component.hpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,30 @@ namespace Scene
8383

8484
// -=(Undocumented)=-
8585
template<typename Type>
86-
void Attach()
86+
Ref<Component> Attach()
8787
{
8888
mHandle.template add<Type>();
89+
return (* this);
8990
}
9091

9192
// -=(Undocumented)=-
9293
template<typename First>
93-
void Attach(Component Component)
94+
Ref<Component> Attach(Component Component)
9495
{
9596
mHandle.template add<First>(Component.GetID());
97+
return (* this);
9698
}
9799

98100
// -=(Undocumented)=-
99-
void Attach(Component First, Component Second)
101+
Ref<Component> Attach(Component First, Component Second)
100102
{
101103
mHandle.add(First.GetID(), Second.GetID());
104+
return (* this);
102105
}
103106

104107
// -=(Undocumented)=-
105108
template<typename Type>
106-
void Attach(Any<Type> Component)
109+
Ref<Component> Attach(Any<Type> Component)
107110
{
108111
if constexpr (std::is_empty_v<Type>)
109112
{
@@ -113,6 +116,7 @@ namespace Scene
113116
{
114117
mHandle.template set<Type>(Move(Component));
115118
}
119+
return (* this);
116120
}
117121

118122
// -=(Undocumented)=-
@@ -142,22 +146,22 @@ namespace Scene
142146
{
143147
mHandle.add(flecs::CanToggle);
144148
}
145-
return * this;
149+
return (* this);
146150
}
147151

148152
// -=(Undocumented)=-
149153
template<typename Type>
150154
Ref<Component> With()
151155
{
152156
mHandle.add(EcsWith, mHandle.world().template component<Type>());
153-
return * this;
157+
return (* this);
154158
}
155159

156160
// -=(Undocumented)=-
157161
Ref<Component> With(Component Component)
158162
{
159163
mHandle.add(EcsWith, Component.GetHandle());
160-
return * this;
164+
return (* this);
161165
}
162166

163167
// -=(Undocumented)=-
@@ -286,7 +290,12 @@ namespace Scene
286290
{
287291
Detach(flecs::CanToggle);
288292
}
289-
return * this;
293+
294+
if constexpr (HasBit(Trait, CastEnum(Trait::Associative)))
295+
{
296+
Detach(flecs::PairIsTag);
297+
}
298+
return (* this);
290299
}
291300

292301
// -=(Undocumented)=-
@@ -409,7 +418,7 @@ namespace Scene
409418
Ref<Component> SetName(CStr Name)
410419
{
411420
mHandle.set_name(Name.data());
412-
return * this;
421+
return (* this);
413422
}
414423

415424
// -=(Undocumented)=-
@@ -424,23 +433,23 @@ namespace Scene
424433
Ref<Component> OnAdd(Any<Function> Callback)
425434
{
426435
mHandle.on_add(Callback);
427-
return * this;
436+
return (* this);
428437
}
429438

430439
// -=(Undocumented)=-
431440
template<typename Function>
432441
Ref<Component> OnSet(Any<Function> Callback)
433442
{
434443
mHandle.on_set(Callback);
435-
return * this;
444+
return (* this);
436445
}
437446

438447
// -=(Undocumented)=-
439448
template<typename Function>
440449
Ref<Component> OnRemove(Any<Function> Callback)
441450
{
442451
mHandle.on_remove(Callback);
443-
return * this;
452+
return (* this);
444453
}
445454

446455
// -=(Undocumented)=-

0 commit comments

Comments
 (0)