Torque3D Documentation / _generateds / guiNavEditorCtrl.h

guiNavEditorCtrl.h

Engine/source/navigation/guiNavEditorCtrl.h

More...

Classes:

Public Defines

define
InvalidMousePoint() (-100,-100)

Detailed Description

Public Defines

InvalidMousePoint() (-100,-100)
  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2014 Daniel Buckmaster
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#ifndef _GUINAVEDITORCTRL_H_
 25#define _GUINAVEDITORCTRL_H_
 26
 27#ifndef _EDITTSCTRL_H_
 28#include "gui/worldEditor/editTSCtrl.h"
 29#endif
 30#ifndef _UNDO_H_
 31#include "util/undo.h"
 32#endif
 33#ifndef _GIZMO_H_
 34#include "gui/worldEditor/gizmo.h"
 35#endif
 36
 37#include "navMesh.h"
 38#include "T3D/aiPlayer.h"
 39
 40struct ObjectRenderInst;
 41class SceneManager;
 42class SceneRenderState;
 43class BaseMatInstance;
 44
 45class GuiNavEditorCtrl : public EditTSCtrl
 46{
 47   typedef EditTSCtrl Parent;
 48   friend class GuiNavEditorUndoAction;
 49
 50public:
 51   static const String mSelectMode;
 52   static const String mLinkMode;
 53   static const String mCoverMode;
 54   static const String mTileMode;
 55   static const String mTestMode;
 56
 57   GuiNavEditorCtrl();
 58   ~GuiNavEditorCtrl();
 59
 60   DECLARE_CONOBJECT(GuiNavEditorCtrl);
 61
 62   /// @name SimObject
 63   /// @{
 64
 65   bool onAdd();
 66   static void initPersistFields();
 67
 68   /// @}
 69
 70   /// @name GuiControl
 71   /// @{
 72
 73   virtual void onSleep();
 74   virtual void onRender(Point2I offset, const RectI &updateRect);
 75
 76   /// @}
 77
 78   /// @name EditTSCtrl
 79   /// @{
 80
 81   void get3DCursor(GuiCursor *&cursor, bool &visible, const Gui3DMouseEvent &event_);
 82   bool get3DCentre(Point3F &pos);
 83   void on3DMouseDown(const Gui3DMouseEvent & event);
 84   void on3DMouseUp(const Gui3DMouseEvent & event);
 85   void on3DMouseMove(const Gui3DMouseEvent & event);
 86   void on3DMouseDragged(const Gui3DMouseEvent & event);
 87   void on3DMouseEnter(const Gui3DMouseEvent & event);
 88   void on3DMouseLeave(const Gui3DMouseEvent & event);
 89   void updateGuiInfo();      
 90   void renderScene(const RectI & updateRect);
 91
 92   /// @}
 93
 94   /// @name GuiNavEditorCtrl
 95   /// @{
 96
 97   bool getStaticPos(const Gui3DMouseEvent & event, Point3F &tpos);
 98
 99   void setMode(String mode, bool sourceShortcut);
100   String getMode() { return mMode; }
101
102   void selectMesh(NavMesh *mesh);
103   void deselect();
104
105   S32 getMeshId();
106   S32 getPlayerId();
107
108   String mSpawnClass;
109   String mSpawnDatablock;
110
111   void deleteLink();
112   void setLinkFlags(const LinkData &d);
113
114   void buildTile();
115
116   void spawnPlayer(const Point3F &pos);
117
118   /// @}
119
120protected:
121
122   void _prepRenderImage(SceneManager* sceneGraph, const SceneRenderState* sceneState);
123
124   void submitUndo(const UTF8 *name = "Action");
125
126   GFXStateBlockRef mZDisableSB;
127   GFXStateBlockRef mZEnableSB;
128
129   bool mIsDirty;
130
131   String mMode;
132
133   /// Currently-selected NavMesh.
134   SimObjectPtr<NavMesh> mMesh;
135
136   /// @name Link mode
137   /// @{
138
139   Point3F mLinkStart;
140   S32 mCurLink;
141   S32 mLink;
142
143   /// @}
144
145   /// @name Tile mode
146   /// @{
147
148   S32 mCurTile;
149   S32 mTile;
150
151   duDebugDrawTorque dd;
152
153   /// @}
154
155   /// @name Test mode
156   /// @{
157
158   SimObjectPtr<AIPlayer> mPlayer;
159   SimObjectPtr<AIPlayer> mCurPlayer;
160
161   /// @}
162
163   Gui3DMouseEvent mLastMouseEvent;
164
165#define InvalidMousePoint Point2I(-100,-100)
166   Point2I mStartDragMousePoint;
167};
168
169class GuiNavEditorUndoAction : public UndoAction
170{
171public:
172   GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(NULL)
173   {
174   }
175
176   GuiNavEditorCtrl *mNavEditor;         
177
178   SimObjectId mObjId;
179
180   virtual void undo();
181   virtual void redo() { undo(); }
182};
183
184#endif
185
186
187
188