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

Method LoadSubGraph

Source/Engine/Animations/Graph/AnimGraph.Base.cpp:12–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "Engine/Serialization/MemoryReadStream.h"
11
12AnimSubGraph* AnimGraphBase::LoadSubGraph(const void* data, int32 dataLength, const Char* name)
13{
14 if (data == nullptr || dataLength == 0)
15 {
16 // No graph
17 return nullptr;
18 }
19 name = name ? name : TEXT("?");
20
21 // Allocate graph
22 // TODO: use shared allocations for graphs? eg. block allocator in AnimGraph for better performance
23 auto subGraph = New<AnimSubGraph>(_graph);
24
25 // Load graph
26 MemoryReadStream stream((const byte*)data, dataLength);
27 if (subGraph->Load(&stream, false))
28 {
29 // Load failed
30 LOG(Warning, "Failed to load sub graph {0}.", name);
31 return nullptr;
32 }
33
34 // Done
35 BucketsCountTotal += subGraph->BucketsCountTotal;
36 SubGraphs.Add(subGraph);
37 return subGraph;
38}
39
40bool AnimGraphBase::Load(ReadStream* stream, bool loadMeta)
41{

Callers

nothing calls this directly

Calls 2

LoadMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected