MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / initializeAsset

Method initializeAsset

Engine/source/T3D/assets/MaterialAsset.cpp:165–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void MaterialAsset::initializeAsset()
166{
167 // Call parent.
168 Parent::initializeAsset();
169
170 mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
171
172 if (mMatDefinitionName == StringTable->EmptyString())
173 {
174 mLoadedState = Failed;
175 return;
176 }
177
178 if (size() != 0 && mScriptPath == StringTable->EmptyString())
179 {
180 mLoadedState = EmbeddedDefinition;
181 }
182 else if (Torque::FS::IsScriptFile(mScriptPath))
183 {
184 if (!Sim::findObject(mMatDefinitionName))
185 {
186 if (Con::executeFile(mScriptPath, false, false))
187 {
188 mLoadedState = ScriptLoaded;
189 }
190 else
191 {
192 mLoadedState = Failed;
193 }
194 }
195 else
196 {
197 mLoadedState = DefinitionAlreadyExists;
198 }
199 }
200
201 loadMaterial();
202}
203
204void MaterialAsset::onAssetRefresh()
205{

Callers

nothing calls this directly

Calls 5

IsScriptFileFunction · 0.85
executeFileFunction · 0.85
EmptyStringMethod · 0.80
sizeFunction · 0.50
findObjectFunction · 0.50

Tested by

no test coverage detected