| 1322 | } |
| 1323 | |
| 1324 | void afxConstraintMgr::adjustProcessOrdering(afxChoreographer* ch) |
| 1325 | { |
| 1326 | Vector<ProcessObject*> cons_sources; |
| 1327 | |
| 1328 | // add choreographer to the list |
| 1329 | cons_sources.push_back(ch); |
| 1330 | |
| 1331 | // collect all the ProcessObject related constraint sources |
| 1332 | for (S32 i = 0; i < mConstraints_v.size(); i++) |
| 1333 | { |
| 1334 | afxConstraintList* list = mConstraints_v[i]; |
| 1335 | afxConstraint* cons = (*list)[0]; |
| 1336 | if (cons) |
| 1337 | { |
| 1338 | ProcessObject* pobj = dynamic_cast<ProcessObject*>(cons->getSceneObject()); |
| 1339 | if (pobj) |
| 1340 | cons_sources.push_back(pobj); |
| 1341 | } |
| 1342 | } |
| 1343 | |
| 1344 | ProcessList* proc_list; |
| 1345 | if (ch->isServerObject()) |
| 1346 | proc_list = ServerProcessList::get(); |
| 1347 | else |
| 1348 | proc_list = ClientProcessList::get(); |
| 1349 | if (!proc_list) |
| 1350 | return; |
| 1351 | |
| 1352 | GameBase* nearest_to_end = dynamic_cast<GameBase*>(proc_list->findNearestToEnd(cons_sources)); |
| 1353 | GameBase* chor = (GameBase*) ch; |
| 1354 | |
| 1355 | // choreographer needs to be processed after the latest process object |
| 1356 | if (chor != nearest_to_end && nearest_to_end != 0) |
| 1357 | { |
| 1358 | //Con::printf("Choreographer processing BEFORE some of its constraints... fixing. [%s] -- %s", |
| 1359 | // (ch->isServerObject()) ? "S" : "C", nearest_to_end->getClassName()); |
| 1360 | if (chor->isProperlyAdded()) |
| 1361 | ch->processAfter(nearest_to_end); |
| 1362 | else |
| 1363 | ch->postProcessAfterObject(nearest_to_end); |
| 1364 | } |
| 1365 | else |
| 1366 | { |
| 1367 | //Con::printf("Choreographer processing AFTER its constraints... fine. [%s]", |
| 1368 | // (ch->isServerObject()) ? "S" : "C"); |
| 1369 | } |
| 1370 | } |
| 1371 | |
| 1372 | //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// |
| 1373 | // afxPointConstraint |
no test coverage detected