Torque3D Documentation / _generateds / guiDecalEditorCtrl.h

guiDecalEditorCtrl.h

Engine/source/gui/worldEditor/guiDecalEditorCtrl.h

More...

Classes:

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  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 _GUIDECALEDITORCTRL_H_
 25#define _GUIDECALEDITORCTRL_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 _DECALINSTANCE_H_
 34#include "T3D/decal/decalInstance.h"
 35#endif
 36
 37class GameBase;
 38class Gizmo;
 39struct RayInfo;
 40class DecalInstance;
 41class DecalData;
 42
 43class GuiDecalEditorCtrl : public EditTSCtrl
 44{
 45   typedef EditTSCtrl Parent;
 46
 47   public:
 48
 49      GuiDecalEditorCtrl();
 50      ~GuiDecalEditorCtrl();
 51
 52      DECLARE_CONOBJECT(GuiDecalEditorCtrl);
 53
 54      // SimObject
 55      bool onAdd();
 56      static void initPersistFields();      
 57      static void consoleInit();
 58      void onEditorDisable();
 59
 60      // GuiControl
 61      virtual bool onWake();
 62      virtual void onSleep();
 63      virtual void onRender(Point2I offset, const RectI &updateRect);
 64
 65      // EditTSCtrl      
 66      void get3DCursor( GuiCursor *&cursor, bool &visible, const Gui3DMouseEvent &event_ );
 67      void on3DMouseDown(const Gui3DMouseEvent & event);
 68      void on3DMouseUp(const Gui3DMouseEvent & event);
 69      void on3DMouseMove(const Gui3DMouseEvent & event);
 70      void on3DMouseDragged(const Gui3DMouseEvent & event);
 71      void on3DMouseEnter(const Gui3DMouseEvent & event);
 72      void on3DMouseLeave(const Gui3DMouseEvent & event);
 73      void on3DRightMouseDown(const Gui3DMouseEvent & event);
 74      void on3DRightMouseUp(const Gui3DMouseEvent & event);
 75      void updateGuiInfo();      
 76      void renderScene(const RectI & updateRect);
 77      void renderGui(Point2I offset, const RectI &updateRect);
 78
 79      /// Find clicked point on "static collision" objects.
 80      bool getRayInfo( const Gui3DMouseEvent &event, RayInfo *rInfo );
 81      
 82      void selectDecal( DecalInstance *inst );
 83      void deleteSelectedDecal();
 84      void deleteDecalDatablock( String lookupName );
 85      void retargetDecalDatablock( String dbFrom, String dbTo );
 86      void setMode( String mode, bool sourceShortcut );
 87      
 88      void forceRedraw( DecalInstance * decalInstance );
 89      void setGizmoFocus( DecalInstance * decalInstance );
 90
 91   public:
 92
 93      String mMode;
 94      DecalInstance *mSELDecal;
 95      DecalInstance *mHLDecal;
 96
 97      static bool smRenderDecalPixelSize;
 98
 99   protected:
100     
101      bool mPerformedDragCopy;
102
103      DecalData *mCurrentDecalData;
104
105      Vector<Point3F> mSELEdgeVerts;
106      Vector<Point3F> mHLEdgeVerts;
107
108      void _renderDecalEdge( const Vector<Point3F> &verts, const ColorI &color );
109};
110
111//Decal Instance Create Undo Actions
112class DICreateUndoAction : public UndoAction
113{
114   typedef UndoAction Parent;
115
116public:
117   GuiDecalEditorCtrl *mEditor;  
118
119protected:
120
121      /// The captured object state.
122      DecalInstance mDecalInstance;
123      S32 mDatablockId;
124
125public:
126
127   DECLARE_CONOBJECT( DICreateUndoAction );
128   static void initPersistFields();
129   
130   DICreateUndoAction( const UTF8* actionName = "Create Decal " );
131   virtual ~DICreateUndoAction();
132
133   void addDecal(const DecalInstance& decal);
134
135   // UndoAction
136   virtual void undo();
137   virtual void redo();
138};
139
140//Decal Instance Delete Undo Actions
141class DIDeleteUndoAction : public UndoAction
142{
143   typedef UndoAction Parent;
144
145public:
146   GuiDecalEditorCtrl *mEditor;  
147
148protected:
149
150   /// The captured object state.
151   DecalInstance mDecalInstance;
152   S32 mDatablockId;
153
154public:
155
156   DECLARE_CONOBJECT( DIDeleteUndoAction );
157   static void initPersistFields();
158   
159   DIDeleteUndoAction( const UTF8* actionName = "Delete Decal" );
160   virtual ~DIDeleteUndoAction();
161
162   ///
163   void deleteDecal(const DecalInstance& decal);
164
165   // UndoAction
166   virtual void undo();
167   virtual void redo();
168};
169
170//Decal Datablock Delete Undo Actions
171class DBDeleteUndoAction : public UndoAction
172{
173   typedef UndoAction Parent;
174
175public:
176   GuiDecalEditorCtrl *mEditor;  
177   S32 mDatablockId;
178
179protected:
180   
181   // The captured decalInstance states
182   Vector<DecalInstance> mDecalInstanceVec;
183   
184public:
185
186   DECLARE_CONOBJECT( DBDeleteUndoAction );
187   static void initPersistFields();
188   
189   DBDeleteUndoAction( const UTF8* actionName = "Delete Decal Datablock" );
190   virtual ~DBDeleteUndoAction();
191
192   void deleteDecal(const DecalInstance& decal);
193
194   // UndoAction
195   virtual void undo();
196   virtual void redo();
197};
198
199//Decal Datablock Retarget Undo Actions
200class DBRetargetUndoAction : public UndoAction
201{
202   typedef UndoAction Parent;
203
204public:
205   GuiDecalEditorCtrl *mEditor;  
206   S32 mDBFromId;
207   S32 mDBToId;
208
209protected:
210   
211   // The captured decalInstance states
212   Vector<DecalInstance*> mDecalInstanceVec;
213   
214public:
215
216   DECLARE_CONOBJECT( DBRetargetUndoAction );
217   static void initPersistFields();
218   
219   DBRetargetUndoAction( const UTF8* actionName = "Retarget Decal Datablock" );
220   virtual ~DBRetargetUndoAction();
221
222   void retargetDecal( DecalInstance* decal );
223
224   // UndoAction
225   virtual void undo();
226   virtual void redo();
227};
228
229#endif // _GUIDECALEDITORCTRL_H_
230
231
232
233