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

Method GetArchetype

Source/Editor/Surface/NodeFactory.cs:197–223  ·  view source on GitHub ↗

Gets the archetypes for the node. The group archetypes. The group identifier. The type identifier. The output group archetype. The output node archetype. True if found it, otherwise false.

(List<GroupArchetype> groups, ushort groupID, ushort typeID, out GroupArchetype gArch, out NodeArchetype arch)

Source from the content-addressed store, hash-verified

195 /// <param name="arch">The output node archetype.</param>
196 /// <returns>True if found it, otherwise false.</returns>
197 public static bool GetArchetype(List<GroupArchetype> groups, ushort groupID, ushort typeID, out GroupArchetype gArch, out NodeArchetype arch)
198 {
199 gArch = null;
200 arch = null;
201
202 // Find archetype for that node
203 foreach (var groupArchetype in groups)
204 {
205 if (groupArchetype.GroupID == groupID && groupArchetype.Archetypes != null)
206 {
207 foreach (var nodeArchetype in groupArchetype.Archetypes)
208 {
209 if (nodeArchetype.TypeID == typeID)
210 {
211 // Found
212 gArch = groupArchetype;
213 arch = nodeArchetype;
214 return true;
215 }
216 }
217 }
218 }
219
220 // Error
221 Editor.LogError($"Failed to create Visject Surface node with id: {groupID}:{typeID}");
222 return false;
223 }
224
225 /// <summary>
226 /// Creates the node.

Callers 4

SpawnNodeMethod · 0.45
PasteMethod · 0.45
CanUseNodeTypeMethod · 0.45

Calls 1

LogErrorMethod · 0.45

Tested by

no test coverage detected