MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetOrderInParent

Method SetOrderInParent

Source/Engine/Scripting/Script.cpp:150–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void Script::SetOrderInParent(int32 index)
151{
152 if (!_parent)
153 return;
154
155 // Cache data
156 auto& parentScripts = _parent->Scripts;
157 const int32 currentIndex = parentScripts.Find(this);
158 ASSERT(currentIndex != INVALID_INDEX);
159
160 // Check if index will change
161 if (currentIndex != index)
162 {
163 parentScripts.RemoveAtKeepOrder(currentIndex);
164
165 // Check if index is invalid
166 if (index < 0 || index >= parentScripts.Count())
167 {
168 // Append at the end
169 parentScripts.Add(this);
170 }
171 else
172 {
173 // Change order
174 parentScripts.Insert(index, this);
175 }
176 }
177}
178
179void Script::SetupType()
180{

Callers

nothing calls this directly

Calls 5

RemoveAtKeepOrderMethod · 0.80
FindMethod · 0.45
CountMethod · 0.45
AddMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected