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

Method load

Source/Engine/Content/Assets/MaterialFunction.cpp:20–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20Asset::LoadResult MaterialFunction::load()
21{
22#if COMPILE_WITH_MATERIAL_GRAPH
23 // Load graph
24 const auto surfaceChunk = GetChunk(0);
25 if (!surfaceChunk || !surfaceChunk->IsLoaded())
26 return LoadResult::MissingDataChunk;
27 MemoryReadStream stream(surfaceChunk->Get(), surfaceChunk->Size());
28 if (Graph.Load(&stream, USE_EDITOR))
29 return LoadResult::Failed;
30
31 // Cache input and output nodes
32 bool tooManyInputsOutputs = false;
33 for (int32 i = 0; i < Graph.Nodes.Count(); i++)
34 {
35 auto& node = Graph.Nodes[i];
36 if (node.Type == GRAPH_NODE_MAKE_TYPE(16, 1))
37 {
38 if (Inputs.Count() < 16)
39 Inputs.Add(i);
40 else
41 tooManyInputsOutputs = true;
42 }
43 else if (node.Type == GRAPH_NODE_MAKE_TYPE(16, 2))
44 {
45 if (Outputs.Count() < 16)
46 Outputs.Add(i);
47 else
48 tooManyInputsOutputs = true;
49 }
50 }
51 if (tooManyInputsOutputs)
52 {
53 LOG(Error, "Too many function inputs/outputs in '{0}'. The limit is max 16 inputs and max 16 outputs.", ToString());
54 }
55#endif
56
57 return LoadResult::Ok;
58}
59
60void MaterialFunction::unload(bool isReloading)
61{

Callers

nothing calls this directly

Calls 8

GetChunkFunction · 0.85
ToStringFunction · 0.50
IsLoadedMethod · 0.45
GetMethod · 0.45
SizeMethod · 0.45
LoadMethod · 0.45
CountMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected