Adding ability to change the RetrieveNeighboringRegion debug setting and have it automatically update the navmesh zones.

master
Todd Stinson 2012-04-25 11:17:30 -07:00
parent a72034fa42
commit b8c63d8848
2 changed files with 23 additions and 6 deletions

View File

@ -68,6 +68,7 @@
#define SET_SHAPE_RENDER_FLAG(_flag,_type) _flag |= (1U << _type)
#define CONTROL_NAME_RETRIEVE_NEIGHBOR "RetrieveNeighboringRegion"
#define CONTROL_NAME_WALKABLE_OBJECTS "PathfindingWalkable"
#define CONTROL_NAME_STATIC_OBSTACLE_OBJECTS "PathfindingObstacle"
#define CONTROL_NAME_MATERIAL_VOLUMES "PathfindingMaterial"
@ -237,7 +238,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey)
mIsNavMeshUpdating = false;
initializeNavMeshZoneForCurrentRegion();
registerNavMeshColorListeners();
registerSavedSettingsListeners();
fillInColorsForNavMeshVisualization();
}
@ -294,7 +295,7 @@ void LLFloaterPathfindingConsole::onClose(bool pIsAppQuitting)
{
mNavMeshZone.disable();
}
deregisterNavMeshColorListeners();
deregisterSavedSettingsListeners();
setDefaultInputs();
setConsoleState(kConsoleStateUnknown);
@ -512,6 +513,7 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed)
mPathEventSlot(),
mPathfindingToolset(NULL),
mSavedToolset(NULL),
mSavedSettingRetrieveNeighborSlot(),
mSavedSettingWalkableSlot(),
mSavedSettingStaticObstacleSlot(),
mSavedSettingMaterialVolumeSlot(),
@ -1169,8 +1171,12 @@ U32 LLFloaterPathfindingConsole::getRenderShapeFlags()
return shapeRenderFlag;
}
void LLFloaterPathfindingConsole::registerNavMeshColorListeners()
void LLFloaterPathfindingConsole::registerSavedSettingsListeners()
{
if (!mSavedSettingRetrieveNeighborSlot.connected())
{
mSavedSettingRetrieveNeighborSlot = gSavedSettings.getControl(CONTROL_NAME_RETRIEVE_NEIGHBOR)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleRetrieveNeighborChange, this, _1, _2));
}
if (!mSavedSettingWalkableSlot.connected())
{
mSavedSettingWalkableSlot = gSavedSettings.getControl(CONTROL_NAME_WALKABLE_OBJECTS)->getSignal()->connect(boost::bind(&LLFloaterPathfindingConsole::handleNavMeshColorChange, this, _1, _2));
@ -1225,8 +1231,12 @@ void LLFloaterPathfindingConsole::registerNavMeshColorListeners()
}
}
void LLFloaterPathfindingConsole::deregisterNavMeshColorListeners()
void LLFloaterPathfindingConsole::deregisterSavedSettingsListeners()
{
if (mSavedSettingRetrieveNeighborSlot.connected())
{
mSavedSettingRetrieveNeighborSlot.disconnect();
}
if (mSavedSettingWalkableSlot.connected())
{
mSavedSettingWalkableSlot.disconnect();
@ -1277,6 +1287,11 @@ void LLFloaterPathfindingConsole::deregisterNavMeshColorListeners()
}
}
void LLFloaterPathfindingConsole::handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue)
{
initializeNavMeshZoneForCurrentRegion();
}
void LLFloaterPathfindingConsole::handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue)
{
fillInColorsForNavMeshVisualization();

View File

@ -151,8 +151,9 @@ private:
void clearPath();
void updatePathTestStatus();
void registerNavMeshColorListeners();
void deregisterNavMeshColorListeners();
void registerSavedSettingsListeners();
void deregisterSavedSettingsListeners();
void handleRetrieveNeighborChange(LLControlVariable *pControl, const LLSD &pNewValue);
void handleNavMeshColorChange(LLControlVariable *pControl, const LLSD &pNewValue);
void fillInColorsForNavMeshVisualization();
@ -202,6 +203,7 @@ private:
LLToolset *mPathfindingToolset;
LLToolset *mSavedToolset;
boost::signals2::connection mSavedSettingRetrieveNeighborSlot;
boost::signals2::connection mSavedSettingWalkableSlot;
boost::signals2::connection mSavedSettingStaticObstacleSlot;
boost::signals2::connection mSavedSettingMaterialVolumeSlot;