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

Method Init

Source/Engine/Tools/MaterialGenerator/MaterialGenerator.cpp:65–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool FeatureData::Init()
66{
67 // Load template file
68 const String path = Globals::EngineContentFolder / TEXT("Editor/MaterialTemplates/") + Data.Template;
69 String contents;
70 if (File::ReadAllText(path, contents))
71 {
72 LOG(Error, "Cannot open file {0}", path);
73 return true;
74 }
75 FileTime = FileSystem::GetFileLastEditTime(path);
76
77 int32 i = 0;
78 const int32 length = contents.Length();
79
80 // Skip until input start
81 for (; i < length; i++)
82 {
83 if (contents[i] == '@')
84 break;
85 }
86
87 // Load all inputs
88 do
89 {
90 // Parse input type
91 i++;
92 const int32 inIndex = contents[i++] - '0';
93 ASSERT_LOW_LAYER(Math::IsInRange(inIndex, 0, (int32)FeatureTemplateInputsMapping::MAX - 1));
94
95 // Read until next input start
96 const Char* start = &contents[i];
97 for (; i < length; i++)
98 {
99 const auto c = contents[i];
100 if (c == '@')
101 break;
102 }
103 const Char* end = contents.Get() + i;
104
105 // Set input
106 Inputs[inIndex].Set(start, (int32)(end - start));
107 } while (i < length);
108
109 return false;
110}
111
112void FeatureData::CheckReload()
113{

Callers

nothing calls this directly

Calls 4

IsInRangeFunction · 0.85
LengthMethod · 0.45
GetMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected