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

Method preload

Engine/source/T3D/shapeImage.cpp:404–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402}
403
404bool ShapeBaseImageData::preload(bool server, String &errorStr)
405{
406 if (!Parent::preload(server, errorStr))
407 return false;
408
409 // Resolve objects transmitted from server
410 if (!server) {
411 if (projectile)
412 if (Sim::findObject(SimObjectId((uintptr_t)projectile), projectile) == false)
413 Con::errorf(ConsoleLogEntry::General, "Error, unable to load projectile for shapebaseimagedata");
414
415 for (U32 i = 0; i < MaxStates; i++) {
416 if (state[i].emitter)
417 if (!Sim::findObject(SimObjectId((uintptr_t)state[i].emitter), state[i].emitter))
418 Con::errorf(ConsoleLogEntry::General, "Error, unable to load emitter for image datablock");
419
420 String str;
421 if( !sfxResolve( &state[ i ].sound, str ) )
422 Con::errorf( ConsoleLogEntry::General, str.c_str() );
423 }
424 }
425
426 // Use the first person eye offset if it's set.
427 useEyeOffset = !eyeOffset.isIdentity();
428
429 // Go through each of the shapes
430 for (U32 i=0; i<MaxShapes; ++i)
431 {
432 // Shape 0: Standard image shape
433 // Shape 1: Optional first person image shape
434
435 StringTableEntry name;
436 if (i == FirstPersonImageShape)
437 {
438 if ((useEyeOffset || useEyeNode) && shapeNameFP && shapeNameFP[0])
439 {
440 // Make use of the first person shape
441 useFirstPersonShape = true;
442 name = shapeNameFP;
443 }
444 else
445 {
446 // Skip the first person shape
447 continue;
448 }
449 }
450 else
451 {
452 name = shapeName;
453 }
454
455 if (name && name[0]) {
456 // Resolve shapename
457 shape[i] = ResourceManager::get().load(name);
458 if (!bool(shape[i])) {
459 errorStr = String::ToString("Unable to load shape: %s", name);
460 return false;
461 }

Callers

nothing calls this directly

Calls 15

errorfFunction · 0.85
sfxResolveFunction · 0.85
printfFunction · 0.85
GetFileNodeFunction · 0.85
dStrncpyFunction · 0.85
dStrcatFunction · 0.85
getQuatFMethod · 0.80
findObjectFunction · 0.50
getFunction · 0.50
c_strMethod · 0.45
isIdentityMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected