Torque3D Documentation / _generateds / forestSelectionTool.h

forestSelectionTool.h

Engine/source/forest/editor/forestSelectionTool.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 _FOREST_EDITOR_SELECTIONTOOL_H_
 25#define _FOREST_EDITOR_SELECTIONTOOL_H_
 26
 27#ifndef _FOREST_EDITOR_TOOL_H_
 28#include "forest/editor/forestTool.h"
 29#endif
 30#ifndef _FORESTITEM_H_
 31#include "forest/forestItem.h"
 32#endif
 33#ifndef _TSELECTION_H_
 34#include "gui/worldEditor/tSelection.h"
 35#endif
 36
 37
 38class Forest;
 39class Gizmo;
 40class GizmoProfile;
 41class ForestUpdateAction;
 42
 43class ForestItemSelection : public Selection<ForestItem>
 44{
 45public:
 46
 47   void setForestData( ForestData* data ) { mData = data; }
 48
 49protected:
 50
 51   void offsetObject( ForestItem &object, const Point3F &delta );
 52   void rotateObject( ForestItem &object, const EulerF &delta, const Point3F &origin );
 53   void scaleObject( ForestItem &object, const Point3F &delta );
 54
 55protected:
 56
 57   ForestData *mData;
 58};
 59
 60
 61class ForestSelectionTool : public ForestTool
 62{
 63   typedef ForestTool Parent;
 64
 65   protected:
 66
 67      Gizmo *mGizmo;
 68      GizmoProfile *mGizmoProfile;
 69
 70      ForestItem mHoverItem;
 71
 72      ForestItemSelection mSelection;
 73      
 74      ForestItemSelection mDragSelection;
 75      bool mDragSelect;
 76      RectI mDragRect;
 77      Point2I mDragStart;
 78      bool mMouseDown;
 79      bool mMouseDragged;
 80      ColorI mDragRectColor;
 81      bool mUsingGizmo;
 82      
 83      Box3F mBounds;
 84
 85      ForestUpdateAction *mCurrAction;
 86
 87      void _selectItem( const ForestItem &item );
 88
 89   public:
 90
 91      ForestSelectionTool();
 92      virtual ~ForestSelectionTool();
 93
 94      DECLARE_CONOBJECT( ForestSelectionTool );
 95
 96      // ForestTool
 97      virtual void setParentEditor( ForestEditorCtrl *editor );
 98      virtual void setActiveForest( Forest *forest );
 99      virtual void on3DMouseDown( const Gui3DMouseEvent &evt );
100      virtual void on3DMouseUp( const Gui3DMouseEvent &evt );
101      virtual void on3DMouseMove( const Gui3DMouseEvent &evt );
102      virtual void on3DMouseDragged( const Gui3DMouseEvent &evt );
103      virtual void onRender3D();
104      virtual void onRender2D();
105      virtual bool updateGuiInfo();
106      virtual void updateGizmo();
107      virtual void onUndoAction();
108
109      S32 getSelectionCount() const { return mSelection.size(); }
110
111      void deleteSelection();
112      void clearSelection();
113      void cutSelection();
114      void copySelection();
115      void pasteSelection();                
116};
117
118
119#endif // _FOREST_EDITOR_SELECTIONTOOL_H_
120
121
122
123