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

Method preload

Engine/source/T3D/shapeBase.cpp:303–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303bool ShapeBaseData::preload(bool server, String &errorStr)
304{
305 if (!Parent::preload(server, errorStr))
306 return false;
307 bool shapeError = false;
308
309 // Resolve objects transmitted from server
310 if (!server) {
311
312 if( !explosion && explosionID != 0 )
313 {
314 if( Sim::findObject( explosionID, explosion ) == false)
315 {
316 Con::errorf( ConsoleLogEntry::General, "ShapeBaseData::preload: Invalid packet, bad datablockId(explosion): 0x%x", explosionID );
317 }
318 AssertFatal(!(explosion && ((explosionID < DataBlockObjectIdFirst) || (explosionID > DataBlockObjectIdLast))),
319 "ShapeBaseData::preload: invalid explosion data");
320 }
321
322 if( !underwaterExplosion && underwaterExplosionID != 0 )
323 {
324 if( Sim::findObject( underwaterExplosionID, underwaterExplosion ) == false)
325 {
326 Con::errorf( ConsoleLogEntry::General, "ShapeBaseData::preload: Invalid packet, bad datablockId(underwaterExplosion): 0x%x", underwaterExplosionID );
327 }
328 AssertFatal(!(underwaterExplosion && ((underwaterExplosionID < DataBlockObjectIdFirst) || (underwaterExplosionID > DataBlockObjectIdLast))),
329 "ShapeBaseData::preload: invalid underwaterExplosion data");
330 }
331
332 if( !debris && debrisID != 0 )
333 {
334 Sim::findObject( debrisID, debris );
335 AssertFatal(!(debris && ((debrisID < DataBlockObjectIdFirst) || (debrisID > DataBlockObjectIdLast))),
336 "ShapeBaseData::preload: invalid debris data");
337 }
338
339 if( bool(mDebrisShape))
340 {
341 TSShapeInstance* pDummy = new TSShapeInstance(mDebrisShape, !server);
342 delete pDummy;
343 }
344 }
345
346 S32 i;
347 if (ShapeAsset::getAssetErrCode(mShapeAsset) != ShapeAsset::Failed && ShapeAsset::getAssetErrCode(mShapeAsset) != ShapeAsset::BadFileReference)
348 {
349 if (!server && !mShape->preloadMaterialList(mShape.getPath()) && NetConnection::filesWereDownloaded())
350 shapeError = true;
351
352 if(computeCRC)
353 {
354 Con::printf("Validation required for shape asset: %s", mShapeAsset.getAssetId());
355
356 Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShapeAsset->getShapePath());
357
358 if (!fileRef)
359 {
360 errorStr = String::ToString("ShapeBaseData: Couldn't load shape asset \"%s\"", mShapeAsset.getAssetId());

Callers

nothing calls this directly

Calls 15

printfFunction · 0.85
GetFileNodeFunction · 0.85
dSprintfFunction · 0.85
dStrtokFunction · 0.85
preloadMaterialListMethod · 0.80
incrementMethod · 0.80
getAcceleratorMethod · 0.80
findObjectFunction · 0.50
errorfFunction · 0.50
warnfFunction · 0.50
dFreeFunction · 0.50
dStrchrFunction · 0.50

Tested by

no test coverage detected