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)
| 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. |
no test coverage detected