forestEditorCtrl.h
Engine/source/forest/editor/forestEditorCtrl.h
Classes:
class
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 _FOREST_EDITOR_FORESTEDITORCTRL_H_ 25#define _FOREST_EDITOR_FORESTEDITORCTRL_H_ 26 27#ifndef _EDITTSCTRL_H_ 28#include "gui/worldEditor/editTSCtrl.h" 29#endif 30 31#ifndef _H_FOREST_ 32#include "forest/forest.h" 33#endif 34 35#ifndef _FOREST_EDITOR_TOOL_H_ 36#include "forest/editor/forestTool.h" 37#endif 38 39 40class ForestEditorCtrl : public EditTSCtrl 41{ 42 typedef EditTSCtrl Parent; 43 44 friend class ForestPaintEvent; 45 46 protected: 47 48 /// The server Forest we're editing. 49 SimObjectPtr<Forest> mForest; 50 51 /// The active tool in used by the editor. 52 SimObjectPtr<ForestTool> mTool; 53 54 public: 55 56 ForestEditorCtrl(); 57 virtual ~ForestEditorCtrl(); 58 59 DECLARE_CONOBJECT( ForestEditorCtrl ); 60 61 // SimObject 62 bool onAdd(); 63 static void initPersistFields(); 64 65 // GuiControl 66 virtual bool onWake(); 67 virtual void onSleep(); 68 virtual void onMouseUp( const GuiEvent &event_ ); 69 70 // EditTSCtrl 71 void get3DCursor( GuiCursor *&cursor, bool &visible, const Gui3DMouseEvent &event_ ); 72 void on3DMouseDown( const Gui3DMouseEvent &event_ ); 73 void on3DMouseUp( const Gui3DMouseEvent &event_ ); 74 void on3DMouseMove( const Gui3DMouseEvent &event_ ); 75 void on3DMouseDragged( const Gui3DMouseEvent &event_ ); 76 void on3DMouseEnter( const Gui3DMouseEvent &event_ ); 77 void on3DMouseLeave( const Gui3DMouseEvent &event_ ); 78 void on3DRightMouseDown( const Gui3DMouseEvent &event_ ); 79 void on3DRightMouseUp( const Gui3DMouseEvent &event_ ); 80 bool onMouseWheelUp(const GuiEvent &event_); 81 bool onMouseWheelDown(const GuiEvent &event_); 82 void updateGuiInfo(); 83 void updateGizmo(); 84 void renderScene( const RectI &updateRect ); 85 void renderGui( Point2I offset, const RectI &updateRect ); 86 87 /// Causes the editor to reselect the active forest. 88 bool updateActiveForest( bool createNew ); 89 90 /// Sets the active Forest 91 void setActiveForest(Forest* forestObject) { mForest = forestObject; } 92 93 /// Returns the active Forest. 94 Forest *getActiveForest() const { return mForest; } 95 96 void setActiveTool( ForestTool *tool ); 97 ForestTool* getActiveTool() { return mTool; } 98 99 void onUndoAction(); 100 101 void deleteMeshSafe( ForestItemData *itemData ); 102 103 void updateCollision(); 104 105 bool isDirty(); 106}; 107 108#endif // _FOREST_EDITOR_FORESTEDITORCTRL_H_ 109 110 111 112