| 163 | } |
| 164 | |
| 165 | void 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 | |
| 204 | void MaterialAsset::onAssetRefresh() |
| 205 | { |
nothing calls this directly
no test coverage detected