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

Method onNodeLoaded

Source/Engine/AI/BehaviorTree.cpp:50–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50bool BehaviorTreeGraph::onNodeLoaded(Node* n)
51{
52 const Node& node = *n;
53 if (IS_BT_NODE(node))
54 {
55 // Create node instance object
56 ScriptingTypeHandle type = Scripting::FindScriptingType((StringAnsiView)n->Values[0]);
57 if (!type)
58 type = Scripting::FindScriptingType(StringAnsi((StringView)n->Values[0]));
59 if (type)
60 {
61 n->Instance = (BehaviorTreeNode*)Scripting::NewObject(type);
62 const Variant& data = n->Values[1];
63 if (data.Type == VariantType::Blob)
64 JsonSerializer::LoadFromBytes(n->Instance, Span<byte>((byte*)data.AsBlob.Data, data.AsBlob.Length), FLAXENGINE_VERSION_BUILD);
65 }
66 else
67 {
68 const String name = n->Values[0].ToString();
69 if (name.HasChars())
70 LOG(Error, "Missing type '{0}'", name);
71 }
72 }
73
74 return VisjectGraph<BehaviorTreeGraphNode>::onNodeLoaded(n);
75}
76
77void BehaviorTreeGraph::Setup(BehaviorTree* tree)
78{

Callers

nothing calls this directly

Calls 6

FindScriptingTypeFunction · 0.85
NewObjectFunction · 0.85
LoadFromBytesFunction · 0.85
StringAnsiFunction · 0.50
ToStringMethod · 0.45
HasCharsMethod · 0.45

Tested by

no test coverage detected