AINavigation.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "AINavigation.h"
  23. #include "AIController.h"
  24. #include "T3D/shapeBase.h"
  25. static U32 sAILoSMask = TerrainObjectType | StaticShapeObjectType | StaticObjectType;
  26. AINavigation::AINavigation(AIController* controller)
  27. {
  28. mControllerRef = controller;
  29. #ifdef TORQUE_NAVIGATION_ENABLED
  30. mJump = None;
  31. mNavSize = Regular;
  32. #endif
  33. }
  34. AINavigation::~AINavigation()
  35. {
  36. #ifdef TORQUE_NAVIGATION_ENABLED
  37. clearPath();
  38. clearFollow();
  39. #endif
  40. }
  41. void AINavigation::setMoveDestination(const Point3F& location, bool slowdown)
  42. {
  43. mMoveDestination = location;
  44. getCtrl()->mMovement.mMoveState = AIController::ModeMove;
  45. getCtrl()->mMovement.mMoveSlowdown = slowdown;
  46. getCtrl()->mMovement.mMoveStuckTestCountdown = getCtrl()->mControllerData->mMoveStuckTestDelay;
  47. }
  48. bool AINavigation::setPathDestination(const Point3F& pos, bool replace)
  49. {
  50. #ifdef TORQUE_NAVIGATION_ENABLED
  51. if (replace)
  52. getCtrl()->setGoal(pos, getCtrl()->mControllerData->mMoveTolerance);
  53. if (!mNavMesh)
  54. updateNavMesh();
  55. // If we can't find a mesh, just move regularly.
  56. if (!mNavMesh)
  57. {
  58. //setMoveDestination(pos);
  59. getCtrl()->throwCallback("onPathFailed");
  60. return false;
  61. }
  62. // Create a new path.
  63. NavPath* path = new NavPath();
  64. path->mMesh = mNavMesh;
  65. path->mFrom = getCtrl()->getAIInfo()->getPosition(true);
  66. path->mTo = getCtrl()->getGoal()->getPosition(true);
  67. path->mFromSet = path->mToSet = true;
  68. path->mAlwaysRender = true;
  69. path->mLinkTypes = getCtrl()->mControllerData->mLinkTypes;
  70. path->mXray = true;
  71. path->mFilter = getCtrl()->mControllerData->mFilter;
  72. // Paths plan automatically upon being registered.
  73. if (!path->registerObject())
  74. {
  75. delete path;
  76. return false;
  77. }
  78. if (path->success())
  79. {
  80. // Clear any current path we might have.
  81. clearPath();
  82. getCtrl()->clearCover();
  83. // Store new path.
  84. mPathData.path = path;
  85. mPathData.owned = true;
  86. // Skip node 0, which we are currently standing on.
  87. moveToNode(1);
  88. getCtrl()->throwCallback("onPathSuccess");
  89. return true;
  90. }
  91. else
  92. {
  93. // Just move normally if we can't path.
  94. //setMoveDestination(pos, true);
  95. //return;
  96. getCtrl()->throwCallback("onPathFailed");
  97. path->deleteObject();
  98. return false;
  99. }
  100. #else
  101. setMoveDestination(pos, false);
  102. return true;
  103. #endif
  104. }
  105. Point3F AINavigation::getPathDestination() const
  106. {
  107. #ifdef TORQUE_NAVIGATION_ENABLED
  108. if (!mPathData.path.isNull())
  109. return mPathData.path->mTo;
  110. return Point3F(0, 0, 0);
  111. #else
  112. return getMoveDestination();
  113. #endif
  114. }
  115. void AINavigation::onReachDestination()
  116. {
  117. #ifdef TORQUE_NAVIGATION_ENABLED
  118. if (!getPath().isNull())
  119. {
  120. if (mPathData.index == getPath()->size() - 1)
  121. {
  122. // Handle looping paths.
  123. if (getPath()->mIsLooping)
  124. moveToNode(0);
  125. // Otherwise end path.
  126. else
  127. {
  128. clearPath();
  129. getCtrl()->throwCallback("onReachDestination");
  130. }
  131. }
  132. else
  133. {
  134. moveToNode(mPathData.index + 1);
  135. // Throw callback every time if we're on a looping path.
  136. //if(mPathData.path->mIsLooping)
  137. //throwCallback("onReachDestination");
  138. }
  139. }
  140. else
  141. #endif
  142. {
  143. getCtrl()->throwCallback("onReachDestination");
  144. getCtrl()->mMovement.mMoveState = AIController::ModeStop;
  145. }
  146. }
  147. void AINavigation::followObject()
  148. {
  149. if (getCtrl()->getGoal()->getDist() < getCtrl()->mControllerData->mMoveTolerance)
  150. return;
  151. if (setPathDestination(getCtrl()->getGoal()->getPosition(true)))
  152. {
  153. #ifdef TORQUE_NAVIGATION_ENABLED
  154. getCtrl()->clearCover();
  155. #endif
  156. }
  157. }
  158. void AINavigation::followObject(SceneObject* obj, F32 radius)
  159. {
  160. getCtrl()->setGoal(obj, radius);
  161. followObject();
  162. }
  163. void AINavigation::clearFollow()
  164. {
  165. getCtrl()->clearGoal();
  166. }
  167. DefineEngineMethod(AIController, setMoveDestination, void, (Point3F goal, bool slowDown), (true),
  168. "@brief Tells the AI to move to the location provided\n\n"
  169. "@param goal Coordinates in world space representing location to move to.\n"
  170. "@param slowDown A boolean value. If set to true, the bot will slow down "
  171. "when it gets within 5-meters of its move destination. If false, the bot "
  172. "will stop abruptly when it reaches the move destination. By default, this is true.\n\n"
  173. "@note Upon reaching a move destination, the bot will clear its move destination and "
  174. "calls to getMoveDestination will return \"0 0 0\"."
  175. "@see getMoveDestination()\n")
  176. {
  177. object->getNav()->setMoveDestination(goal, slowDown);
  178. }
  179. DefineEngineMethod(AIController, getMoveDestination, Point3F, (), ,
  180. "@brief Get the AIPlayer's current destination.\n\n"
  181. "@return Returns a point containing the \"x y z\" position "
  182. "of the AIPlayer's current move destination. If no move destination "
  183. "has yet been set, this returns \"0 0 0\"."
  184. "@see setMoveDestination()\n")
  185. {
  186. return object->getNav()->getMoveDestination();
  187. }
  188. DefineEngineMethod(AIController, setPathDestination, bool, (Point3F goal), ,
  189. "@brief Tells the AI to find a path to the location provided\n\n"
  190. "@param goal Coordinates in world space representing location to move to.\n"
  191. "@return True if a path was found.\n\n"
  192. "@see getPathDestination()\n"
  193. "@see setMoveDestination()\n")
  194. {
  195. return object->getNav()->setPathDestination(goal, true);
  196. }
  197. DefineEngineMethod(AIController, getPathDestination, Point3F, (), ,
  198. "@brief Get the AIPlayer's current pathfinding destination.\n\n"
  199. "@return Returns a point containing the \"x y z\" position "
  200. "of the AIPlayer's current path destination. If no path destination "
  201. "has yet been set, this returns \"0 0 0\"."
  202. "@see setPathDestination()\n")
  203. {
  204. return object->getNav()->getPathDestination();
  205. }
  206. DefineEngineMethod(AIController, followObject, void, (SimObjectId obj, F32 radius), ,
  207. "@brief Tell the AIPlayer to follow another object.\n\n"
  208. "@param obj ID of the object to follow.\n"
  209. "@param radius Maximum distance we let the target escape to.")
  210. {
  211. SceneObject* follow;
  212. #ifdef TORQUE_NAVIGATION_ENABLED
  213. object->getNav()->clearPath();
  214. object->clearCover();
  215. #endif
  216. object->getNav()->clearFollow();
  217. if (Sim::findObject(obj, follow))
  218. object->getNav()->followObject(follow, radius);
  219. }
  220. #ifdef TORQUE_NAVIGATION_ENABLED
  221. NavMesh* AINavigation::findNavMesh() const
  222. {
  223. GameBase* gbo = dynamic_cast<GameBase*>(mControllerRef->getAIInfo()->mObj.getPointer());
  224. // Search for NavMeshes that contain us entirely with the smallest possible
  225. // volume.
  226. NavMesh* mesh = NULL;
  227. SimSet* set = NavMesh::getServerSet();
  228. for (U32 i = 0; i < set->size(); i++)
  229. {
  230. NavMesh* m = static_cast<NavMesh*>(set->at(i));
  231. if (m->getWorldBox().isContained(gbo->getWorldBox()))
  232. {
  233. // Check that mesh size is appropriate.
  234. if (gbo->isMounted())
  235. {
  236. if (!m->mVehicles)
  237. continue;
  238. }
  239. else
  240. {
  241. if ((getNavSize() == Small && !m->mSmallCharacters) ||
  242. (getNavSize() == Regular && !m->mRegularCharacters) ||
  243. (getNavSize() == Large && !m->mLargeCharacters))
  244. continue;
  245. }
  246. if (!mesh || m->getWorldBox().getVolume() < mesh->getWorldBox().getVolume())
  247. mesh = m;
  248. }
  249. }
  250. return mesh;
  251. }
  252. void AINavigation::updateNavMesh()
  253. {
  254. GameBase* gbo = dynamic_cast<GameBase*>(mControllerRef->getAIInfo()->mObj.getPointer());
  255. NavMesh* old = mNavMesh;
  256. if (mNavMesh.isNull())
  257. mNavMesh = findNavMesh();
  258. else
  259. {
  260. if (!mNavMesh->getWorldBox().isContained(gbo->getWorldBox()))
  261. mNavMesh = findNavMesh();
  262. }
  263. // See if we need to update our path.
  264. if (mNavMesh != old && !mPathData.path.isNull())
  265. {
  266. setPathDestination(mPathData.path->mTo);
  267. }
  268. }
  269. void AINavigation::moveToNode(S32 node)
  270. {
  271. if (mPathData.path.isNull())
  272. return;
  273. // -1 is shorthand for 'last path node'.
  274. if (node == -1)
  275. node = mPathData.path->size() - 1;
  276. // Consider slowing down on the last path node.
  277. setMoveDestination(mPathData.path->getNode(node), false);
  278. // Check flags for this segment.
  279. if (mPathData.index)
  280. {
  281. U16 flags = mPathData.path->getFlags(node - 1);
  282. // Jump if we must.
  283. if (flags & LedgeFlag)
  284. mJump = Ledge;
  285. else if (flags & JumpFlag)
  286. mJump = Now;
  287. else
  288. // Catch pathing errors.
  289. mJump = None;
  290. }
  291. // Store current index.
  292. mPathData.index = node;
  293. }
  294. void AINavigation::repath()
  295. {
  296. // Ineffectual if we don't have a path, or are using someone else's.
  297. if (mPathData.path.isNull() || !mPathData.owned)
  298. return;
  299. if (avoidObstacles())
  300. {
  301. mPathData.path->mTo = mMoveDestination;
  302. }
  303. else if (mRandI(0, 100) < getCtrl()->mControllerData->mFlocking.mChance && flock())
  304. {
  305. mPathData.path->mTo = mMoveDestination;
  306. }
  307. else
  308. {
  309. // If we're following, get their position.
  310. mPathData.path->mTo = getCtrl()->getGoal()->getPosition(true);
  311. }
  312. // Update from position and replan.
  313. mPathData.path->mFrom = getCtrl()->getAIInfo()->getPosition(true);
  314. mPathData.path->plan();
  315. // Move to first node (skip start pos).
  316. moveToNode(1);
  317. }
  318. void AINavigation::followNavPath(NavPath* path)
  319. {
  320. // Get rid of our current path.
  321. clearPath();
  322. getCtrl()->clearCover();
  323. // Follow new path.
  324. mPathData.path = path;
  325. mPathData.owned = false;
  326. // Start from 0 since we might not already be there.
  327. moveToNode(0);
  328. }
  329. void AINavigation::clearPath()
  330. {
  331. // Only delete if we own the path.
  332. if (!mPathData.path.isNull() && mPathData.owned)
  333. mPathData.path->deleteObject();
  334. // Reset path data.
  335. mPathData = PathData();
  336. }
  337. bool AINavigation::avoidObstacles()
  338. {
  339. SimObjectPtr<SceneObject> obj = getCtrl()->getAIInfo()->mObj;
  340. obj->disableCollision();
  341. Point3F pos = obj->getBoxCenter();
  342. VectorF forward = obj->getTransform().getForwardVector();
  343. forward.normalizeSafe();
  344. // Generate forward-left and forward-right by rotating forward vector
  345. VectorF right = mCross(forward, Point3F(0, 0, 1));
  346. VectorF leftDir = forward + right * -0.5f; // front-left
  347. VectorF rightDir = forward + right * 0.5f; // front-right
  348. leftDir.normalizeSafe();
  349. rightDir.normalizeSafe();
  350. F32 rayLength = obj->getVelocity().lenSquared() * TickSec * 2 + getCtrl()->getAIInfo()->mRadius;
  351. Point3F directions[3] = {
  352. forward,
  353. leftDir,
  354. rightDir
  355. };
  356. bool hit[3] = { false, false, false };
  357. RayInfo info;
  358. for (int i = 0; i < 3; ++i)
  359. {
  360. Point3F end = pos + directions[i] * rayLength;
  361. if (obj->getContainer()->castRay(pos, end, sAILoSMask, &info))
  362. {
  363. hit[i] = true;
  364. }
  365. }
  366. Point3F avoidance = Point3F::Zero;
  367. if (hit[0]) avoidance += right * 1.0f;
  368. if (hit[1]) avoidance += right * 1.5f;
  369. if (hit[2]) avoidance -= right * 1.5f;
  370. if (!avoidance.isZero())
  371. {
  372. avoidance.normalizeSafe();
  373. F32 clearance = getCtrl()->getAIInfo()->mRadius * 1.5f;
  374. Point3F newDest = info.point + avoidance * rayLength;
  375. mMoveDestination = newDest;
  376. obj->enableCollision();
  377. return true;
  378. }
  379. obj->enableCollision();
  380. return false;
  381. }
  382. bool AINavigation::flock()
  383. {
  384. AIControllerData::Flocking flockingData = getCtrl()->mControllerData->mFlocking;
  385. SimObjectPtr<SceneObject> obj = getCtrl()->getAIInfo()->mObj;
  386. obj->disableCollision();
  387. Point3F pos = obj->getBoxCenter();
  388. F32 maxFlocksq = flockingData.mMax * flockingData.mMax;
  389. Point3F searchArea = Point3F(maxFlocksq, maxFlocksq, getCtrl()->getAIInfo()->mObj->getObjBox().maxExtents.z / 2);
  390. bool flocking = false;
  391. U32 found = 0;
  392. if (getCtrl()->getGoal())
  393. {
  394. Point3F dest = mMoveDestination;
  395. if (getCtrl()->mMovement.mMoveState == AIController::ModeStuck)
  396. {
  397. Point3F shuffle = Point3F(mRandF() - 0.5, mRandF() - 0.5, 0);
  398. shuffle.normalize();
  399. dest += shuffle * flockingData.mMin;
  400. }
  401. dest.z = pos.z;
  402. if ((pos - dest).len() > flockingData.mSideStep)
  403. {
  404. //find closest object
  405. SimpleQueryList sql;
  406. Box3F queryBox = Box3F(pos - searchArea, pos + searchArea);
  407. obj->getContainer()->findObjects(queryBox, AIObjectType, SimpleQueryList::insertionCallback, &sql);
  408. sql.mList.remove(obj);
  409. Point3F avoidanceOffset = Point3F::Zero;
  410. F32 avoidanceAmtSq = 0;
  411. RayInfo info;
  412. //avoid bots that are too close
  413. for (U32 i = 0; i < sql.mList.size(); i++)
  414. {
  415. ShapeBase* other = dynamic_cast<ShapeBase*>(sql.mList[i]);
  416. Point3F objectCenter = other->getBoxCenter();
  417. F32 sumMinRad = flockingData.mMin + other->getAIController()->mControllerData->mFlocking.mMin;
  418. F32 separation = getCtrl()->getAIInfo()->mRadius + other->getAIController()->getAIInfo()->mRadius;
  419. separation += sumMinRad;
  420. Point3F offset = (pos - objectCenter);
  421. F32 offsetLensq = offset.lenSquared(); //square roots are expensive, so use squared val compares
  422. if ((flockingData.mMin > 0) && (offsetLensq < (sumMinRad * sumMinRad)))
  423. {
  424. other->disableCollision();
  425. if (!obj->getContainer()->castRay(pos, other->getBoxCenter(), sAILoSMask | AIObjectType, &info))
  426. {
  427. found++;
  428. offset *= separation;
  429. avoidanceOffset += offset; //accumulate total group, move away from that
  430. avoidanceAmtSq += offsetLensq;
  431. }
  432. other->enableCollision();
  433. }
  434. }
  435. //if we don't have to worry about bumping into one another (nothing found lower than minFLock), see about grouping up
  436. if (found == 0)
  437. {
  438. for (U32 i = 0; i < sql.mList.size(); i++)
  439. {
  440. ShapeBase* other = static_cast<ShapeBase*>(sql.mList[i]);
  441. Point3F objectCenter = other->getBoxCenter();
  442. F32 sumMaxRad = flockingData.mMax + other->getAIController()->mControllerData->mFlocking.mMax;
  443. F32 separation = getCtrl()->getAIInfo()->mRadius + other->getAIController()->getAIInfo()->mRadius;
  444. separation += sumMaxRad;
  445. Point3F offset = (pos - objectCenter);
  446. F32 offsetLensq = offset.lenSquared(); //square roots are expensive, so use squared val compares
  447. if ((flockingData.mMax > 0) && (offsetLensq < (sumMaxRad * sumMaxRad)))
  448. {
  449. other->disableCollision();
  450. if (!obj->getContainer()->castRay(pos, other->getBoxCenter(), sAILoSMask | AIObjectType, &info))
  451. {
  452. found++;
  453. avoidanceOffset -= offset; // subtract total group, move toward it
  454. avoidanceAmtSq -= offsetLensq;
  455. }
  456. other->enableCollision();
  457. }
  458. }
  459. }
  460. if (found > 0)
  461. {
  462. //ephasize the *side* portion of sidestep to better avoid clumps
  463. if (avoidanceOffset.x < avoidanceOffset.y)
  464. avoidanceOffset.x *= 2.0;
  465. else
  466. avoidanceOffset.y *= 2.0;
  467. //add fuzz to sidestepping
  468. avoidanceOffset.z = 0;
  469. avoidanceOffset.x = (mRandF() * avoidanceOffset.x) * 0.5 + avoidanceOffset.x * 0.75;
  470. avoidanceOffset.y = (mRandF() * avoidanceOffset.y) * 0.5 + avoidanceOffset.y * 0.75;
  471. avoidanceOffset.normalizeSafe();
  472. avoidanceOffset *= avoidanceAmtSq;
  473. if ((avoidanceAmtSq) > flockingData.mMin * flockingData.mMin)
  474. {
  475. dest = obj->getPosition()+avoidanceOffset;
  476. }
  477. //if we're not jumping...
  478. if (mJump == None)
  479. {
  480. dest.z = obj->getPosition().z;
  481. //make sure we don't run off a cliff
  482. Point3F zlen(0, 0, getCtrl()->mControllerData->mHeightTolerance);
  483. if (obj->getContainer()->castRay(dest + zlen, dest - zlen, TerrainObjectType | StaticShapeObjectType | StaticObjectType, &info))
  484. {
  485. mMoveDestination = dest;
  486. flocking = true;
  487. }
  488. }
  489. }
  490. }
  491. }
  492. obj->enableCollision();
  493. return flocking;
  494. }
  495. DefineEngineMethod(AIController, followNavPath, void, (SimObjectId obj), ,
  496. "@brief Tell the AIPlayer to follow a path.\n\n"
  497. "@param obj ID of a NavPath object for the character to follow.")
  498. {
  499. NavPath* path;
  500. if (Sim::findObject(obj, path))
  501. object->getNav()->followNavPath(path);
  502. }
  503. DefineEngineMethod(AIController, repath, void, (), ,
  504. "@brief Tells the AI to re-plan its path. Does nothing if the character "
  505. "has no path, or if it is following a mission path.\n\n")
  506. {
  507. object->getNav()->repath();
  508. }
  509. DefineEngineMethod(AIController, findNavMesh, S32, (), ,
  510. "@brief Get the NavMesh object this AIPlayer is currently using.\n\n"
  511. "@return The ID of the NavPath object this character is using for "
  512. "pathfinding. This is determined by the character's location, "
  513. "navigation type and other factors. Returns -1 if no NavMesh is "
  514. "found.")
  515. {
  516. NavMesh* mesh = object->getNav()->getNavMesh();
  517. return mesh ? mesh->getId() : -1;
  518. }
  519. DefineEngineMethod(AIController, getNavMesh, S32, (), ,
  520. "@brief Return the NavMesh this AIPlayer is using to navigate.\n\n")
  521. {
  522. NavMesh* m = object->getNav()->getNavMesh();
  523. return m ? m->getId() : 0;
  524. }
  525. DefineEngineMethod(AIController, setNavSize, void, (const char* size), ,
  526. "@brief Set the size of NavMesh this character uses. One of \"Small\", \"Regular\" or \"Large\".")
  527. {
  528. if (!String::compare(size, "Small"))
  529. object->getNav()->setNavSize(AINavigation::Small);
  530. else if (!String::compare(size, "Regular"))
  531. object->getNav()->setNavSize(AINavigation::Regular);
  532. else if (!String::compare(size, "Large"))
  533. object->getNav()->setNavSize(AINavigation::Large);
  534. else
  535. Con::errorf("AIPlayer::setNavSize: no such size '%s'.", size);
  536. }
  537. DefineEngineMethod(AIController, getNavSize, const char*, (), ,
  538. "@brief Return the size of NavMesh this character uses for pathfinding.")
  539. {
  540. switch (object->getNav()->getNavSize())
  541. {
  542. case AINavigation::Small:
  543. return "Small";
  544. case AINavigation::Regular:
  545. return "Regular";
  546. case AINavigation::Large:
  547. return "Large";
  548. }
  549. return "";
  550. }
  551. #endif