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

Method importSequences

Engine/source/ts/tsShapeOldRead.cpp:430–726  ·  view source on GitHub ↗

------------------------------------------------- import sequences into existing shape -------------------------------------------------

Source from the content-addressed store, hash-verified

428// import sequences into existing shape
429//-------------------------------------------------
430bool TSShape::importSequences(Stream * s, const String& sequencePath)
431{
432 // write version
433 s->read(&smReadVersion);
434 if (smReadVersion>smVersion)
435 {
436 // error -- don't support future version yet :>
437 Con::errorf(ConsoleLogEntry::General,
438 "Sequence import failed: shape exporter newer than running executable.");
439 return false;
440 }
441 if (smReadVersion<19)
442 {
443 // error -- don't support future version yet :>
444 Con::errorf(ConsoleLogEntry::General,
445 "Sequence import failed: deprecated version (%i).",smReadVersion);
446 return false;
447 }
448
449 Vector<S32> nodeMap; // node index of each node from imported sequences
450 Vector<S32> objectMap; // object index of objects from imported sequences
451 VECTOR_SET_ASSOCIATION(nodeMap);
452 VECTOR_SET_ASSOCIATION(objectMap);
453
454 S32 i,sz;
455
456 // read node names
457 // -- this is how we will map imported sequence nodes to our nodes
458 s->read(&sz);
459 nodeMap.setSize(sz);
460
461 for (i=0;i<sz;i++)
462 {
463 U32 startSize = names.size();
464 S32 nameIndex = readName(s,true);
465
466 nodeMap[i] = findNode(nameIndex);
467
468 if (nodeMap[i] < 0)
469 {
470 // node found in sequence but not shape => remove the added node name
471 if (names.size() != startSize)
472 {
473 names.decrement();
474
475 if (names.size() != startSize)
476 Con::errorf(ConsoleLogEntry::General, "TSShape::importSequence: failed to remove unused node correctly for dsq %s.", names[nameIndex].c_str(), sequencePath.c_str());
477 }
478 }
479 }
480
481 // read the following size, but won't do anything with it...legacy: was going to support
482 // import of sequences that animate objects...we don't...
483 s->read(&sz);
484
485 // before reading keyframes, take note of a couple numbers
486 S32 oldShapeNumObjects;
487 s->read(&oldShapeNumObjects);

Callers

nothing calls this directly

Calls 15

dCopyArrayFunction · 0.85
decrementMethod · 0.80
incrementMethod · 0.80
errorfFunction · 0.50
initFunction · 0.50
readMethod · 0.45
setSizeMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45
lastMethod · 0.45
animatesUniformScaleMethod · 0.45
animatesAlignedScaleMethod · 0.45

Tested by

no test coverage detected