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

Method preload

Engine/source/T3D/shapeImage.cpp:409–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409bool ShapeBaseImageData::preload(bool server, String &errorStr)
410{
411 if (!Parent::preload(server, errorStr))
412 return false;
413
414 // Resolve objects transmitted from server
415 if (!server) {
416 if (projectile)
417 if (Sim::findObject(SimObjectId((uintptr_t)projectile), projectile) == false)
418 Con::errorf(ConsoleLogEntry::General, "Error, unable to load projectile for shapebaseimagedata");
419
420 for (U32 i = 0; i < MaxStates; i++) {
421 if (state[i].emitter)
422 if (!Sim::findObject(SimObjectId((uintptr_t)state[i].emitter), state[i].emitter))
423 Con::errorf(ConsoleLogEntry::General, "Error, unable to load emitter for image datablock");
424
425 if (getstateSound(i) != StringTable->EmptyString())
426 {
427 _setstateSound(getstateSound(i), i);
428 if (!getstateSoundProfile(i))
429 Con::errorf("ShapeBaseImageData::preload() - Could not find profile for asset %s on state %d", getstateSound(i), i);
430 }
431
432 }
433 }
434
435 // Use the first person eye offset if it's set.
436 useEyeOffset = !eyeOffset.isIdentity();
437
438 // Go through each of the shapes
439 for (U32 i=0; i<MaxShapes; ++i)
440 {
441 // Shape 0: Standard image shape
442 // Shape 1: Optional first person image shape
443
444 if (i == FirstPersonImageShape)
445 {
446 if ((useEyeOffset || useEyeNode) && !mShapeAsset[i].isNull())
447 {
448 // Make use of the first person shape
449 useFirstPersonShape = true;
450 }
451 else
452 {
453 // Skip the first person shape
454 continue;
455 }
456 }
457
458 if (!mShapeAsset[i].isNull())
459 {
460 // Resolve shapename
461 mShape[i] = mShapeAsset[i]->getShapeResource();
462
463 if (!bool(mShape[i])) {
464 errorStr = String::ToString("Unable to load shape asset: %s", mShapeAsset[i]->getAssetId());
465 return false;
466 }

Callers

nothing calls this directly

Calls 15

printfFunction · 0.85
GetFileNodeFunction · 0.85
setMatrixFunction · 0.85
dStrncpyFunction · 0.85
dStrcatFunction · 0.85
EmptyStringMethod · 0.80
getShapeResourceMethod · 0.80
getQuatFMethod · 0.80
findObjectFunction · 0.50
errorfFunction · 0.50
isIdentityMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected