mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +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
|
|
@ -491,8 +491,8 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Extent = "90 18";
|
||||
text = "Find cover";
|
||||
command = "NavMeshTools->TestTool.findCover();";
|
||||
text = "Stop";
|
||||
command = "NavMeshTools->TestTool.stop();";
|
||||
};
|
||||
};
|
||||
new GuiControl() {
|
||||
|
|
@ -515,8 +515,8 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Extent = "90 18";
|
||||
text = "Stop";
|
||||
command = "NavMeshTools->TestTool.stop();";
|
||||
text = "Find cover";
|
||||
command = "NavMeshTools->TestTool.findCover();";
|
||||
};
|
||||
};
|
||||
new GuiControl() {
|
||||
|
|
@ -532,6 +532,23 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
text = "Toggle Follow";
|
||||
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";
|
||||
};
|
||||
};
|
||||
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) {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
|
|||
|
|
@ -59,6 +59,13 @@ function initializeNavEditor()
|
|||
|
||||
new SimSet(NavMeshTools)
|
||||
{
|
||||
new NavMeshSelectTool()
|
||||
{
|
||||
internalName = "SelectTool";
|
||||
toolTip = "Edit NavMesh";
|
||||
buttonImage = "ToolsModule:visibility_toggle_n_image";
|
||||
};
|
||||
|
||||
new OffMeshConnectionTool()
|
||||
{
|
||||
internalName = "LinkTool";
|
||||
|
|
@ -143,12 +150,11 @@ function EditorGui::SetNavPalletBar()
|
|||
|
||||
//Adds a button to the pallete stack
|
||||
//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("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("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.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.refresh();
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +166,22 @@ function NavEditorPlugin::onActivated(%this)
|
|||
$Nav::EditorOpen = true;
|
||||
|
||||
// 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);
|
||||
|
||||
NavEditorGui.setVisible(true);
|
||||
|
|
|
|||
|
|
@ -296,23 +296,37 @@ function NavEditorGui::showSidePanel()
|
|||
%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)
|
||||
{
|
||||
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);
|
||||
%properties->TestProperties.setVisible(false);
|
||||
|
||||
%actions->LinkActions.setVisible(true);
|
||||
%properties->LinkProperties.setVisible(true);
|
||||
|
|
@ -323,16 +337,9 @@ function OffMeshConnectionTool::onDeactivated(%this)
|
|||
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);
|
||||
%properties->TestProperties.setVisible(false);
|
||||
}
|
||||
|
||||
function OffMeshConnectionTool::updateLinkFlags(%this)
|
||||
|
|
@ -409,6 +416,8 @@ function NavMeshLinkBiDirection::onClick(%this)
|
|||
NavMeshTools->LinkTool.updateLinkFlags();
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// NAVMESHTESTTOOL
|
||||
//------------------------------------------------------
|
||||
|
||||
function NavMeshTestTool::onActivated(%this)
|
||||
|
|
@ -416,19 +425,7 @@ function NavMeshTestTool::onActivated(%this)
|
|||
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);
|
||||
%properties->TestProperties.setVisible(false);
|
||||
|
||||
%actions->TestActions.setVisible(true);
|
||||
%properties->TestProperties.setVisible(false);
|
||||
|
||||
%classList = enumerateConsoleClasses("Player") TAB enumerateConsoleClasses("Vehicle");
|
||||
//echo(%classList);
|
||||
|
|
@ -448,16 +445,7 @@ function NavMeshTestTool::onDeactivated(%this)
|
|||
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);
|
||||
%properties->TestProperties.setVisible(false);
|
||||
}
|
||||
|
||||
function NavMeshTestTool::onPlayerSelected(%this)
|
||||
|
|
@ -503,10 +491,11 @@ function NavMeshTestTool::toggleFollow(%this)
|
|||
|
||||
if(isObject(%this.getFollowObject()) && isObject(%this.getPlayer()))
|
||||
{
|
||||
if(%this.getPlayer().isMemberOfClass("AIPlayer"))
|
||||
%this.getPlayer().followObject(%this.getFollowObject(), "2.0");
|
||||
%player = %this.getPlayer();
|
||||
if(%player.isMemberOfClass("AIPlayer"))
|
||||
%player.followObject(%this.getFollowObject(), "2.0");
|
||||
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();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
%className = %this.getTextById(%id);
|
||||
|
|
@ -546,40 +549,8 @@ function SpawnDatablockSelector::onSelect(%this, %id)
|
|||
NavMeshTools->TestTool.setSpawnDatablock(%className);
|
||||
}
|
||||
|
||||
|
||||
// function NavEditorGui::findCover(%this)
|
||||
// {
|
||||
// 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());
|
||||
// }
|
||||
// }
|
||||
|
||||
//------------------------------------------------------
|
||||
// TILETOOL
|
||||
//------------------------------------------------------
|
||||
|
||||
function TileTool::onActivated(%this)
|
||||
|
|
@ -587,17 +558,7 @@ function TileTool::onActivated(%this)
|
|||
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);
|
||||
%properties->TestProperties.setVisible(false);
|
||||
|
||||
%actions->TileActions.setVisible(true);
|
||||
%properties->TileProperties.setVisible(true);
|
||||
}
|
||||
|
|
@ -607,16 +568,9 @@ function TileTool::onDeactivated(%this)
|
|||
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);
|
||||
%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)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -791,8 +737,7 @@ function NavTreeView::onSelect(%this, %obj)
|
|||
|
||||
function NavEditorGui::prepSelectionMode(%this)
|
||||
{
|
||||
%this.setMode("SelectMode");
|
||||
ToolsPaletteArray-->NavEditorSelectMode.setStateOn(1);
|
||||
NavEditorGui.setActiveTool(NavMeshTools->SelectTool);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue