guiNavEditorCtrl.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2014 Daniel Buckmaster
  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 "torqueConfig.h"
  23. #ifdef TORQUE_TOOLS
  24. #include "platform/platform.h"
  25. #include "guiNavEditorCtrl.h"
  26. #include "duDebugDrawTorque.h"
  27. #include "console/engineAPI.h"
  28. #include "console/consoleTypes.h"
  29. #include "math/util/frustum.h"
  30. #include "math/mathUtils.h"
  31. #include "gfx/primBuilder.h"
  32. #include "gfx/gfxDrawUtil.h"
  33. #include "scene/sceneRenderState.h"
  34. #include "scene/sceneManager.h"
  35. #include "gui/core/guiCanvas.h"
  36. #include "gui/buttons/guiButtonCtrl.h"
  37. #include "gui/worldEditor/undoActions.h"
  38. #include "T3D/gameBase/gameConnection.h"
  39. #include "T3D/AI/AIController.h"
  40. IMPLEMENT_CONOBJECT(GuiNavEditorCtrl);
  41. ConsoleDocClass(GuiNavEditorCtrl,
  42. "@brief GUI tool that makes up the Navigation Editor\n\n"
  43. "Editor use only.\n\n"
  44. "@internal"
  45. );
  46. // Each of the mode names directly correlates with the Nav Editor's tool palette.
  47. const String GuiNavEditorCtrl::mSelectMode = "SelectMode";
  48. const String GuiNavEditorCtrl::mLinkMode = "LinkMode";
  49. const String GuiNavEditorCtrl::mCoverMode = "CoverMode";
  50. const String GuiNavEditorCtrl::mTileMode = "TileMode";
  51. const String GuiNavEditorCtrl::mTestMode = "TestMode";
  52. GuiNavEditorCtrl::GuiNavEditorCtrl()
  53. {
  54. mMode = mSelectMode;
  55. mIsDirty = false;
  56. mStartDragMousePoint = InvalidMousePoint;
  57. mMesh = NULL;
  58. mCurTile = mTile = -1;
  59. mPlayer = mCurPlayer = NULL;
  60. mSpawnClass = mSpawnDatablock = "";
  61. mLinkStart = Point3F::Max;
  62. mLink = mCurLink = -1;
  63. }
  64. GuiNavEditorCtrl::~GuiNavEditorCtrl()
  65. {
  66. }
  67. void GuiNavEditorUndoAction::undo()
  68. {
  69. }
  70. bool GuiNavEditorCtrl::onAdd()
  71. {
  72. if(!Parent::onAdd())
  73. return false;
  74. GFXStateBlockDesc desc;
  75. desc.fillMode = GFXFillSolid;
  76. desc.setBlend(false);
  77. desc.setZReadWrite(false, false);
  78. desc.setCullMode(GFXCullNone);
  79. mZDisableSB = GFX->createStateBlock(desc);
  80. desc.setZReadWrite(true, true);
  81. mZEnableSB = GFX->createStateBlock(desc);
  82. SceneManager::getPreRenderSignal().notify(this, &GuiNavEditorCtrl::_prepRenderImage);
  83. return true;
  84. }
  85. void GuiNavEditorCtrl::initPersistFields()
  86. {
  87. docsURL;
  88. addField("isDirty", TypeBool, Offset(mIsDirty, GuiNavEditorCtrl));
  89. addField("spawnClass", TypeRealString, Offset(mSpawnClass, GuiNavEditorCtrl),
  90. "Class of object to spawn in test mode.");
  91. addField("spawnDatablock", TypeRealString, Offset(mSpawnDatablock, GuiNavEditorCtrl),
  92. "Datablock to give new objects in test mode.");
  93. Parent::initPersistFields();
  94. }
  95. void GuiNavEditorCtrl::onSleep()
  96. {
  97. Parent::onSleep();
  98. //mMode = mSelectMode;
  99. }
  100. void GuiNavEditorCtrl::selectMesh(NavMesh *mesh)
  101. {
  102. mesh->setSelected(true);
  103. mMesh = mesh;
  104. }
  105. DefineEngineMethod(GuiNavEditorCtrl, selectMesh, void, (S32 id),,
  106. "@brief Select a NavMesh object.")
  107. {
  108. NavMesh *obj;
  109. if(Sim::findObject(id, obj))
  110. object->selectMesh(obj);
  111. }
  112. S32 GuiNavEditorCtrl::getMeshId()
  113. {
  114. return mMesh.isNull() ? 0 : mMesh->getId();
  115. }
  116. DefineEngineMethod(GuiNavEditorCtrl, getMesh, S32, (),,
  117. "@brief Select a NavMesh object.")
  118. {
  119. return object->getMeshId();
  120. }
  121. S32 GuiNavEditorCtrl::getPlayerId()
  122. {
  123. return mPlayer.isNull() ? 0 : mPlayer->getId();
  124. }
  125. DefineEngineMethod(GuiNavEditorCtrl, getPlayer, S32, (),,
  126. "@brief Select a NavMesh object.")
  127. {
  128. return object->getPlayerId();
  129. }
  130. void GuiNavEditorCtrl::deselect()
  131. {
  132. if(!mMesh.isNull())
  133. mMesh->setSelected(false);
  134. mMesh = NULL;
  135. mPlayer = mCurPlayer = NULL;
  136. mCurTile = mTile = -1;
  137. mLinkStart = Point3F::Max;
  138. mLink = mCurLink = -1;
  139. }
  140. DefineEngineMethod(GuiNavEditorCtrl, deselect, void, (),,
  141. "@brief Deselect whatever is currently selected in the editor.")
  142. {
  143. object->deselect();
  144. }
  145. void GuiNavEditorCtrl::deleteLink()
  146. {
  147. if(!mMesh.isNull() && mLink != -1)
  148. {
  149. mMesh->selectLink(mLink, false);
  150. mMesh->deleteLink(mLink);
  151. mLink = -1;
  152. Con::executef(this, "onLinkDeselected");
  153. }
  154. }
  155. DefineEngineMethod(GuiNavEditorCtrl, deleteLink, void, (),,
  156. "@brief Delete the currently selected link.")
  157. {
  158. object->deleteLink();
  159. }
  160. void GuiNavEditorCtrl::setLinkFlags(const LinkData &d)
  161. {
  162. if(mMode == mLinkMode && !mMesh.isNull() && mLink != -1)
  163. {
  164. mMesh->setLinkFlags(mLink, d);
  165. }
  166. }
  167. DefineEngineMethod(GuiNavEditorCtrl, setLinkFlags, void, (U32 flags),,
  168. "@Brief Set jump and drop properties of the selected link.")
  169. {
  170. object->setLinkFlags(LinkData(flags));
  171. }
  172. void GuiNavEditorCtrl::buildTile()
  173. {
  174. if(!mMesh.isNull() && mTile != -1)
  175. mMesh->buildTile(mTile);
  176. }
  177. DefineEngineMethod(GuiNavEditorCtrl, buildTile, void, (),,
  178. "@brief Build the currently selected tile.")
  179. {
  180. object->buildTile();
  181. }
  182. void GuiNavEditorCtrl::spawnPlayer(const Point3F &pos)
  183. {
  184. SceneObject *obj = (SceneObject*)Sim::spawnObject(mSpawnClass, mSpawnDatablock);
  185. if(obj)
  186. {
  187. MatrixF mat(true);
  188. mat.setPosition(pos);
  189. obj->setTransform(mat);
  190. SimObject* cleanup = Sim::findObject("MissionCleanup");
  191. if(cleanup)
  192. {
  193. SimGroup* missionCleanup = dynamic_cast<SimGroup*>(cleanup);
  194. missionCleanup->addObject(obj);
  195. }
  196. mPlayer = obj;
  197. AIPlayer* asAIPlayer = dynamic_cast<AIPlayer*>(obj);
  198. if (asAIPlayer) //try direct
  199. {
  200. Con::executef(this, "onPlayerSelected", Con::getIntArg(asAIPlayer->mLinkTypes.getFlags()));
  201. }
  202. else
  203. {
  204. ShapeBase* sbo = dynamic_cast<ShapeBase*>(obj);
  205. if (sbo->getAIController())
  206. {
  207. if (sbo->getAIController()->mControllerData)
  208. Con::executef(this, "onPlayerSelected", Con::getIntArg(sbo->getAIController()->mControllerData->mLinkTypes.getFlags()));
  209. }
  210. else
  211. {
  212. Con::executef(this, "onPlayerSelected");
  213. }
  214. }
  215. }
  216. }
  217. DefineEngineMethod(GuiNavEditorCtrl, spawnPlayer, void, (),,
  218. "@brief Spawn an AIPlayer at the centre of the screen.")
  219. {
  220. Point3F c;
  221. if(object->get3DCentre(c))
  222. object->spawnPlayer(c);
  223. }
  224. void GuiNavEditorCtrl::get3DCursor(GuiCursor *&cursor,
  225. bool &visible,
  226. const Gui3DMouseEvent &event_)
  227. {
  228. //cursor = mAddNodeCursor;
  229. //visible = false;
  230. cursor = NULL;
  231. visible = false;
  232. GuiCanvas *root = getRoot();
  233. if(!root)
  234. return;
  235. S32 currCursor = PlatformCursorController::curArrow;
  236. if(root->mCursorChanged == currCursor)
  237. return;
  238. PlatformWindow *window = root->getPlatformWindow();
  239. PlatformCursorController *controller = window->getCursorController();
  240. // We've already changed the cursor,
  241. // so set it back before we change it again.
  242. if(root->mCursorChanged != -1)
  243. controller->popCursor();
  244. // Now change the cursor shape
  245. controller->pushCursor(currCursor);
  246. root->mCursorChanged = currCursor;
  247. }
  248. bool GuiNavEditorCtrl::get3DCentre(Point3F &pos)
  249. {
  250. Point3F screen, start, end;
  251. screen.set(getExtent().x / 2, getExtent().y / 2, 0);
  252. unproject(screen, &start);
  253. screen.z = 1.0f;
  254. unproject(screen, &end);
  255. RayInfo ri;
  256. if(gServerContainer.castRay(start, end, StaticObjectType, &ri))
  257. {
  258. pos = ri.point;
  259. return true;
  260. }
  261. return false;
  262. }
  263. void GuiNavEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
  264. {
  265. mGizmo->on3DMouseDown(event);
  266. if(!isFirstResponder())
  267. setFirstResponder();
  268. mouseLock();
  269. // Construct a LineSegment from the camera position to 1000 meters away in
  270. // the direction clicked.
  271. // If that segment hits the terrain, truncate the ray to only be that length.
  272. Point3F startPnt = event.pos;
  273. Point3F endPnt = event.pos + event.vec * 1000.0f;
  274. RayInfo ri;
  275. U8 keys = Input::getModifierKeys();
  276. bool shift = keys & SI_LSHIFT;
  277. bool ctrl = keys & SI_LCTRL;
  278. if(mMode == mLinkMode && !mMesh.isNull())
  279. {
  280. if(gServerContainer.castRay(startPnt, endPnt, StaticObjectType, &ri))
  281. {
  282. U32 link = mMesh->getLink(ri.point);
  283. if(link != -1)
  284. {
  285. if(mLink != -1)
  286. mMesh->selectLink(mLink, false);
  287. mMesh->selectLink(link, true, false);
  288. mLink = link;
  289. LinkData d = mMesh->getLinkFlags(mLink);
  290. Con::executef(this, "onLinkSelected", Con::getIntArg(d.getFlags()));
  291. }
  292. else
  293. {
  294. if(mLink != -1)
  295. {
  296. mMesh->selectLink(mLink, false);
  297. mLink = -1;
  298. Con::executef(this, "onLinkDeselected");
  299. }
  300. else
  301. {
  302. if(mLinkStart != Point3F::Max)
  303. {
  304. mMesh->addLink(mLinkStart, ri.point);
  305. if(!shift)
  306. mLinkStart = Point3F::Max;
  307. }
  308. else
  309. {
  310. mLinkStart = ri.point;
  311. }
  312. }
  313. }
  314. }
  315. else
  316. {
  317. mMesh->selectLink(mLink, false);
  318. mLink = -1;
  319. Con::executef(this, "onLinkDeselected");
  320. }
  321. }
  322. if(mMode == mTileMode && !mMesh.isNull())
  323. {
  324. if(gServerContainer.castRay(startPnt, endPnt, StaticShapeObjectType, &ri))
  325. {
  326. mTile = mMesh->getTile(ri.point);
  327. dd.clear();
  328. mMesh->renderTileData(dd, mTile);
  329. }
  330. }
  331. if(mMode == mTestMode)
  332. {
  333. // Spawn new character
  334. if(ctrl)
  335. {
  336. if(gServerContainer.castRay(startPnt, endPnt, StaticObjectType, &ri))
  337. spawnPlayer(ri.point);
  338. }
  339. // Deselect character
  340. else if(shift)
  341. {
  342. mPlayer = NULL;
  343. Con::executef(this, "onPlayerDeselected");
  344. }
  345. // Select/move character
  346. else
  347. {
  348. if(gServerContainer.castRay(startPnt, endPnt, PlayerObjectType | VehicleObjectType, &ri))
  349. {
  350. if(ri.object)
  351. {
  352. mPlayer = ri.object;
  353. AIPlayer* asAIPlayer = dynamic_cast<AIPlayer*>(mPlayer.getPointer());
  354. if (asAIPlayer) //try direct
  355. {
  356. Con::executef(this, "onPlayerSelected", Con::getIntArg(asAIPlayer->mLinkTypes.getFlags()));
  357. }
  358. else
  359. {
  360. ShapeBase* sbo = dynamic_cast<ShapeBase*>(mPlayer.getPointer());
  361. if (sbo->getAIController())
  362. {
  363. if (sbo->getAIController()->mControllerData)
  364. Con::executef(this, "onPlayerSelected", Con::getIntArg(sbo->getAIController()->mControllerData->mLinkTypes.getFlags()));
  365. }
  366. else
  367. {
  368. Con::executef(this, "onPlayerSelected");
  369. }
  370. }
  371. }
  372. }
  373. else if (!mPlayer.isNull() && gServerContainer.castRay(startPnt, endPnt, StaticObjectType, &ri))
  374. {
  375. AIPlayer* asAIPlayer = dynamic_cast<AIPlayer*>(mPlayer.getPointer());
  376. if (asAIPlayer) //try direct
  377. {
  378. asAIPlayer->setPathDestination(ri.point);
  379. }
  380. else
  381. {
  382. ShapeBase* sbo = dynamic_cast<ShapeBase*>(mPlayer.getPointer());
  383. if (sbo->getAIController())
  384. {
  385. if (sbo->getAIController()->mControllerData)
  386. sbo->getAIController()->getNav()->setPathDestination(ri.point, true);
  387. }
  388. }
  389. }
  390. }
  391. }
  392. }
  393. void GuiNavEditorCtrl::on3DMouseUp(const Gui3DMouseEvent & event)
  394. {
  395. // Keep the Gizmo up to date.
  396. mGizmo->on3DMouseUp(event);
  397. mouseUnlock();
  398. }
  399. void GuiNavEditorCtrl::on3DMouseMove(const Gui3DMouseEvent & event)
  400. {
  401. //if(mSelRiver != NULL && mSelNode != -1)
  402. //mGizmo->on3DMouseMove(event);
  403. Point3F startPnt = event.pos;
  404. Point3F endPnt = event.pos + event.vec * 1000.0f;
  405. RayInfo ri;
  406. if(mMode == mLinkMode && !mMesh.isNull())
  407. {
  408. if(gServerContainer.castRay(startPnt, endPnt, StaticObjectType, &ri))
  409. {
  410. U32 link = mMesh->getLink(ri.point);
  411. if(link != -1)
  412. {
  413. if(link != mLink)
  414. {
  415. if(mCurLink != -1)
  416. mMesh->selectLink(mCurLink, false);
  417. mMesh->selectLink(link, true, true);
  418. }
  419. mCurLink = link;
  420. }
  421. else
  422. {
  423. if(mCurLink != mLink)
  424. mMesh->selectLink(mCurLink, false);
  425. mCurLink = -1;
  426. }
  427. }
  428. else
  429. {
  430. mMesh->selectLink(mCurLink, false);
  431. mCurLink = -1;
  432. }
  433. }
  434. // Select a tile from our current NavMesh.
  435. if(mMode == mTileMode && !mMesh.isNull())
  436. {
  437. if(gServerContainer.castRay(startPnt, endPnt, StaticObjectType, &ri))
  438. mCurTile = mMesh->getTile(ri.point);
  439. else
  440. mCurTile = -1;
  441. }
  442. if(mMode == mTestMode)
  443. {
  444. if(gServerContainer.castRay(startPnt, endPnt, PlayerObjectType | VehicleObjectType, &ri))
  445. mCurPlayer = ri.object;
  446. else
  447. mCurPlayer = NULL;
  448. }
  449. }
  450. void GuiNavEditorCtrl::on3DMouseDragged(const Gui3DMouseEvent & event)
  451. {
  452. mGizmo->on3DMouseDragged(event);
  453. if(mGizmo->isDirty())
  454. {
  455. Point3F scale = mGizmo->getScale();
  456. const MatrixF &mat = mGizmo->getTransform();
  457. VectorF normal;
  458. mat.getColumn(2, &normal);
  459. //mSelRiver->setNode(pos, scale.x, scale.z, normal, mSelNode);
  460. mIsDirty = true;
  461. }
  462. }
  463. void GuiNavEditorCtrl::on3DMouseEnter(const Gui3DMouseEvent & event)
  464. {
  465. }
  466. void GuiNavEditorCtrl::on3DMouseLeave(const Gui3DMouseEvent & event)
  467. {
  468. }
  469. void GuiNavEditorCtrl::updateGuiInfo()
  470. {
  471. }
  472. void GuiNavEditorCtrl::onRender(Point2I offset, const RectI &updateRect)
  473. {
  474. PROFILE_SCOPE(GuiNavEditorCtrl_OnRender);
  475. Parent::onRender(offset, updateRect);
  476. return;
  477. }
  478. static void renderBoxOutline(const Box3F &box, const ColorI &col)
  479. {
  480. if(box != Box3F::Invalid)
  481. {
  482. GFXStateBlockDesc desc;
  483. desc.setCullMode(GFXCullNone);
  484. desc.setFillModeSolid();
  485. desc.setZReadWrite(true, false);
  486. desc.setBlend(true);
  487. GFX->getDrawUtil()->drawCube(desc, box, ColorI(col, 20));
  488. desc.setFillModeWireframe();
  489. desc.setBlend(false);
  490. GFX->getDrawUtil()->drawCube(desc, box, ColorI(col, 255));
  491. }
  492. }
  493. void GuiNavEditorCtrl::renderScene(const RectI & updateRect)
  494. {
  495. GFX->setStateBlock(mZDisableSB);
  496. // get the projected size...
  497. GameConnection* connection = GameConnection::getConnectionToServer();
  498. if(!connection)
  499. return;
  500. // Grab the camera's transform
  501. MatrixF mat;
  502. connection->getControlCameraTransform(0, &mat);
  503. // Get the camera position
  504. Point3F camPos;
  505. mat.getColumn(3,&camPos);
  506. if(mMode == mLinkMode)
  507. {
  508. if(mLinkStart != Point3F::Max)
  509. {
  510. GFXStateBlockDesc desc;
  511. desc.setBlend(false);
  512. desc.setZReadWrite(true ,true);
  513. MatrixF linkMat(true);
  514. linkMat.setPosition(mLinkStart);
  515. Point3F scale(0.8f, 0.8f, 0.8f);
  516. GFX->getDrawUtil()->drawTransform(desc, linkMat, &scale);
  517. }
  518. }
  519. if(mMode == mTileMode && !mMesh.isNull())
  520. {
  521. renderBoxOutline(mMesh->getTileBox(mCurTile), ColorI::BLUE);
  522. renderBoxOutline(mMesh->getTileBox(mTile), ColorI::GREEN);
  523. if(Con::getBoolVariable("$Nav::Editor::renderVoxels", false)) dd.renderGroup(0);
  524. if(Con::getBoolVariable("$Nav::Editor::renderInput", false))
  525. {
  526. dd.depthMask(false);
  527. dd.renderGroup(1);
  528. dd.depthMask(true);
  529. }
  530. }
  531. if(mMode == mTestMode)
  532. {
  533. if(!mCurPlayer.isNull())
  534. renderBoxOutline(mCurPlayer->getWorldBox(), ColorI::BLUE);
  535. if(!mPlayer.isNull())
  536. renderBoxOutline(mPlayer->getWorldBox(), ColorI::GREEN);
  537. }
  538. duDebugDrawTorque d;
  539. if(!mMesh.isNull())
  540. mMesh->renderLinks(d);
  541. d.render();
  542. // Now draw all the 2d stuff!
  543. GFX->setClipRect(updateRect);
  544. }
  545. bool GuiNavEditorCtrl::getStaticPos(const Gui3DMouseEvent & event, Point3F &tpos)
  546. {
  547. // Find clicked point on the terrain
  548. Point3F startPnt = event.pos;
  549. Point3F endPnt = event.pos + event.vec * 1000.0f;
  550. RayInfo ri;
  551. bool hit;
  552. hit = gServerContainer.castRay(startPnt, endPnt, StaticShapeObjectType, &ri);
  553. tpos = ri.point;
  554. return hit;
  555. }
  556. void GuiNavEditorCtrl::setMode(String mode, bool sourceShortcut = false)
  557. {
  558. mMode = mode;
  559. Con::executef(this, "onModeSet", mode);
  560. if(sourceShortcut)
  561. Con::executef(this, "paletteSync", mode);
  562. }
  563. void GuiNavEditorCtrl::submitUndo(const UTF8 *name)
  564. {
  565. // Grab the mission editor undo manager.
  566. UndoManager *undoMan = NULL;
  567. if(!Sim::findObject("EUndoManager", undoMan))
  568. {
  569. Con::errorf("GuiNavEditorCtrl::submitUndo() - EUndoManager not found!");
  570. return;
  571. }
  572. // Setup the action.
  573. GuiNavEditorUndoAction *action = new GuiNavEditorUndoAction(name);
  574. action->mNavEditor = this;
  575. undoMan->addAction(action);
  576. }
  577. void GuiNavEditorCtrl::_prepRenderImage(SceneManager* sceneGraph, const SceneRenderState* state)
  578. {
  579. /*if(isAwake() && River::smEditorOpen && mSelRiver)
  580. {
  581. ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
  582. ri->type = RenderPassManager::RIT_Editor;
  583. ri->renderDelegate.bind(this, &GuiNavEditorCtrl::_renderSelectedRiver);
  584. ri->defaultKey = 100;
  585. state->getRenderPass()->addInst(ri);
  586. }*/
  587. }
  588. DefineEngineMethod(GuiNavEditorCtrl, getMode, const char*, (), , "")
  589. {
  590. return object->getMode();
  591. }
  592. DefineEngineMethod(GuiNavEditorCtrl, setMode, void, (String mode),, "setMode(String mode)")
  593. {
  594. object->setMode(mode);
  595. }
  596. #endif