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

Method parseTargetString

Engine/source/ts/collada/colladaUtils.cpp:248–276  ·  view source on GitHub ↗

Determine which elements are being targeted

Source from the content-addressed store, hash-verified

246
247/// Determine which elements are being targeted
248void AnimData::parseTargetString(const char* target, S32 fullCount, const char* elements[])
249{
250 // Assume targeting all elements at offset 0
251 targetValueCount = fullCount;
252 targetValueOffset = 0;
253
254 // Check for array syntax: (n) or (n)(m)
255 if (const char* p = dStrchr(target, '(')) {
256 S32 indN, indM;
257 if (dSscanf(p, "(%d)(%d)", &indN, &indM) == 2) {
258 targetValueOffset = (indN * 4) + indM; // @todo: 4x4 matrix only
259 targetValueCount = 1;
260 }
261 else if (dSscanf(p, "(%d)", &indN) == 1) {
262 targetValueOffset = indN;
263 targetValueCount = 1;
264 }
265 }
266 else if (const char* p = dStrrchr(target, '.')) {
267 // Check for named elements
268 for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) {
269 if (!dStrcmp(p, elements[iElem])) {
270 targetValueOffset = iElem;
271 targetValueCount = 1;
272 break;
273 }
274 }
275 }
276}
277
278/// Solve the cubic spline B(s) = param for s
279F32 AnimData::invertParamCubic(F32 param, F32 x0, F32 x1, F32 x2, F32 x3) const

Callers 1

processAnimationMethod · 0.80

Calls 4

dSscanfFunction · 0.85
dStrchrFunction · 0.50
dStrrchrFunction · 0.50
dStrcmpFunction · 0.50

Tested by

no test coverage detected