PATH-711: Implementing Leo's changes for the pathfinding console.

master
Todd Stinson 2012-06-11 16:40:53 -07:00
parent a087c4dfbb
commit b912c27bf4
11 changed files with 47 additions and 262 deletions

View File

@ -64,9 +64,6 @@
#define XUI_CHARACTER_TYPE_C 3
#define XUI_CHARACTER_TYPE_D 4
#define XUI_EDIT_TAB_INDEX 0
#define XUI_TEST_TAB_INDEX 1
#define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type)
#define CONTROL_NAME_RETRIEVE_NEIGHBOR "RetrieveNeighboringRegion"
@ -138,37 +135,9 @@ BOOL LLFloaterPathfindingConsole::postBuild()
llassert(mViewCharactersButton != NULL);
mViewCharactersButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewCharactersClicked, this));
mEditTestTabContainer = findChild<LLTabContainer>("edit_test_tab_container");
llassert(mEditTestTabContainer != NULL);
mEditTestTabContainer->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onTabSwitch, this));
mEditTab = findChild<LLPanel>("edit_panel");
llassert(mEditTab != NULL);
mTestTab = findChild<LLPanel>("test_panel");
llassert(mTestTab != NULL);
mUnfreezeLabel = findChild<LLTextBase>("unfreeze_label");
llassert(mUnfreezeLabel != NULL);
mUnfreezeButton = findChild<LLButton>("enter_unfrozen_mode");
llassert(mUnfreezeButton != NULL);
mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onUnfreezeClicked, this));
mLinksetsLabel = findChild<LLTextBase>("edit_linksets_label");
llassert(mLinksetsLabel != NULL);
mLinksetsButton = findChild<LLButton>("view_and_edit_linksets");
llassert(mLinksetsButton != NULL);
mLinksetsButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onViewEditLinksetClicked, this));
mFreezeLabel = findChild<LLTextBase>("freeze_label");
llassert(mFreezeLabel != NULL);
mFreezeButton = findChild<LLButton>("enter_frozen_mode");
llassert(mFreezeButton != NULL);
mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onFreezeClicked, this));
mPathfindingViewerStatus = findChild<LLTextBase>("pathfinding_viewer_status");
llassert(mPathfindingViewerStatus != NULL);
@ -205,11 +174,6 @@ BOOL LLFloaterPathfindingConsole::postBuild()
llassert(mClearPathButton != NULL);
mClearPathButton->setCommitCallback(boost::bind(&LLFloaterPathfindingConsole::onClearPathClicked, this));
if (LLPathingLib::getInstance() == NULL)
{
LLPathingLib::initSystem();
}
if (LLPathingLib::getInstance() != NULL)
{
mPathfindingToolset = new LLToolset();
@ -246,11 +210,6 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey)
fillInColorsForNavMeshVisualization();
}
if (!mAgentStateSlot.connected())
{
mAgentStateSlot = LLPathfindingManager::getInstance()->registerAgentStateListener(boost::bind(&LLFloaterPathfindingConsole::onAgentStateCB, this, _1));
}
if (!mRegionBoundarySlot.connected())
{
mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingConsole::onRegionBoundaryCross, this));
@ -266,14 +225,10 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey)
mPathEventSlot = LLPathfindingPathTool::getInstance()->registerPathEventListener(boost::bind(&LLFloaterPathfindingConsole::onPathEvent, this));
}
setAgentState(LLPathfindingManager::getInstance()->getAgentState());
setDefaultInputs();
updatePathTestStatus();
if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX)
{
switchIntoTestPathMode();
}
switchIntoTestPathMode();
}
void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting)
@ -295,11 +250,6 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting)
mRegionBoundarySlot.disconnect();
}
if (mAgentStateSlot.connected())
{
mAgentStateSlot.disconnect();
}
if (mNavMeshZoneSlot.connected())
{
mNavMeshZoneSlot.disconnect();
@ -501,15 +451,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
mPathfindingViewerStatus(NULL),
mPathfindingSimulatorStatus(NULL),
mViewCharactersButton(NULL),
mEditTestTabContainer(NULL),
mEditTab(NULL),
mTestTab(NULL),
mUnfreezeLabel(NULL),
mUnfreezeButton(NULL),
mLinksetsLabel(NULL),
mLinksetsButton(NULL),
mFreezeLabel(NULL),
mFreezeButton(NULL),
mCtrlClickLabel(),
mShiftClickLabel(),
mCharacterWidthLabel(),
@ -522,7 +464,6 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
mNavMeshZoneSlot(),
mNavMeshZone(),
mIsNavMeshUpdating(false),
mAgentStateSlot(),
mRegionBoundarySlot(),
mTeleportFailedSlot(),
mPathEventSlot(),
@ -577,35 +518,6 @@ void LLFloaterPathfindingConsole::onViewCharactersClicked()
LLFloaterPathfindingCharacters::openCharactersViewer();
}
void LLFloaterPathfindingConsole::onTabSwitch()
{
if (mEditTestTabContainer->getCurrentPanelIndex() == XUI_TEST_TAB_INDEX)
{
switchIntoTestPathMode();
}
else
{
switchOutOfTestPathMode();
}
}
void LLFloaterPathfindingConsole::onUnfreezeClicked()
{
mUnfreezeButton->setEnabled(FALSE);
LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateUnfrozen);
}
void LLFloaterPathfindingConsole::onFreezeClicked()
{
mFreezeButton->setEnabled(FALSE);
LLPathfindingManager::getInstance()->requestSetAgentState(LLPathfindingManager::kAgentStateFrozen);
}
void LLFloaterPathfindingConsole::onViewEditLinksetClicked()
{
LLFloaterPathfindingLinksets::openLinksetsEditor();
}
void LLFloaterPathfindingConsole::onCharacterWidthSet()
{
updateCharacterWidth();
@ -658,11 +570,6 @@ void LLFloaterPathfindingConsole::onNavMeshZoneCB(LLPathfindingNavMeshZone::ENav
}
}
void LLFloaterPathfindingConsole::onAgentStateCB(LLPathfindingManager::EAgentState pAgentState)
{
setAgentState(pAgentState);
}
void LLFloaterPathfindingConsole::onRegionBoundaryCross()
{
initializeNavMeshZoneForCurrentRegion();
@ -706,7 +613,6 @@ void LLFloaterPathfindingConsole::onPathEvent()
void LLFloaterPathfindingConsole::setDefaultInputs()
{
mEditTestTabContainer->selectTab(XUI_EDIT_TAB_INDEX);
setRenderWorld(TRUE);
setRenderNavMesh(FALSE);
setRenderWalkables(FALSE);
@ -776,7 +682,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState()
mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
mShowXRayCheckBox->setEnabled(FALSE);
mViewCharactersButton->setEnabled(FALSE);
mEditTestTabContainer->selectTab(0);
mTestTab->setEnabled(FALSE);
mCtrlClickLabel->setEnabled(FALSE);
mShiftClickLabel->setEnabled(FALSE);
@ -802,7 +707,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState()
mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
mShowXRayCheckBox->setEnabled(FALSE);
mViewCharactersButton->setEnabled(TRUE);
mEditTestTabContainer->selectTab(0);
mTestTab->setEnabled(FALSE);
mCtrlClickLabel->setEnabled(FALSE);
mShiftClickLabel->setEnabled(FALSE);
@ -830,7 +734,6 @@ void LLFloaterPathfindingConsole::updateControlsOnConsoleState()
mShowRenderWaterPlaneCheckBox->setEnabled(FALSE);
mShowXRayCheckBox->setEnabled(FALSE);
mViewCharactersButton->setEnabled(TRUE);
mEditTestTabContainer->selectTab(0);
mTestTab->setEnabled(FALSE);
mCtrlClickLabel->setEnabled(FALSE);
mShiftClickLabel->setEnabled(FALSE);
@ -1028,44 +931,6 @@ void LLFloaterPathfindingConsole::cleanupRenderableRestoreItems()
}
}
void LLFloaterPathfindingConsole::setAgentState(LLPathfindingManager::EAgentState pAgentState)
{
switch (LLPathfindingManager::getInstance()->getLastKnownNonErrorAgentState())
{
case LLPathfindingManager::kAgentStateUnknown :
case LLPathfindingManager::kAgentStateNotEnabled :
mEditTab->setEnabled(FALSE);
mUnfreezeLabel->setEnabled(FALSE);
mUnfreezeButton->setEnabled(FALSE);
mLinksetsLabel->setEnabled(FALSE);
mLinksetsButton->setEnabled(FALSE);
mFreezeLabel->setEnabled(FALSE);
mFreezeButton->setEnabled(FALSE);
break;
case LLPathfindingManager::kAgentStateFrozen :
mEditTab->setEnabled(TRUE);
mUnfreezeLabel->setEnabled(TRUE);
mUnfreezeButton->setEnabled(TRUE);
mLinksetsLabel->setEnabled(FALSE);
mLinksetsButton->setEnabled(FALSE);
mFreezeLabel->setEnabled(FALSE);
mFreezeButton->setEnabled(FALSE);
break;
case LLPathfindingManager::kAgentStateUnfrozen :
mEditTab->setEnabled(TRUE);
mUnfreezeLabel->setEnabled(FALSE);
mUnfreezeButton->setEnabled(FALSE);
mLinksetsLabel->setEnabled(TRUE);
mLinksetsButton->setEnabled(TRUE);
mFreezeLabel->setEnabled(TRUE);
mFreezeButton->setEnabled(TRUE);
break;
default :
llassert(0);
break;
}
}
void LLFloaterPathfindingConsole::switchIntoTestPathMode()
{
if (LLPathingLib::getInstance() != NULL)

View File

@ -31,7 +31,6 @@
#include "llfloater.h"
#include "llhandle.h"
#include "llpathinglib.h"
#include "llpathfindingmanager.h"
#include "llpathfindingnavmeshzone.h"
#include "llpathfindingpathtool.h"
@ -43,7 +42,6 @@ class LLSliderCtrl;
class LLLineEditor;
class LLTextBase;
class LLCheckBoxCtrl;
class LLTabContainer;
class LLComboBox;
class LLButton;
class LLToolset;
@ -120,16 +118,11 @@ private:
void onShowNavMeshSet();
void onShowWalkabilitySet();
void onViewCharactersClicked();
void onTabSwitch();
void onUnfreezeClicked();
void onFreezeClicked();
void onViewEditLinksetClicked();
void onCharacterWidthSet();
void onCharacterTypeSwitch();
void onClearPathClicked();
void onNavMeshZoneCB(LLPathfindingNavMeshZone::ENavMeshZoneRequestStatus pNavMeshZoneRequestStatus);
void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState);
void onRegionBoundaryCross();
void onPathEvent();
@ -145,8 +138,6 @@ private:
void initializeNavMeshZoneForCurrentRegion();
void setAgentState(LLPathfindingManager::EAgentState pAgentState);
void switchIntoTestPathMode();
void switchOutOfTestPathMode();
void updateCharacterWidth();
@ -177,15 +168,7 @@ private:
LLTextBase *mPathfindingViewerStatus;
LLTextBase *mPathfindingSimulatorStatus;
LLButton *mViewCharactersButton;
LLTabContainer *mEditTestTabContainer;
LLPanel *mEditTab;
LLPanel *mTestTab;
LLTextBase *mUnfreezeLabel;
LLButton *mUnfreezeButton;
LLTextBase *mLinksetsLabel;
LLButton *mLinksetsButton;
LLTextBase *mFreezeLabel;
LLButton *mFreezeButton;
LLTextBase *mCtrlClickLabel;
LLTextBase *mShiftClickLabel;
LLTextBase *mCharacterWidthLabel;
@ -200,7 +183,6 @@ private:
LLPathfindingNavMeshZone mNavMeshZone;
bool mIsNavMeshUpdating;
LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
boost::signals2::connection mRegionBoundarySlot;
boost::signals2::connection mTeleportFailedSlot;
LLPathfindingPathTool::path_event_slot_t mPathEventSlot;

View File

@ -47,12 +47,10 @@ LLPathfindingCharacterList::LLPathfindingCharacterList()
LLPathfindingCharacterList::LLPathfindingCharacterList(const LLSD& pCharacterListData)
: LLPathfindingObjectList()
{
if ( LLPathingLib::getInstance() == NULL )
if (LLPathingLib::getInstance() != NULL)
{
LLPathingLib::initSystem();
LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals( );
}
LLPathingLib::getInstance()->cleanupPhysicsCapsuleRepResiduals( );
parseCharacterListData(pCharacterListData);
}

View File

@ -45,6 +45,7 @@
#include "llpathfindingnavmesh.h"
#include "llpathfindingnavmeshstatus.h"
#include "llpathfindingobject.h"
#include "llpathinglib.h"
#include "llsingleton.h"
#include "llsd.h"
#include "lltrans.h"
@ -273,6 +274,14 @@ LLPathfindingManager::~LLPathfindingManager()
{
}
void LLPathfindingManager::initSystem()
{
if (LLPathingLib::getInstance() == NULL)
{
LLPathingLib::initSystem();
}
}
bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const
{
return isPathfindingEnabledForRegion(getCurrentRegion());
@ -292,6 +301,11 @@ bool LLPathfindingManager::isPathfindingNavMeshVersioningEnabledForCurrentRegion
}
#endif // DEPRECATED_UNVERSIONED_NAVMESH
bool LLPathfindingManager::isPathfindingDebugEnabled() const
{
return (LLPathingLib::getInstance() != NULL);
}
bool LLPathfindingManager::isAllowViewTerrainProperties() const
{
LLViewerRegion* region = getCurrentRegion();

View File

@ -74,12 +74,16 @@ public:
LLPathfindingManager();
virtual ~LLPathfindingManager();
void initSystem();
bool isPathfindingEnabledForCurrentRegion() const;
bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const;
#ifdef DEPRECATED_UNVERSIONED_NAVMESH
bool isPathfindingNavMeshVersioningEnabledForCurrentRegionXXX() const;
#endif // DEPRECATED_UNVERSIONED_NAVMESH
bool isPathfindingDebugEnabled() const;
bool isAllowViewTerrainProperties() const;
LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback);

View File

@ -32,6 +32,7 @@
#include "lluuid.h"
#include "llpathfindingnavmesh.h"
#include "llpathfindingnavmeshstatus.h"
#include "llviewerregion.h"
#include <vector>

View File

@ -54,11 +54,6 @@ LLPathfindingPathTool::LLPathfindingPathTool()
mIsMiddleMouseButtonHeld(false),
mIsRightMouseButtonHeld(false)
{
if (!LLPathingLib::getInstance())
{
LLPathingLib::initSystem();
}
setCharacterWidth(1.0f);
setCharacterType(mCharacterType);
}

View File

@ -186,6 +186,7 @@
#include "llappearancemgr.h"
#include "llavatariconctrl.h"
#include "llvoicechannel.h"
#include "llpathfindingmanager.h"
#include "lllogin.h"
#include "llevents.h"
@ -1968,6 +1969,9 @@ bool idle_startup()
}
}
llassert(LLPathfindingManager::getInstance() != NULL);
LLPathfindingManager::getInstance()->initSystem();
display_startup();
//DEV-17797. get null folder. Any items found here moved to Lost and Found
LLInventoryModelBackgroundFetch::instance().findLostItems();

View File

@ -4802,7 +4802,15 @@ class LLToolsEnablePathfinding : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion();
return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion();
}
};
class LLToolsEnablePathfindingDebug : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
return (LLPathfindingManager::getInstance() != NULL) && LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLPathfindingManager::getInstance()->isPathfindingDebugEnabled();
}
};
@ -8201,6 +8209,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLToolsEnableSaveToObjectInventory(), "Tools.EnableSaveToObjectInventory");
view_listener_t::addMenu(new LLToolsEnablePathfinding(), "Tools.EnablePathfinding");
view_listener_t::addMenu(new LLToolsEnablePathfindingDebug(), "Tools.EnablePathfindingDebug");
// Help menu
// most items use the ShowFloater method

View File

@ -9,7 +9,7 @@
reuse_instance="true"
save_rect="true"
single_instance="true"
title="Pathfinding edit / test"
title="Pathfinding debug"
width="456">
<floater.string name="navmesh_viewer_status_unknown"></floater.string>
<floater.string name="navmesh_viewer_status_library_not_implemented">Cannot find pathing library implementation.</floater.string>
@ -233,93 +233,6 @@
top="14"
height="268"
width="218">
<panel
border="false"
bevel_style="none"
follows="left|top"
layout="topleft"
name="edit_panel"
left="1"
label="Edit">
<text
word_wrap="true"
use_ellipses="false"
type="string"
text_color="LabelTextColor"
text_readonly_color="LabelDisabledColor"
length="1"
follows="left|top"
layout="topleft"
name="unfreeze_label"
left="16"
top_pad="16"
height="13"
width="190">
Allow object / terrain changes:
</text>
<button
follows="left|top"
height="22"
left="16"
enabled="false"
label="Unfreeze"
layout="topleft"
name="enter_unfrozen_mode"
top_pad="5"
width="116"/>
<text
word_wrap="true"
use_ellipses="false"
type="string"
text_color="LabelTextColor"
text_readonly_color="LabelDisabledColor"
length="1"
follows="left|top"
layout="topleft"
left="16"
name="edit_linksets_label"
top_pad="23"
height="13"
width="190">
Edit linkset attributes:
</text>
<button
follows="left|top"
height="22"
left="16"
label="Linksets..."
layout="topleft"
name="view_and_edit_linksets"
top_pad="5"
width="116"/>
<text
word_wrap="true"
use_ellipses="false"
type="string"
text_color="LabelTextColor"
text_readonly_color="LabelDisabledColor"
length="1"
follows="left|top"
layout="topleft"
left="16"
line_spacing.multiple="1.5"
name="freeze_label"
top_pad="23"
height="32"
width="190">
Prevent object / terrain changes and update the navmesh:
</text>
<button
follows="left|top"
height="22"
left="16"
enabled="false"
label="Freeze"
layout="topleft"
name="enter_frozen_mode"
top_pad="3"
width="116"/>
</panel>
<panel
border="false"
bevel_style="none"
@ -327,7 +240,7 @@
layout="topleft"
left="1"
name="test_panel"
label="Test">
label="Test path">
<text
height="14"
word_wrap="true"

View File

@ -942,15 +942,6 @@
label="Pathfinding"
name="Pathfinding"
tear_off="false">
<menu_item_call
label="Edit / test..."
name="pathfinding_console_menu_item">
<menu_item_call.on_click
function="Floater.ToggleOrBringToFront"
parameter="pathfinding_console" />
<menu_item_call.on_enable
function="Tools.EnablePathfinding" />
</menu_item_call>
<menu_item_call
label="Linksets..."
name="pathfinding_linksets_menu_item">
@ -969,6 +960,15 @@
<menu_item_call.on_enable
function="Tools.EnablePathfinding" />
</menu_item_call>
<menu_item_call
label="Pathfinding debug..."
name="pathfinding_console_menu_item">
<menu_item_call.on_click
function="Floater.ToggleOrBringToFront"
parameter="pathfinding_console" />
<menu_item_call.on_enable
function="Tools.EnablePathfindingDebug" />
</menu_item_call>
</menu>