mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
163 lines
4.1 KiB
C++
163 lines
4.1 KiB
C++
//-----------------------------------------------------------------------------
|
|
// Copyright (c) 2014 Daniel Buckmaster
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
// of this software and associated documentation files (the "Software"), to
|
|
// deal in the Software without restriction, including without limitation the
|
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
// sell copies of the Software, and to permit persons to whom the Software is
|
|
// furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included in
|
|
// all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
// IN THE SOFTWARE.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#ifndef _GUINAVEDITORCTRL_H_
|
|
#define _GUINAVEDITORCTRL_H_
|
|
#include "torqueConfig.h"
|
|
#ifdef TORQUE_TOOLS
|
|
#ifndef _EDITTSCTRL_H_
|
|
#include "gui/worldEditor/editTSCtrl.h"
|
|
#endif
|
|
#ifndef _UNDO_H_
|
|
#include "util/undo.h"
|
|
#endif
|
|
#ifndef _GIZMO_H_
|
|
#include "gui/worldEditor/gizmo.h"
|
|
#endif
|
|
|
|
//#ifndef _NAVMESH_TOOL_H_
|
|
//#include "navigation/navMeshTool.h"
|
|
//#endif
|
|
|
|
#include "navMesh.h"
|
|
#include "T3D/aiPlayer.h"
|
|
|
|
struct ObjectRenderInst;
|
|
class SceneManager;
|
|
class SceneRenderState;
|
|
class BaseMatInstance;
|
|
class NavMeshTool;
|
|
|
|
class GuiNavEditorCtrl : public EditTSCtrl
|
|
{
|
|
typedef EditTSCtrl Parent;
|
|
friend class GuiNavEditorUndoAction;
|
|
|
|
public:
|
|
static const String mSelectMode;
|
|
static const String mLinkMode;
|
|
static const String mCoverMode;
|
|
static const String mTestMode;
|
|
|
|
GuiNavEditorCtrl();
|
|
~GuiNavEditorCtrl();
|
|
|
|
DECLARE_CONOBJECT(GuiNavEditorCtrl);
|
|
|
|
/// @name SimObject
|
|
/// @{
|
|
|
|
bool onAdd() override;
|
|
static void initPersistFields();
|
|
|
|
/// @}
|
|
|
|
/// @name GuiControl
|
|
/// @{
|
|
|
|
void onSleep() override;
|
|
void onRender(Point2I offset, const RectI &updateRect) override;
|
|
|
|
/// @}
|
|
|
|
/// @name EditTSCtrl
|
|
/// @{
|
|
|
|
void get3DCursor(GuiCursor *&cursor, bool &visible, const Gui3DMouseEvent &event_) override;
|
|
bool get3DCentre(Point3F &pos);
|
|
void on3DMouseDown(const Gui3DMouseEvent & event) override;
|
|
void on3DMouseUp(const Gui3DMouseEvent & event) override;
|
|
void on3DMouseMove(const Gui3DMouseEvent & event) override;
|
|
void on3DMouseDragged(const Gui3DMouseEvent & event) override;
|
|
void on3DMouseEnter(const Gui3DMouseEvent & event) override;
|
|
void on3DMouseLeave(const Gui3DMouseEvent & event) override;
|
|
void updateGuiInfo() override;
|
|
void renderScene(const RectI & updateRect) override;
|
|
|
|
/// @}
|
|
|
|
/// @name GuiNavEditorCtrl
|
|
/// @{
|
|
|
|
bool getStaticPos(const Gui3DMouseEvent & event, Point3F &tpos);
|
|
|
|
void selectMesh(NavMesh *mesh);
|
|
|
|
S32 getMeshId();
|
|
|
|
/// @}
|
|
void setActiveTool(NavMeshTool* tool);
|
|
|
|
void setDrawMode(S32 id);
|
|
|
|
protected:
|
|
|
|
void _prepRenderImage(SceneManager* sceneGraph, const SceneRenderState* sceneState);
|
|
|
|
void submitUndo(const UTF8 *name = "Action");
|
|
|
|
GFXStateBlockRef mZDisableSB;
|
|
GFXStateBlockRef mZEnableSB;
|
|
|
|
bool mIsDirty;
|
|
|
|
/// Currently-selected NavMesh.
|
|
SimObjectPtr<NavMesh> mMesh;
|
|
|
|
/// The active tool in used by the editor.
|
|
SimObjectPtr<NavMeshTool> mTool;
|
|
|
|
/// @}
|
|
|
|
/// @name Tile mode
|
|
/// @{
|
|
|
|
duDebugDrawTorque dd;
|
|
|
|
/// @}
|
|
|
|
Gui3DMouseEvent mLastMouseEvent;
|
|
|
|
#define InvalidMousePoint Point2I(-100,-100)
|
|
Point2I mStartDragMousePoint;
|
|
};
|
|
|
|
class GuiNavEditorUndoAction : public UndoAction
|
|
{
|
|
public:
|
|
GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(0)
|
|
{
|
|
}
|
|
|
|
GuiNavEditorCtrl *mNavEditor;
|
|
|
|
SimObjectId mObjId;
|
|
|
|
void undo() override;
|
|
void redo() override { undo(); }
|
|
};
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|