| 48 | } |
| 49 | |
| 50 | bool 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 | |
| 77 | void BehaviorTreeGraph::Setup(BehaviorTree* tree) |
| 78 | { |
nothing calls this directly
no test coverage detected