mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
cleanup
add select tool cleanup more from guinaveditorctrl and scripts
This commit is contained in:
parent
3946017556
commit
24ec55e8bc
9 changed files with 252 additions and 208 deletions
|
|
@ -38,6 +38,7 @@
|
||||||
#include "gui/worldEditor/undoActions.h"
|
#include "gui/worldEditor/undoActions.h"
|
||||||
#include "T3D/gameBase/gameConnection.h"
|
#include "T3D/gameBase/gameConnection.h"
|
||||||
#include "T3D/AI/AIController.h"
|
#include "T3D/AI/AIController.h"
|
||||||
|
#include "navigation/navMeshTool.h"
|
||||||
|
|
||||||
IMPLEMENT_CONOBJECT(GuiNavEditorCtrl);
|
IMPLEMENT_CONOBJECT(GuiNavEditorCtrl);
|
||||||
|
|
||||||
|
|
@ -47,15 +48,8 @@ ConsoleDocClass(GuiNavEditorCtrl,
|
||||||
"@internal"
|
"@internal"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Each of the mode names directly correlates with the Nav Editor's tool palette.
|
|
||||||
const String GuiNavEditorCtrl::mSelectMode = "SelectMode";
|
|
||||||
const String GuiNavEditorCtrl::mLinkMode = "LinkMode";
|
|
||||||
const String GuiNavEditorCtrl::mCoverMode = "CoverMode";
|
|
||||||
const String GuiNavEditorCtrl::mTestMode = "TestMode";
|
|
||||||
|
|
||||||
GuiNavEditorCtrl::GuiNavEditorCtrl()
|
GuiNavEditorCtrl::GuiNavEditorCtrl()
|
||||||
{
|
{
|
||||||
mMode = mSelectMode;
|
|
||||||
mIsDirty = false;
|
mIsDirty = false;
|
||||||
mStartDragMousePoint = InvalidMousePoint;
|
mStartDragMousePoint = InvalidMousePoint;
|
||||||
mMesh = NULL;
|
mMesh = NULL;
|
||||||
|
|
@ -101,8 +95,6 @@ void GuiNavEditorCtrl::initPersistFields()
|
||||||
void GuiNavEditorCtrl::onSleep()
|
void GuiNavEditorCtrl::onSleep()
|
||||||
{
|
{
|
||||||
Parent::onSleep();
|
Parent::onSleep();
|
||||||
|
|
||||||
//mMode = mSelectMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiNavEditorCtrl::selectMesh(NavMesh *mesh)
|
void GuiNavEditorCtrl::selectMesh(NavMesh *mesh)
|
||||||
|
|
@ -311,15 +303,6 @@ bool GuiNavEditorCtrl::getStaticPos(const Gui3DMouseEvent & event, Point3F &tpos
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiNavEditorCtrl::setMode(String mode, bool sourceShortcut = false)
|
|
||||||
{
|
|
||||||
mMode = mode;
|
|
||||||
Con::executef(this, "onModeSet", mode);
|
|
||||||
|
|
||||||
if(sourceShortcut)
|
|
||||||
Con::executef(this, "paletteSync", mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GuiNavEditorCtrl::submitUndo(const UTF8 *name)
|
void GuiNavEditorCtrl::submitUndo(const UTF8 *name)
|
||||||
{
|
{
|
||||||
// Grab the mission editor undo manager.
|
// Grab the mission editor undo manager.
|
||||||
|
|
@ -361,6 +344,7 @@ void GuiNavEditorCtrl::setActiveTool(NavMeshTool* tool)
|
||||||
|
|
||||||
if (mTool)
|
if (mTool)
|
||||||
{
|
{
|
||||||
|
mTool->setActiveEditor(this);
|
||||||
mTool->setActiveNavMesh(mMesh);
|
mTool->setActiveNavMesh(mMesh);
|
||||||
mTool->onActivated(mLastEvent);
|
mTool->onActivated(mLastEvent);
|
||||||
}
|
}
|
||||||
|
|
@ -386,14 +370,4 @@ DefineEngineMethod(GuiNavEditorCtrl, setActiveTool, void, (const char* toolName)
|
||||||
object->setActiveTool(tool);
|
object->setActiveTool(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DefineEngineMethod(GuiNavEditorCtrl, getMode, const char*, (), , "")
|
|
||||||
{
|
|
||||||
return object->getMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
DefineEngineMethod(GuiNavEditorCtrl, setMode, void, (String mode),, "setMode(String mode)")
|
|
||||||
{
|
|
||||||
object->setMode(mode);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@
|
||||||
#include "gui/worldEditor/gizmo.h"
|
#include "gui/worldEditor/gizmo.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _NAVMESH_TOOL_H_
|
//#ifndef _NAVMESH_TOOL_H_
|
||||||
#include "navigation/navMeshTool.h"
|
//#include "navigation/navMeshTool.h"
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
#include "navMesh.h"
|
#include "navMesh.h"
|
||||||
#include "T3D/aiPlayer.h"
|
#include "T3D/aiPlayer.h"
|
||||||
|
|
@ -45,6 +45,7 @@ struct ObjectRenderInst;
|
||||||
class SceneManager;
|
class SceneManager;
|
||||||
class SceneRenderState;
|
class SceneRenderState;
|
||||||
class BaseMatInstance;
|
class BaseMatInstance;
|
||||||
|
class NavMeshTool;
|
||||||
|
|
||||||
class GuiNavEditorCtrl : public EditTSCtrl
|
class GuiNavEditorCtrl : public EditTSCtrl
|
||||||
{
|
{
|
||||||
|
|
@ -99,9 +100,6 @@ public:
|
||||||
|
|
||||||
bool getStaticPos(const Gui3DMouseEvent & event, Point3F &tpos);
|
bool getStaticPos(const Gui3DMouseEvent & event, Point3F &tpos);
|
||||||
|
|
||||||
void setMode(String mode, bool sourceShortcut);
|
|
||||||
String getMode() { return mMode; }
|
|
||||||
|
|
||||||
void selectMesh(NavMesh *mesh);
|
void selectMesh(NavMesh *mesh);
|
||||||
|
|
||||||
S32 getMeshId();
|
S32 getMeshId();
|
||||||
|
|
@ -122,8 +120,6 @@ protected:
|
||||||
|
|
||||||
bool mIsDirty;
|
bool mIsDirty;
|
||||||
|
|
||||||
String mMode;
|
|
||||||
|
|
||||||
/// Currently-selected NavMesh.
|
/// Currently-selected NavMesh.
|
||||||
SimObjectPtr<NavMesh> mMesh;
|
SimObjectPtr<NavMesh> mMesh;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@
|
||||||
#include "navigation/navMesh.h"
|
#include "navigation/navMesh.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _GUINAVEDITORCTRL_H_
|
||||||
|
#include "navigation/guiNavEditorCtrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class UndoAction;
|
class UndoAction;
|
||||||
|
|
||||||
class NavMeshTool : public SimObject
|
class NavMeshTool : public SimObject
|
||||||
|
|
@ -19,6 +23,8 @@ class NavMeshTool : public SimObject
|
||||||
typedef SimObject Parent;
|
typedef SimObject Parent;
|
||||||
protected:
|
protected:
|
||||||
SimObjectPtr<NavMesh> mNavMesh;
|
SimObjectPtr<NavMesh> mNavMesh;
|
||||||
|
SimObjectPtr<GuiNavEditorCtrl> mCurEditor;
|
||||||
|
|
||||||
void _submitUndo(UndoAction* action);
|
void _submitUndo(UndoAction* action);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -29,6 +35,7 @@ public:
|
||||||
DECLARE_CONOBJECT(NavMeshTool);
|
DECLARE_CONOBJECT(NavMeshTool);
|
||||||
|
|
||||||
virtual void setActiveNavMesh(NavMesh* nav_mesh) { mNavMesh = nav_mesh; }
|
virtual void setActiveNavMesh(NavMesh* nav_mesh) { mNavMesh = nav_mesh; }
|
||||||
|
virtual void setActiveEditor(GuiNavEditorCtrl* nav_editor) { mCurEditor = nav_editor; }
|
||||||
|
|
||||||
virtual void onActivated(const Gui3DMouseEvent& lastEvent) {}
|
virtual void onActivated(const Gui3DMouseEvent& lastEvent) {}
|
||||||
virtual void onDeactivated() {}
|
virtual void onDeactivated() {}
|
||||||
|
|
|
||||||
112
Engine/source/navigation/navMeshTools/navMeshSelectTool.cpp
Normal file
112
Engine/source/navigation/navMeshTools/navMeshSelectTool.cpp
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
#include "navMeshSelectTool.h"
|
||||||
|
#include "console/consoleTypes.h"
|
||||||
|
#include "gfx/gfxDrawUtil.h"
|
||||||
|
|
||||||
|
IMPLEMENT_CONOBJECT(NavMeshSelectTool);
|
||||||
|
|
||||||
|
static void renderBoxOutline(const Box3F& box, const ColorI& col)
|
||||||
|
{
|
||||||
|
if (box != Box3F::Invalid)
|
||||||
|
{
|
||||||
|
GFXStateBlockDesc desc;
|
||||||
|
desc.setCullMode(GFXCullNone);
|
||||||
|
desc.setFillModeSolid();
|
||||||
|
desc.setZReadWrite(true, false);
|
||||||
|
desc.setBlend(true);
|
||||||
|
GFX->getDrawUtil()->drawCube(desc, box, ColorI(col, 20));
|
||||||
|
desc.setFillModeWireframe();
|
||||||
|
desc.setBlend(false);
|
||||||
|
GFX->getDrawUtil()->drawCube(desc, box, ColorI(col, 255));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NavMeshSelectTool::NavMeshSelectTool()
|
||||||
|
{
|
||||||
|
mCurMesh = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NavMeshSelectTool::onActivated(const Gui3DMouseEvent& evt)
|
||||||
|
{
|
||||||
|
Con::executef(this, "onActivated");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NavMeshSelectTool::onDeactivated()
|
||||||
|
{
|
||||||
|
Con::executef(this, "onDeactivated");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NavMeshSelectTool::on3DMouseDown(const Gui3DMouseEvent& evt)
|
||||||
|
{
|
||||||
|
if (mCurEditor.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Point3F startPnt = evt.pos;
|
||||||
|
Point3F endPnt = evt.pos + evt.vec * 1000.0f;
|
||||||
|
|
||||||
|
RayInfo ri;
|
||||||
|
if (gServerContainer.castRay(startPnt, endPnt, MarkerObjectType, &ri))
|
||||||
|
{
|
||||||
|
if (!ri.object)
|
||||||
|
return;
|
||||||
|
|
||||||
|
NavMesh* selNavMesh = dynamic_cast<NavMesh*>(ri.object);
|
||||||
|
if (selNavMesh)
|
||||||
|
{
|
||||||
|
mCurEditor->selectMesh(selNavMesh);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void NavMeshSelectTool::on3DMouseMove(const Gui3DMouseEvent& evt)
|
||||||
|
{
|
||||||
|
if (mCurEditor.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Point3F startPnt = evt.pos;
|
||||||
|
Point3F endPnt = evt.pos + evt.vec * 1000.0f;
|
||||||
|
|
||||||
|
RayInfo ri;
|
||||||
|
if (gServerContainer.castRay(startPnt, endPnt, MarkerObjectType, &ri))
|
||||||
|
{
|
||||||
|
NavMesh* selNavMesh = dynamic_cast<NavMesh*>(ri.object);
|
||||||
|
if (selNavMesh)
|
||||||
|
{
|
||||||
|
mCurMesh = selNavMesh;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurMesh = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurMesh = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NavMeshSelectTool::onRender3D()
|
||||||
|
{
|
||||||
|
if (!mCurMesh.isNull())
|
||||||
|
renderBoxOutline(mCurMesh->getWorldBox(), ColorI::LIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NavMeshSelectTool::updateGuiInfo()
|
||||||
|
{
|
||||||
|
SimObject* statusbar;
|
||||||
|
Sim::findObject("EditorGuiStatusBar", statusbar);
|
||||||
|
|
||||||
|
GuiTextCtrl* selectionBar;
|
||||||
|
Sim::findObject("EWorldEditorStatusBarSelection", selectionBar);
|
||||||
|
|
||||||
|
String text;
|
||||||
|
|
||||||
|
if (statusbar)
|
||||||
|
Con::executef(statusbar, "setInfo", text.c_str());
|
||||||
|
|
||||||
|
if (selectionBar)
|
||||||
|
selectionBar->setText(text);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
30
Engine/source/navigation/navMeshTools/navMeshSelectTool.h
Normal file
30
Engine/source/navigation/navMeshTools/navMeshSelectTool.h
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef _NAVMESHSELECTTOOL_H_
|
||||||
|
#define _NAVMESHSELECTTOOL_H_
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _NAVMESH_TOOL_H_
|
||||||
|
#include "navigation/navMeshTool.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class NavMeshSelectTool : public NavMeshTool
|
||||||
|
{
|
||||||
|
typedef NavMeshTool Parent;
|
||||||
|
protected:
|
||||||
|
SimObjectPtr<NavMesh> mCurMesh;
|
||||||
|
public:
|
||||||
|
DECLARE_CONOBJECT(NavMeshSelectTool);
|
||||||
|
|
||||||
|
NavMeshSelectTool();
|
||||||
|
virtual ~NavMeshSelectTool() {}
|
||||||
|
|
||||||
|
void onActivated(const Gui3DMouseEvent& evt) override;
|
||||||
|
void onDeactivated() override;
|
||||||
|
|
||||||
|
void on3DMouseDown(const Gui3DMouseEvent& evt) override;
|
||||||
|
void on3DMouseMove(const Gui3DMouseEvent& evt) override;
|
||||||
|
void onRender3D() override;
|
||||||
|
|
||||||
|
bool updateGuiInfo() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -367,6 +367,9 @@ bool NavMeshTestTool::updateGuiInfo()
|
||||||
if (mSpawnClass != String::EmptyString && mSpawnDatablock != String::EmptyString)
|
if (mSpawnClass != String::EmptyString && mSpawnDatablock != String::EmptyString)
|
||||||
text += " CTRL+LMB To spawn a new Bot.";
|
text += " CTRL+LMB To spawn a new Bot.";
|
||||||
|
|
||||||
|
if (mSelectFollow)
|
||||||
|
text = "LMB To select Follow Target.";
|
||||||
|
|
||||||
if (statusbar)
|
if (statusbar)
|
||||||
Con::executef(statusbar, "setInfo", text.c_str());
|
Con::executef(statusbar, "setInfo", text.c_str());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -491,8 +491,8 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
||||||
HorizSizing = "right";
|
HorizSizing = "right";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
Extent = "90 18";
|
Extent = "90 18";
|
||||||
text = "Find cover";
|
text = "Stop";
|
||||||
command = "NavMeshTools->TestTool.findCover();";
|
command = "NavMeshTools->TestTool.stop();";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiControl() {
|
new GuiControl() {
|
||||||
|
|
@ -515,8 +515,8 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
||||||
HorizSizing = "right";
|
HorizSizing = "right";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
Extent = "90 18";
|
Extent = "90 18";
|
||||||
text = "Stop";
|
text = "Find cover";
|
||||||
command = "NavMeshTools->TestTool.stop();";
|
command = "NavMeshTools->TestTool.findCover();";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiControl() {
|
new GuiControl() {
|
||||||
|
|
@ -532,6 +532,23 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
||||||
text = "Toggle Follow";
|
text = "Toggle Follow";
|
||||||
command = "NavMeshTools->TestTool.toggleFollow();";
|
command = "NavMeshTools->TestTool.toggleFollow();";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
new GuiTextEditSliderCtrl(CoverRadius) {
|
||||||
|
position = "100 0";
|
||||||
|
extent = "90 18";
|
||||||
|
format = "%3.2f";
|
||||||
|
range = "0 1e+03";
|
||||||
|
increment = "0.1";
|
||||||
|
focusOnMouseWheel = "0";
|
||||||
|
historySize = "0";
|
||||||
|
password = "0";
|
||||||
|
tabComplete = "0";
|
||||||
|
sinkAllKeyEvents = "0";
|
||||||
|
hovertime = "1000";
|
||||||
|
profile = "ToolsGuiTextEditProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
toolTip = "The radius to search for cover";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -815,67 +832,6 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
||||||
variable = "$Nav::Editor::renderVoxels";
|
variable = "$Nav::Editor::renderVoxels";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiStackControl() {
|
|
||||||
internalName = "TestProperties";
|
|
||||||
position = "7 21";
|
|
||||||
extent = "186 64";
|
|
||||||
padding = "2 2 2 2";
|
|
||||||
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Cover";
|
|
||||||
profile = "ToolsGuiTextProfile";
|
|
||||||
extent = "180 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
visible = "1";
|
|
||||||
};
|
|
||||||
new GuiTextEditCtrl() {
|
|
||||||
internalName = "CoverRadius";
|
|
||||||
text = "10";
|
|
||||||
profile = "ToolsGuiTextEditProfile";
|
|
||||||
extent = "40 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
visible = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
toolTip = "Radius for cover-finding.";
|
|
||||||
};
|
|
||||||
new GuiTextEditCtrl() {
|
|
||||||
internalName = "CoverPosition";
|
|
||||||
text = "LocalClientConnection.getControlObject().getPosition();";
|
|
||||||
profile = "ToolsGuiTextEditProfile";
|
|
||||||
extent = "140 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
visible = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
toolTip = "Position to find cover from.";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Follow";
|
|
||||||
profile = "ToolsuiTextProfile";
|
|
||||||
extent = "180 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
visible = "1";
|
|
||||||
};
|
|
||||||
new GuiTextEditCtrl() {
|
|
||||||
internalName = "FollowRadius";
|
|
||||||
text = "1";
|
|
||||||
profile = "ToolsGuiTextEditProfile";
|
|
||||||
extent = "40 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
visible = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
toolTip = "Radius for following.";
|
|
||||||
};
|
|
||||||
new GuiTextEditCtrl() {
|
|
||||||
internalName = "FollowObject";
|
|
||||||
text = "LocalClientConnection.player";
|
|
||||||
profile = "ToolsGuiTextEditProfile";
|
|
||||||
extent = "140 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
visible = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
toolTip = "Object to follow.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
new GuiMLTextCtrl(NavFieldInfoControl) {
|
new GuiMLTextCtrl(NavFieldInfoControl) {
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,13 @@ function initializeNavEditor()
|
||||||
|
|
||||||
new SimSet(NavMeshTools)
|
new SimSet(NavMeshTools)
|
||||||
{
|
{
|
||||||
|
new NavMeshSelectTool()
|
||||||
|
{
|
||||||
|
internalName = "SelectTool";
|
||||||
|
toolTip = "Edit NavMesh";
|
||||||
|
buttonImage = "ToolsModule:visibility_toggle_n_image";
|
||||||
|
};
|
||||||
|
|
||||||
new OffMeshConnectionTool()
|
new OffMeshConnectionTool()
|
||||||
{
|
{
|
||||||
internalName = "LinkTool";
|
internalName = "LinkTool";
|
||||||
|
|
@ -143,12 +150,11 @@ function EditorGui::SetNavPalletBar()
|
||||||
|
|
||||||
//Adds a button to the pallete stack
|
//Adds a button to the pallete stack
|
||||||
//Name Icon Click Command Tooltip text Keybind
|
//Name Icon Click Command Tooltip text Keybind
|
||||||
EWToolsPaletteWindow.addButton("ViewNavMesh", "ToolsModule:visibility_toggle_n_image", "NavEditorGui.prepSelectionMode();", "", "View NavMesh", "1");
|
EWToolsPaletteWindow.addButton("EditMode", "ToolsModule:visibility_toggle_n_image", "NavEditorGui.setActiveTool(NavMeshTools->SelectTool);", "", "Edit NavMesh", "1");
|
||||||
EWToolsPaletteWindow.addButton("LinkMode", "ToolsModule:nav_link_n_image", "NavEditorGui.setActiveTool(NavMeshTools->LinkTool);", "", "Create off-mesh links", "2");
|
EWToolsPaletteWindow.addButton("LinkMode", "ToolsModule:nav_link_n_image", "NavEditorGui.setActiveTool(NavMeshTools->LinkTool);", "", "Create off-mesh links", "2");
|
||||||
// EWToolsPaletteWindow.addButton("CoverMode", "ToolsModule:nav_cover_n_image", "NavEditorGui.setMode(\"CoverMode\");", "","Edit cover", "3");
|
// EWToolsPaletteWindow.addButton("CoverMode", "ToolsModule:nav_cover_n_image", "NavEditorGui.setMode(\"CoverMode\");", "","Edit cover", "3");
|
||||||
// EWToolsPaletteWindow.addButton("TileMode", "ToolsModule:select_bounds_n_image", "NavEditorGui.setMode(\"TileMode\");", "", "View tiles", "4");
|
EWToolsPaletteWindow.addButton("TileMode", "ToolsModule:select_bounds_n_image", "NavEditorGui.setActiveTool(NavMeshTools->TileTool);" , "", "View and Edit Tiles", "4");
|
||||||
EWToolsPaletteWindow.addButton("TestMode", "ToolsModule:3rd_person_camera_n_image", "NavEditorGui.setActiveTool(NavMeshTools->TestTool);", "", "Test pathfinding", "5");
|
EWToolsPaletteWindow.addButton("TestMode", "ToolsModule:3rd_person_camera_n_image", "NavEditorGui.setActiveTool(NavMeshTools->TestTool);", "", "Test pathfinding", "5");
|
||||||
EWToolsPaletteWindow.addButton("TileMode", "ToolsModule:select_bounds_n_image", "NavEditorGui.setActiveTool(NavMeshTools->TileTool);" , "", "View and Edit Tiles", "4");
|
|
||||||
EWToolsPaletteWindow.refresh();
|
EWToolsPaletteWindow.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,7 +166,22 @@ function NavEditorPlugin::onActivated(%this)
|
||||||
$Nav::EditorOpen = true;
|
$Nav::EditorOpen = true;
|
||||||
|
|
||||||
// Start off in Select mode.
|
// Start off in Select mode.
|
||||||
ToolsPaletteArray->NavEditorSelectMode.performClick();
|
// Callback when the nav editor changes mode. Set the appropriate dynamic
|
||||||
|
// GUI contents in the properties/actions boxes.
|
||||||
|
NavInspector.setVisible(false);
|
||||||
|
|
||||||
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
|
%actions->SelectActions.setVisible(false);
|
||||||
|
%actions->LinkActions.setVisible(false);
|
||||||
|
%actions->CoverActions.setVisible(false);
|
||||||
|
%actions->TileActions.setVisible(false);
|
||||||
|
%actions->TestActions.setVisible(false);
|
||||||
|
|
||||||
|
%properties = NavEditorOptionsWindow->PropertiesBox;
|
||||||
|
%properties->LinkProperties.setVisible(false);
|
||||||
|
%properties->TileProperties.setVisible(false);
|
||||||
|
|
||||||
|
ENavEditorSelectModeBtn.performClick();
|
||||||
EditorGui.bringToFront(NavEditorGui);
|
EditorGui.bringToFront(NavEditorGui);
|
||||||
|
|
||||||
NavEditorGui.setVisible(true);
|
NavEditorGui.setVisible(true);
|
||||||
|
|
|
||||||
|
|
@ -296,23 +296,37 @@ function NavEditorGui::showSidePanel()
|
||||||
%parent.panelHidden = false;
|
%parent.panelHidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
// NAVMESHTESTTOOL
|
||||||
|
//------------------------------------------------------
|
||||||
|
|
||||||
|
function NavMeshSelectTool::onActivated(%this)
|
||||||
|
{
|
||||||
|
NavInspector.setVisible(false);
|
||||||
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
|
NavInspector.setVisible(true);
|
||||||
|
%actions->SelectActions.setVisible(true);
|
||||||
|
|
||||||
|
NavInspector.inspect(NavEditorGui.getMesh());
|
||||||
|
}
|
||||||
|
|
||||||
|
function NavMeshSelectTool::onDeactivated(%this)
|
||||||
|
{
|
||||||
|
NavInspector.setVisible(false);
|
||||||
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
|
%actions->SelectActions.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------
|
||||||
|
// OffMeshConnectionTool
|
||||||
|
//------------------------------------------------------
|
||||||
|
|
||||||
function OffMeshConnectionTool::onActivated(%this)
|
function OffMeshConnectionTool::onActivated(%this)
|
||||||
{
|
{
|
||||||
NavInspector.setVisible(false);
|
NavInspector.setVisible(false);
|
||||||
|
|
||||||
%actions = NavEditorOptionsWindow->ActionsBox;
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
%actions->SelectActions.setVisible(false);
|
|
||||||
%actions->LinkActions.setVisible(false);
|
|
||||||
%actions->CoverActions.setVisible(false);
|
|
||||||
%actions->TileActions.setVisible(false);
|
|
||||||
%actions->TestActions.setVisible(false);
|
|
||||||
|
|
||||||
%properties = NavEditorOptionsWindow->PropertiesBox;
|
%properties = NavEditorOptionsWindow->PropertiesBox;
|
||||||
%properties->LinkProperties.setVisible(false);
|
|
||||||
%properties->TileProperties.setVisible(false);
|
|
||||||
%properties->TestProperties.setVisible(false);
|
|
||||||
|
|
||||||
%actions->LinkActions.setVisible(true);
|
%actions->LinkActions.setVisible(true);
|
||||||
%properties->LinkProperties.setVisible(true);
|
%properties->LinkProperties.setVisible(true);
|
||||||
|
|
@ -323,16 +337,9 @@ function OffMeshConnectionTool::onDeactivated(%this)
|
||||||
NavInspector.setVisible(false);
|
NavInspector.setVisible(false);
|
||||||
|
|
||||||
%actions = NavEditorOptionsWindow->ActionsBox;
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
%actions->SelectActions.setVisible(false);
|
|
||||||
%actions->LinkActions.setVisible(false);
|
%actions->LinkActions.setVisible(false);
|
||||||
%actions->CoverActions.setVisible(false);
|
|
||||||
%actions->TileActions.setVisible(false);
|
|
||||||
%actions->TestActions.setVisible(false);
|
|
||||||
|
|
||||||
%properties = NavEditorOptionsWindow->PropertiesBox;
|
%properties = NavEditorOptionsWindow->PropertiesBox;
|
||||||
%properties->LinkProperties.setVisible(false);
|
%properties->LinkProperties.setVisible(false);
|
||||||
%properties->TileProperties.setVisible(false);
|
|
||||||
%properties->TestProperties.setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function OffMeshConnectionTool::updateLinkFlags(%this)
|
function OffMeshConnectionTool::updateLinkFlags(%this)
|
||||||
|
|
@ -409,6 +416,8 @@ function NavMeshLinkBiDirection::onClick(%this)
|
||||||
NavMeshTools->LinkTool.updateLinkFlags();
|
NavMeshTools->LinkTool.updateLinkFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------
|
||||||
|
// NAVMESHTESTTOOL
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
function NavMeshTestTool::onActivated(%this)
|
function NavMeshTestTool::onActivated(%this)
|
||||||
|
|
@ -416,19 +425,7 @@ function NavMeshTestTool::onActivated(%this)
|
||||||
NavInspector.setVisible(false);
|
NavInspector.setVisible(false);
|
||||||
|
|
||||||
%actions = NavEditorOptionsWindow->ActionsBox;
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
%actions->SelectActions.setVisible(false);
|
|
||||||
%actions->LinkActions.setVisible(false);
|
|
||||||
%actions->CoverActions.setVisible(false);
|
|
||||||
%actions->TileActions.setVisible(false);
|
|
||||||
%actions->TestActions.setVisible(false);
|
|
||||||
|
|
||||||
%properties = NavEditorOptionsWindow->PropertiesBox;
|
|
||||||
%properties->LinkProperties.setVisible(false);
|
|
||||||
%properties->TileProperties.setVisible(false);
|
|
||||||
%properties->TestProperties.setVisible(false);
|
|
||||||
|
|
||||||
%actions->TestActions.setVisible(true);
|
%actions->TestActions.setVisible(true);
|
||||||
%properties->TestProperties.setVisible(false);
|
|
||||||
|
|
||||||
%classList = enumerateConsoleClasses("Player") TAB enumerateConsoleClasses("Vehicle");
|
%classList = enumerateConsoleClasses("Player") TAB enumerateConsoleClasses("Vehicle");
|
||||||
//echo(%classList);
|
//echo(%classList);
|
||||||
|
|
@ -448,16 +445,7 @@ function NavMeshTestTool::onDeactivated(%this)
|
||||||
NavInspector.setVisible(false);
|
NavInspector.setVisible(false);
|
||||||
|
|
||||||
%actions = NavEditorOptionsWindow->ActionsBox;
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
%actions->SelectActions.setVisible(false);
|
|
||||||
%actions->LinkActions.setVisible(false);
|
|
||||||
%actions->CoverActions.setVisible(false);
|
|
||||||
%actions->TileActions.setVisible(false);
|
|
||||||
%actions->TestActions.setVisible(false);
|
%actions->TestActions.setVisible(false);
|
||||||
|
|
||||||
%properties = NavEditorOptionsWindow->PropertiesBox;
|
|
||||||
%properties->LinkProperties.setVisible(false);
|
|
||||||
%properties->TileProperties.setVisible(false);
|
|
||||||
%properties->TestProperties.setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function NavMeshTestTool::onPlayerSelected(%this)
|
function NavMeshTestTool::onPlayerSelected(%this)
|
||||||
|
|
@ -503,10 +491,11 @@ function NavMeshTestTool::toggleFollow(%this)
|
||||||
|
|
||||||
if(isObject(%this.getFollowObject()) && isObject(%this.getPlayer()))
|
if(isObject(%this.getFollowObject()) && isObject(%this.getPlayer()))
|
||||||
{
|
{
|
||||||
if(%this.getPlayer().isMemberOfClass("AIPlayer"))
|
%player = %this.getPlayer();
|
||||||
%this.getPlayer().followObject(%this.getFollowObject(), "2.0");
|
if(%player.isMemberOfClass("AIPlayer"))
|
||||||
|
%player.followObject(%this.getFollowObject(), "2.0");
|
||||||
else
|
else
|
||||||
%this.getPlayer().getAIController().followObject(%this.getFollowObject(), %this.getPlayer().getDatablock().aiControllerData.mFollowTolerance);
|
%player.getAIController().followObject(%this.getFollowObject(), %player.getDatablock().aiControllerData.mFollowTolerance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -515,6 +504,20 @@ function NavMeshTestTool::followObject(%this)
|
||||||
%this.followSelectMode();
|
%this.followSelectMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function NavMeshTestTool::findCover(%this)
|
||||||
|
{
|
||||||
|
if(isObject(%this.getPlayer()))
|
||||||
|
{
|
||||||
|
%player = %this.getPlayer();
|
||||||
|
%pos = %player.getPosition();
|
||||||
|
|
||||||
|
if(%player.isMemberOfClass("AIPlayer"))
|
||||||
|
%player.findCover(%pos, CoverRadius.getText());
|
||||||
|
else
|
||||||
|
%player.getAIController().findCover(%pos, CoverRadius.getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function SpawnClassSelector::onSelect(%this, %id)
|
function SpawnClassSelector::onSelect(%this, %id)
|
||||||
{
|
{
|
||||||
%className = %this.getTextById(%id);
|
%className = %this.getTextById(%id);
|
||||||
|
|
@ -546,40 +549,8 @@ function SpawnDatablockSelector::onSelect(%this, %id)
|
||||||
NavMeshTools->TestTool.setSpawnDatablock(%className);
|
NavMeshTools->TestTool.setSpawnDatablock(%className);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------
|
||||||
// function NavEditorGui::findCover(%this)
|
// TILETOOL
|
||||||
// {
|
|
||||||
// if(%this.getMode() $= "TestMode" && isObject(%this.getPlayer()))
|
|
||||||
// {
|
|
||||||
// %pos = LocalClientConnection.getControlObject().getPosition();
|
|
||||||
// %text = NavEditorOptionsWindow-->TestProperties->CoverPosition.getText();
|
|
||||||
// if(%text !$= "")
|
|
||||||
// %pos = eval("return " @ %text);
|
|
||||||
// %this.getPlayer().getAIController().findCover(%pos, NavEditorOptionsWindow-->TestProperties->CoverRadius.getText());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function NavEditorGui::followObject(%this)
|
|
||||||
// {
|
|
||||||
// if(%this.getMode() $= "TestMode" && isObject(%this.getPlayer()))
|
|
||||||
// {
|
|
||||||
// %obj = LocalClientConnection.player;
|
|
||||||
// %text = NavEditorOptionsWindow-->TestProperties->FollowObject.getText();
|
|
||||||
// if(%text !$= "")
|
|
||||||
// {
|
|
||||||
// %command = "return " @ %text;
|
|
||||||
// if(!endsWith(%command, ";"))
|
|
||||||
// %command = %command @ ";";
|
|
||||||
|
|
||||||
// %obj = eval(%command);
|
|
||||||
// if(!isObject(%obj))
|
|
||||||
// toolsMessageBoxOk("Error", "Cannot find object" SPC %text);
|
|
||||||
// }
|
|
||||||
// if(isObject(%obj))
|
|
||||||
// %this.getPlayer().getAIController().followObject(%obj, NavEditorOptionsWindow-->TestProperties->FollowRadius.getText());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
function TileTool::onActivated(%this)
|
function TileTool::onActivated(%this)
|
||||||
|
|
@ -587,17 +558,7 @@ function TileTool::onActivated(%this)
|
||||||
NavInspector.setVisible(false);
|
NavInspector.setVisible(false);
|
||||||
|
|
||||||
%actions = NavEditorOptionsWindow->ActionsBox;
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
%actions->SelectActions.setVisible(false);
|
|
||||||
%actions->LinkActions.setVisible(false);
|
|
||||||
%actions->CoverActions.setVisible(false);
|
|
||||||
%actions->TileActions.setVisible(false);
|
|
||||||
%actions->TestActions.setVisible(false);
|
|
||||||
|
|
||||||
%properties = NavEditorOptionsWindow->PropertiesBox;
|
%properties = NavEditorOptionsWindow->PropertiesBox;
|
||||||
%properties->LinkProperties.setVisible(false);
|
|
||||||
%properties->TileProperties.setVisible(false);
|
|
||||||
%properties->TestProperties.setVisible(false);
|
|
||||||
|
|
||||||
%actions->TileActions.setVisible(true);
|
%actions->TileActions.setVisible(true);
|
||||||
%properties->TileProperties.setVisible(true);
|
%properties->TileProperties.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
@ -607,16 +568,9 @@ function TileTool::onDeactivated(%this)
|
||||||
NavInspector.setVisible(false);
|
NavInspector.setVisible(false);
|
||||||
|
|
||||||
%actions = NavEditorOptionsWindow->ActionsBox;
|
%actions = NavEditorOptionsWindow->ActionsBox;
|
||||||
%actions->SelectActions.setVisible(false);
|
|
||||||
%actions->LinkActions.setVisible(false);
|
|
||||||
%actions->CoverActions.setVisible(false);
|
|
||||||
%actions->TileActions.setVisible(false);
|
%actions->TileActions.setVisible(false);
|
||||||
%actions->TestActions.setVisible(false);
|
|
||||||
|
|
||||||
%properties = NavEditorOptionsWindow->PropertiesBox;
|
%properties = NavEditorOptionsWindow->PropertiesBox;
|
||||||
%properties->LinkProperties.setVisible(false);
|
|
||||||
%properties->TileProperties.setVisible(false);
|
%properties->TileProperties.setVisible(false);
|
||||||
%properties->TestProperties.setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
@ -659,14 +613,6 @@ function NavEditorGui::onModeSet(%this, %mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function NavEditorGui::paletteSync(%this, %mode)
|
|
||||||
{
|
|
||||||
// Synchronise the palette (small buttons on the left) with the actual mode
|
|
||||||
// the nav editor is in.
|
|
||||||
%evalShortcut = "ToolsPaletteArray-->" @ %mode @ ".setStateOn(1);";
|
|
||||||
eval(%evalShortcut);
|
|
||||||
}
|
|
||||||
|
|
||||||
function NavEditorGui::onEscapePressed(%this)
|
function NavEditorGui::onEscapePressed(%this)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -791,8 +737,7 @@ function NavTreeView::onSelect(%this, %obj)
|
||||||
|
|
||||||
function NavEditorGui::prepSelectionMode(%this)
|
function NavEditorGui::prepSelectionMode(%this)
|
||||||
{
|
{
|
||||||
%this.setMode("SelectMode");
|
NavEditorGui.setActiveTool(NavMeshTools->SelectTool);
|
||||||
ToolsPaletteArray-->NavEditorSelectMode.setStateOn(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue