PATH-702: Positioning the rebake navmesh button to align with the Stand/StopFlying buttons. Also, parenting the buttons to the toolbar UI elements.

meow-7.2.2
Todd Stinson 2012-06-19 17:20:24 -07:00
parent c1c3b856fb
commit e4aa203881
9 changed files with 105 additions and 76 deletions

View File

@ -56,6 +56,7 @@
#include "llnavigationbar.h" // to show/hide navigation bar when changing mouse look state
#include "llnearbychatbar.h"
#include "llnotificationsutil.h"
#include "llpanelnavmeshrebake.h"
#include "llpaneltopinfobar.h"
#include "llparcel.h"
#include "llrendersphere.h"
@ -1870,6 +1871,7 @@ void LLAgent::endAnimationUpdateUI()
LLChicletBar::getInstance()->setVisible(TRUE);
LLPanelStandStopFlying::getInstance()->setVisible(TRUE);
LLPanelNavMeshRebake::getInstance()->setVisible(TRUE);
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
@ -1979,6 +1981,7 @@ void LLAgent::endAnimationUpdateUI()
LLChicletBar::getInstance()->setVisible(FALSE);
LLPanelStandStopFlying::getInstance()->setVisible(FALSE);
LLPanelNavMeshRebake::getInstance()->setVisible(FALSE);
// clear out camera lag effect
gAgentCamera.clearCameraLag();

View File

@ -710,7 +710,7 @@ void LLPanelStandStopFlying::updatePosition()
left_tb_width = toolbar_left->getRect().getWidth();
}
if(LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("stand_stop_flying_container"))
if(LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container"))
{
panel_ssf_container->setOrigin(0, y_pos);
}

View File

@ -26,27 +26,21 @@
*/
#include "llviewerprecompiledheaders.h"
#include "llpathfindingmanager.h"
#include <string>
#include <map>
#include <boost/function.hpp>
#include <boost/signals2.hpp>
#include "llpanelnavmeshrebake.h"
#include "llagent.h"
#include "llhints.h"
#include "lltooltip.h"
#include "llbutton.h"
#include "llpanel.h"
LLPanelNavMeshRebake::LLPanelNavMeshRebake()
: mNavMeshRebakeButton( NULL )
, mNavMeshBakingButton( NULL )
{
// make sure we have the only instance of this class
static bool b = true;
llassert_always(b);
b=false;
}
#include "llpanelnavmeshrebake.h"
#include <boost/bind.hpp>
#include "llbutton.h"
#include "llhandle.h"
#include "llhints.h"
#include "llpanel.h"
#include "llpathfindingmanager.h"
#include "lltoolbar.h"
#include "lltoolbarview.h"
#include "lltoolmgr.h"
#include "lltooltip.h"
#include "llview.h"
LLPanelNavMeshRebake* LLPanelNavMeshRebake::getInstance()
{
@ -54,24 +48,33 @@ LLPanelNavMeshRebake* LLPanelNavMeshRebake::getInstance()
return panel;
}
void LLPanelNavMeshRebake::setMode(ERebakeNavMeshMode pRebakeNavMeshMode)
{
mNavMeshRebakeButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_Available);
mNavMeshBakingButton->setVisible(pRebakeNavMeshMode == kRebakeNavMesh_RequestSent);
setVisible(pRebakeNavMeshMode != kRebakeNavMesh_NotAvailable);
}
BOOL LLPanelNavMeshRebake::postBuild()
{
//Rebake initiated
mNavMeshRebakeButton = getChild<LLButton>("navmesh_btn");
mNavMeshRebakeButton->setCommitCallback(boost::bind(&LLPanelNavMeshRebake::onNavMeshRebakeClick, this));
mNavMeshRebakeButton->setVisible( TRUE );
LLHints::registerHintTarget("navmesh_btn", mNavMeshRebakeButton->getHandle());
//Baking...
mNavMeshBakingButton = getChild<LLButton>("navmesh_btn_baking");
mNavMeshBakingButton->setVisible( FALSE );
LLHints::registerHintTarget("navmesh_btn_baking", mNavMeshBakingButton->getHandle());
return TRUE;
setMode(kRebakeNavMesh_Default);
return LLPanel::postBuild();
}
void LLPanelNavMeshRebake::setVisible( BOOL visible )
void LLPanelNavMeshRebake::draw()
{
LLPanel::setVisible(visible);
updatePosition();
LLPanel::draw();
}
BOOL LLPanelNavMeshRebake::handleToolTip( S32 x, S32 y, MASK mask )
@ -82,17 +85,22 @@ BOOL LLPanelNavMeshRebake::handleToolTip( S32 x, S32 y, MASK mask )
{
LLToolTipMgr::instance().show(mNavMeshRebakeButton->getToolTip());
}
return LLPanel::handleToolTip(x, y, mask);
}
void LLPanelNavMeshRebake::reparent( LLView* rootp )
LLPanelNavMeshRebake::LLPanelNavMeshRebake()
: mNavMeshRebakeButton( NULL ),
mNavMeshBakingButton( NULL )
{
// make sure we have the only instance of this class
static bool b = true;
llassert_always(b);
b=false;
}
LLPanelNavMeshRebake::~LLPanelNavMeshRebake()
{
LLPanel* parent = dynamic_cast<LLPanel*>( getParent() );
if (!parent)
{
return;
}
rootp->addChild(this);
}
LLPanelNavMeshRebake* LLPanelNavMeshRebake::getPanel()
@ -105,15 +113,37 @@ LLPanelNavMeshRebake* LLPanelNavMeshRebake::getPanel()
void LLPanelNavMeshRebake::onNavMeshRebakeClick()
{
#if 0
mNavMeshRebakeButton->setVisible( FALSE );
mNavMeshBakingButton->setVisible( TRUE );
mNavMeshBakingButton->setForcePressedState( TRUE );
#endif
LLPathfindingManager::getInstance()->triggerNavMeshRebuild();
}
void LLPanelNavMeshRebake::resetButtonStates()
void LLPanelNavMeshRebake::updatePosition()
{
mNavMeshRebakeButton->setVisible( TRUE );
mNavMeshBakingButton->setVisible( FALSE );
}
S32 y_pos = 0;
S32 bottom_tb_center = 0;
if (LLToolBar* toolbar_bottom = gToolBarView->getChild<LLToolBar>("toolbar_bottom"))
{
y_pos = toolbar_bottom->getRect().getHeight();
bottom_tb_center = toolbar_bottom->getRect().getCenterX();
}
S32 left_tb_width = 0;
if (LLToolBar* toolbar_left = gToolBarView->getChild<LLToolBar>("toolbar_left"))
{
left_tb_width = toolbar_left->getRect().getWidth();
}
if(LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container"))
{
panel_ssf_container->setOrigin(0, y_pos);
}
S32 x_pos = bottom_tb_center-getRect().getWidth()/2 - left_tb_width + 113 /*width of stand/fly button */ + 10;
setOrigin( x_pos, 0);
}

View File

@ -28,6 +28,11 @@
#ifndef LL_NAVMESHREBAKE_H
#define LL_NAVMESHREBAKE_H
#include "llhandle.h"
#include "llpanel.h"
class LLButton;
class LLView;
class LLPanelNavMeshRebake : public LLPanel
{
@ -36,38 +41,36 @@ class LLPanelNavMeshRebake : public LLPanel
public:
typedef enum navmesh_rebake_mode_t
typedef enum
{
NMRM_Visible,
NMRM_Visible_Waiting_Response,
NVRM_Hiddeb
} ESNavMeshRebakeMode;
kRebakeNavMesh_Available,
kRebakeNavMesh_RequestSent,
kRebakeNavMesh_NotAvailable,
kRebakeNavMesh_Default = kRebakeNavMesh_NotAvailable
} ERebakeNavMeshMode;
void reparent( LLView* rootp );
void resetButtonStates();
static LLPanelNavMeshRebake* getInstance();
/*virtual*/ BOOL postBuild();
/*virtual*/ void setVisible( BOOL visible );
void setMode(ERebakeNavMeshMode pRebakeNavMeshMode);
/*virtual*/ void draw(){ LLPanel::draw(); }
/*virtual*/ BOOL handleToolTip( S32 x, S32 y, MASK mask );
virtual BOOL postBuild();
virtual void draw();
virtual BOOL handleToolTip( S32 x, S32 y, MASK mask );
protected:
LLPanelNavMeshRebake();
private:
LLPanelNavMeshRebake();
virtual ~LLPanelNavMeshRebake();
static LLPanelNavMeshRebake* getPanel();
void onNavMeshRebakeClick();
void updatePosition();
LLButton* mNavMeshRebakeButton;
LLButton* mNavMeshBakingButton;
LLHandle<LLPanel> mOriginalParent;
LLButton* mNavMeshBakingButton;
};
#endif //LL_NAVMESHREBAKE_H

View File

@ -770,22 +770,12 @@ void LLPathfindingManager::handleNavMeshStatus(LLPathfindingNavMesh::ENavMeshReq
void LLPathfindingManager::displayNavMeshRebakePanel()
{
if ( LLStartUp::getStartupState() == STATE_STARTED && gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
{
LLView* rootp = LLUI::getRootView();
LLPanel* panel_nmr_container = rootp->getChild<LLPanel>("navmesh_rebake_container");
LLPanelNavMeshRebake* panel_namesh_rebake = LLPanelNavMeshRebake::getInstance();
panel_nmr_container->addChild( panel_namesh_rebake );
panel_nmr_container->setVisible( TRUE );
panel_namesh_rebake->reparent( rootp );
LLPanelNavMeshRebake::getInstance()->setVisible( TRUE );
LLPanelNavMeshRebake::getInstance()->resetButtonStates();
}
LLPanelNavMeshRebake::getInstance()->setMode(LLPanelNavMeshRebake::kRebakeNavMesh_Available);
}
void LLPathfindingManager::hideNavMeshRebakePanel()
{
LLPanelNavMeshRebake::getInstance()->setVisible( FALSE );
LLPanelNavMeshRebake::getInstance()->setMode(LLPanelNavMeshRebake::kRebakeNavMesh_NotAvailable);
}
void LLPathfindingManager::handleNavMeshRebakeError(U32 pStatus, const std::string &pReason, const std::string &pURL)

View File

@ -393,14 +393,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED );
gAgent.setTeleportMessage(
LLAgent::sTeleportProgressMessages["requesting"]);
if ( LLPathfindingManager::getInstance() ) { LLPathfindingManager::getInstance()->hideNavMeshRebakePanel(); }
break;
case LLAgent::TELEPORT_REQUESTED:
// Waiting for source simulator to respond
gViewerWindow->setProgressPercent( llmin(teleport_percent, 37.5f) );
gViewerWindow->setProgressString(message);
if ( LLPathfindingManager::getInstance() ) { LLPathfindingManager::getInstance()->hideNavMeshRebakePanel(); }
break;
case LLAgent::TELEPORT_MOVING:
@ -454,7 +452,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
// No teleport in progress
gViewerWindow->setShowProgress(FALSE);
gTeleportDisplay = FALSE;
if ( LLPathfindingManager::getInstance() ) { LLPathfindingManager::getInstance()->requestGetAgentState(); }
break;
}
}

View File

@ -126,6 +126,7 @@
#include "llmorphview.h"
#include "llmoveview.h"
#include "llnavigationbar.h"
#include "llpanelnavmeshrebake.h"
#include "llpaneltopinfobar.h"
#include "llpopupview.h"
#include "llpreviewtexture.h"
@ -1919,9 +1920,14 @@ void LLViewerWindow::initWorldUI()
getRootView()->addChild(gHUDView);
}
LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("stand_stop_flying_container");
LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container");
LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance();
panel_ssf_container->addChild(panel_stand_stop_flying);
LLPanelNavMeshRebake *panel_rebake_navmesh = LLPanelNavMeshRebake::getInstance();
panel_ssf_container->addChild(panel_rebake_navmesh);
panel_ssf_container->setVisible(TRUE);
// Load and make the toolbars visible

View File

@ -9,7 +9,7 @@
<button
follows="left|bottom"
height="19"
label="Rebake NavMesh"
label="Rebake navmesh"
layout="topleft"
left="10"
name="navmesh_btn"
@ -20,11 +20,11 @@
<button
follows="left|bottom"
height="19"
label="NavMesh Baking..."
label="Navmesh baking..."
layout="topleft"
left="10"
name="navmesh_btn_baking"
tool_tip="NavMesh is baking"
tool_tip="Navmesh is baking."
top="2"
visible="false"
width="113" />

View File

@ -93,7 +93,7 @@
left="0"
mouse_opaque="false"
tab_stop="false"
name="stand_stop_flying_container"
name="state_management_buttons_container"
visible="false"
width="200"/>
</layout_panel>