Fixed stand/stop flyin/flycam buttons, added Rebake Navesh menu item, status icon flashes while rebaking. Fixes FIRE-7247

ziree 2012-08-14 13:38:11 +02:00
parent bc42035af5
commit f3bc1d19ad
15 changed files with 180 additions and 80 deletions

View File

@ -67,6 +67,8 @@
#include "rlvhandler.h"
// [/RLVa:KB]
#include "llpanelpathfindingrebakenavmesh.h" // <FS:Zi> Pathfinding rebake functions
//============================================================================
/*
* "ADD LANDMARK" BUTTON UPDATING LOGIC
@ -1243,7 +1245,10 @@ void LLLocationInputCtrl::onParcelIconClick(EParcelIcon icon)
LLNotificationsUtil::add("NoBuild");
break;
case PATHFINDING_DIRTY_ICON:
LLNotificationsUtil::add("PathfindingDirty");
// <FS:Zi> Pathfinding rebake functions
// LLNotificationsUtil::add("PathfindingDirty");
LLNotificationsUtil::add("PathfindingDirty",LLSD(),LLSD(),boost::bind(&LLLocationInputCtrl::rebakeRegionCallback,this,_1,_2));
// </FS:Zi>
break;
case PATHFINDING_DISABLED_ICON:
LLNotificationsUtil::add("DynamicPathfindingDisabled");
@ -1291,3 +1296,19 @@ void LLLocationInputCtrl::createNavMeshStatusListenerForCurrentRegion()
LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(currentRegion, true);
}
}
// <FS:Zi> Pathfinding rebake functions
BOOL LLLocationInputCtrl::rebakeRegionCallback(const LLSD& notification,const LLSD& response)
{
std::string newSetName=response["message"].asString();
S32 option=LLNotificationsUtil::getSelectedOption(notification,response);
if(option==0)
{
if(LLPanelPathfindingRebakeNavmesh::getInstance()->isRebakeNeeded())
LLPanelPathfindingRebakeNavmesh::getInstance()->rebakeNavmesh();
return TRUE;
}
return FALSE;
}
// </FS:Zi>

View File

@ -205,6 +205,10 @@ private:
std::string mHumanReadableLocation;
bool isHumanReadableLocationVisible;
std::string mMaturityHelpTopic;
// <FS:Zi> Pathfinding rebake functions
BOOL rebakeRegionCallback(const LLSD& notification,const LLSD& response);
// </FS:Zi>
};
#endif

View File

@ -267,3 +267,22 @@ void LLPanelPathfindingRebakeNavmesh::updatePosition()
setOrigin( x_pos, 0);
}
// <FS:Zi> Pathfinding rebake functions
bool LLPanelPathfindingRebakeNavmesh::isRebakeNeeded()
{
return mRebakeNavMeshMode==kRebakeNavMesh_Available;
}
bool LLPanelPathfindingRebakeNavmesh::isRebaking()
{
return
mRebakeNavMeshMode==kRebakeNavMesh_RequestSent ||
mRebakeNavMeshMode==kRebakeNavMesh_InProgress;
}
void LLPanelPathfindingRebakeNavmesh::rebakeNavmesh()
{
onNavMeshRebakeClick();
}
// </FS:Zi>

View File

@ -49,9 +49,12 @@ public:
virtual void draw();
virtual BOOL handleToolTip( S32 x, S32 y, MASK mask );
protected:
// <FS:Zi> Pathfinding rebake functions
// Give status bar access to the enum
// protected:
private:
// private:
// <FS:Zi>
typedef enum
{
kRebakeNavMesh_Available,
@ -61,13 +64,14 @@ private:
kRebakeNavMesh_Default = kRebakeNavMesh_NotAvailable
} ERebakeNavMeshMode;
private: // <FS:Zi> Pathfinding rebake functions
LLPanelPathfindingRebakeNavmesh();
virtual ~LLPanelPathfindingRebakeNavmesh();
static LLPanelPathfindingRebakeNavmesh* getPanel();
void setMode(ERebakeNavMeshMode pRebakeNavMeshMode);
ERebakeNavMeshMode getMode() const;
// ERebakeNavMeshMode getMode() const; // <FS:Zi> Pathfinding rebake functions
void onNavMeshRebakeClick();
@ -91,6 +95,15 @@ private:
LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
boost::signals2::connection mRegionCrossingSlot;
LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
// <FS:Zi> Pathfinding rebake functions
// Public accessor functions for llviewermenu.cpp to minimaze code changes
public:
bool isRebakeNeeded();
bool isRebaking();
void rebakeNavmesh();
ERebakeNavMeshMode getMode() const;
// </FS:Zi>
};
#endif // LL_LLPANELPATHFINDINGREBAKENAVMESH_H

View File

@ -1,3 +1,4 @@
/**
* @file llstatusbar.cpp
* @brief LLStatusBar class implementation
@ -86,13 +87,6 @@
#include "rlvhandler.h"
#include "kcwlinterface.h"
// <FS:Ansariel> Pathfinding support
#include "llenvmanager.h"
#include "llpathfindingmanager.h"
#include "llpathfindingnavmesh.h"
#include "llpathfindingnavmeshstatus.h"
// </FS:Ansariel> Pathfinding support
// library includes
#include "imageids.h"
#include "llfloaterreg.h"
@ -107,6 +101,8 @@
// system includes
#include <iomanip>
#include "llpanelpathfindingrebakenavmesh.h" // <FS:Zi> Pathfinding rebake functions
//
// Globals
//
@ -159,11 +155,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
mShowParcelIcons(TRUE),
mSquareMetersCredit(0),
mSquareMetersCommitted(0),
// <FS:Ansariel> Pathfinding support
mRegionCrossingSlot(),
mNavMeshSlot(),
mIsNavMeshDirty(false),
// </FS:Ansariel> Pathfinding support
mPathfindingFlashOn(TRUE), // <FS:Zi> Pathfinding rebake functions
mAudioStreamEnabled(FALSE) // ## Zi: Media/Stream separation
{
setRect(rect);
@ -210,19 +202,6 @@ LLStatusBar::~LLStatusBar()
{
mShowCoordsCtrlConnection.disconnect();
}
// <FS:Ansariel> Pathfinding support
if (mRegionCrossingSlot.connected())
{
mRegionCrossingSlot.disconnect();
}
if (mNavMeshSlot.connected())
{
mNavMeshSlot.disconnect();
}
// </FS:Ansariel> Pathfinding support
// LLView destructor cleans up children
}
@ -376,11 +355,6 @@ BOOL LLStatusBar::postBuild()
updateNetstatVisibility(LLSD(FALSE));
}
// <FS:Ansariel> Pathfinding support
mRegionCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLStatusBar::onRegionBoundaryCrossed, this));
createNavMeshStatusListenerForCurrentRegion();
// </FS:Ansariel> Pathfinding support
return TRUE;
}
@ -449,6 +423,27 @@ void LLStatusBar::refresh()
mTextTime->setToolTip (dtStr);
}
// <FS:Zi> Pathfinding rebake functions
static LLPanelPathfindingRebakeNavmesh::ERebakeNavMeshMode pathfinding_mode=LLPanelPathfindingRebakeNavmesh::kRebakeNavMesh_Default;
if( LLPanelPathfindingRebakeNavmesh::getInstance()->isRebaking())
{
LLViewerRegion* agent_region=gAgent.getRegion();
if( agent_region &&
agent_region->dynamicPathfindingEnabled() &&
mRebakingTimer.getElapsedTimeF32()>0.5f)
{
mRebakingTimer.reset();
mPathfindingFlashOn=!mPathfindingFlashOn;
updateParcelIcons();
}
}
else if(pathfinding_mode!=LLPanelPathfindingRebakeNavmesh::getInstance()->getMode())
{
pathfinding_mode=LLPanelPathfindingRebakeNavmesh::getInstance()->getMode();
updateParcelIcons();
}
// </FS:Zi>
LLRect r;
const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
@ -876,34 +871,6 @@ void LLStatusBar::onNavBarShowCoordinatesCtrlChanged()
setParcelInfoText(new_text);
}
// <FS:Ansariel> Pathfinding support
void LLStatusBar::onRegionBoundaryCrossed()
{
createNavMeshStatusListenerForCurrentRegion();
}
void LLStatusBar::onNavMeshStatusChange(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
mIsNavMeshDirty = pNavMeshStatus.isValid() && (pNavMeshStatus.getStatus() != LLPathfindingNavMeshStatus::kComplete);
update();
}
void LLStatusBar::createNavMeshStatusListenerForCurrentRegion()
{
if (mNavMeshSlot.connected())
{
mNavMeshSlot.disconnect();
}
LLViewerRegion *currentRegion = gAgent.getRegion();
if (currentRegion != NULL)
{
mNavMeshSlot = LLPathfindingManager::getInstance()->registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLStatusBar::onNavMeshStatusChange, this, _2));
LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(currentRegion, true);
}
}
// </FS:Ansariel> Pathfinding support
void LLStatusBar::buildLocationString(std::string& loc_str, bool show_coords)
{
// Ansariel: Use V1 layout for location string in status bar so
@ -1038,6 +1005,16 @@ void LLStatusBar::updateParcelIcons()
// <FS:Ansariel> Pathfinding support
bool pathfinding_dynamic_enabled = agent_region->dynamicPathfindingEnabled();
// <FS:Zi> Pathfinding rebake functions
bool pathfinding_navmesh_dirty=LLPanelPathfindingRebakeNavmesh::getInstance()->isRebakeNeeded();
F32 pathfinding_dirty_icon_alpha=1.0;
if(LLPanelPathfindingRebakeNavmesh::getInstance()->isRebaking())
{
pathfinding_dirty_icon_alpha=mPathfindingFlashOn ? 1.0 : 0.25;
pathfinding_navmesh_dirty=true;
}
// </FS:Zi>
// Most icons are "block this ability"
mParcelIcon[VOICE_ICON]->setVisible( !allow_voice );
mParcelIcon[FLY_ICON]->setVisible( !allow_fly );
@ -1047,8 +1024,9 @@ void LLStatusBar::updateParcelIcons()
mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage );
mParcelIcon[SEE_AVATARS_ICON]->setVisible(!see_avatars);
// <FS:Ansariel> Pathfinding support
mParcelIcon[PATHFINDING_DIRTY_ICON]->setVisible(mIsNavMeshDirty);
mParcelIcon[PATHFINDING_DISABLED_ICON]->setVisible(!mIsNavMeshDirty && !pathfinding_dynamic_enabled);
mParcelIcon[PATHFINDING_DIRTY_ICON]->setVisible(pathfinding_navmesh_dirty);
mParcelIcon[PATHFINDING_DIRTY_ICON]->setColor(LLColor4::white % pathfinding_dirty_icon_alpha);
mParcelIcon[PATHFINDING_DISABLED_ICON]->setVisible(!pathfinding_navmesh_dirty && !pathfinding_dynamic_enabled);
// </FS:Ansariel> Pathfinding support
mDamageText->setVisible(allow_damage);
mBuyParcelBtn->setVisible(is_for_sale);
@ -1171,7 +1149,10 @@ void LLStatusBar::onParcelIconClick(EParcelIcon icon)
break;
// <FS:Ansariel> Pathfinding support
case PATHFINDING_DIRTY_ICON:
LLNotificationsUtil::add("PathfindingDirty");
// <FS:Zi> Pathfinding rebake functions
// LLNotificationsUtil::add("PathfindingDirty");
LLNotificationsUtil::add("PathfindingDirty",LLSD(),LLSD(),boost::bind(&LLStatusBar::rebakeRegionCallback,this,_1,_2));
// </FS:Zi>
break;
case PATHFINDING_DISABLED_ICON:
LLNotificationsUtil::add("DynamicPathfindingDisabled");
@ -1266,3 +1247,19 @@ void LLStatusBar::updateNetstatVisibility(const LLSD& data)
rect.translate(NETSTAT_WIDTH * translateFactor, 0);
mBalancePanel->setRect(rect);
}
// <FS:Zi> Pathfinding rebake functions
BOOL LLStatusBar::rebakeRegionCallback(const LLSD& notification,const LLSD& response)
{
std::string newSetName=response["message"].asString();
S32 option=LLNotificationsUtil::getSelectedOption(notification,response);
if(option==0)
{
if(LLPanelPathfindingRebakeNavmesh::getInstance()->isRebakeNeeded())
LLPanelPathfindingRebakeNavmesh::getInstance()->rebakeNavmesh();
return TRUE;
}
return FALSE;
}
// </FS:Zi>

View File

@ -323,12 +323,13 @@ private:
boost::signals2::connection mParcelPropsCtrlConnection;
boost::signals2::connection mShowCoordsCtrlConnection;
boost::signals2::connection mParcelMgrConnection;
// <FS:Ansariel> Pathfinding support
boost::signals2::connection mRegionCrossingSlot;
LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
bool mIsNavMeshDirty;
// </FS:Ansariel> Pathfinding support
// <FS:Zi> Pathfinding rebake functions
BOOL rebakeRegionCallback(const LLSD& notification,const LLSD& response);
LLFrameTimer mRebakingTimer;
BOOL mPathfindingFlashOn;
// </FS:Zi>
};
// *HACK: Status bar owns your cached money balance. JC

View File

@ -142,6 +142,8 @@
#include "fscontactsfloater.h" // <FS:Zi> Display group list in contacts floater
#include "fswsassetblacklist.h"
#include "llpanelpathfindingrebakenavmesh.h" // <FS:Zi> Pathfinding rebake functions
using namespace LLVOAvatarDefines;
typedef LLPointer<LLViewerObject> LLViewerObjectPtr;
@ -9568,6 +9570,18 @@ void toggleTeleportHistory()
}
// </FS:Ansariel> Toggle teleport history panel directly
// <FS:Zi> Pathfinding rebake functions
bool enable_rebake_region()
{
return LLPanelPathfindingRebakeNavmesh::getInstance()->isRebakeNeeded();
}
void handle_rebake_region()
{
LLPanelPathfindingRebakeNavmesh::getInstance()->rebakeNavmesh();
}
// </FS:Zi>
// <FS:Zi> Make sure to call this before any of the UI is set up, so all text editors can
// pick up the menu properly.
void initialize_edit_menu()
@ -10107,4 +10121,9 @@ void initialize_menus()
commit.add("ToggleSettingsDebug", boost::bind(&toggleSettingsDebug));
// <FS:Ansariel> Toggle teleport history panel directly
commit.add("ToggleTeleportHistory", boost::bind(&toggleTeleportHistory));
// <FS:Zi> Pathfinding rebake functions
commit.add("World.RebakeRegion", boost::bind(&handle_rebake_region));
enable.add("World.RebakeRegion", boost::bind(&enable_rebake_region));
// </FS:Zi>
}

View File

@ -2027,8 +2027,13 @@ void LLViewerWindow::initWorldUI()
LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance();
panel_ssf_container->addChild(panel_stand_stop_flying);
LLPanelPathfindingRebakeNavmesh *panel_rebake_navmesh = LLPanelPathfindingRebakeNavmesh::getInstance();
panel_ssf_container->addChild(panel_rebake_navmesh);
// <FS:Zi> Pathfinding rebake functions
// We don't use this panel, we use a menu item instead, so we only initialize the panel
// but don't add it to the UI.
// LLPanelPathfindingRebakeNavmesh *panel_rebake_navmesh = LLPanelPathfindingRebakeNavmesh::getInstance();
// panel_ssf_container->addChild(panel_rebake_navmesh);
LLPanelPathfindingRebakeNavmesh::getInstance();
// </FS:Zi>
panel_ssf_container->setVisible(TRUE);

View File

@ -1345,6 +1345,20 @@
<menu_item_call.on_enable
function="Tools.EnablePathfindingView" />
</menu_item_call>
<!-- <FS:Zi> Pathfinding rebake functions -->
<menu_item_separator/>
<menu_item_call
label="Rebake Region Navmesh"
name="rebake_region_navmesh">
<menu_item_call.on_click
function="World.RebakeRegion" />
<menu_item_call.on_enable
function="World.RebakeRegion" />
</menu_item_call>
<!-- </FS:Zi> -->
</menu>

View File

@ -6156,12 +6156,16 @@ This area has building disabled. You can&apos;t build or rez objects here.
</notification>
<notification
icon="notify.tga"
icon="alertmodal.tga"
name="PathfindingDirty"
persist="true"
type="notify">
type="alertmodal">
<unique/>
The region has pending pathfinding changes. If you have build rights, you may rebake the region by clicking on the “Rebake region” button.
The region has pending pathfinding changes. If you have build rights, you may rebake the region by clicking on the “Rebake” button.
<usetemplate
name="okcancelbuttons"
yestext="Rebake"
notext="Close" />
</notification>
<notification

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<!-- <FS:Zi> This file is unused in Firestorm -->
<panel
height="25"
layout="topleft"

View File

@ -188,7 +188,7 @@
right="-10"
mouse_opaque="false"
tab_stop="false"
name="stand_stop_flying_container"
name="state_management_buttons_container"
visible="false"
width="158" />

View File

@ -188,7 +188,7 @@
right="-10"
mouse_opaque="false"
tab_stop="false"
name="stand_stop_flying_container"
name="state_management_buttons_container"
visible="false"
width="210" />

View File

@ -188,7 +188,7 @@
right="-10"
mouse_opaque="false"
tab_stop="false"
name="stand_stop_flying_container"
name="state_management_buttons_container"
visible="false"
width="210" />

View File

@ -189,7 +189,7 @@
left="350"
mouse_opaque="false"
tab_stop="false"
name="stand_stop_flying_container"
name="state_management_buttons_container"
visible="true"
width="158"/>
</layout_panel>