Commit 340df8c3 authored by NiranV's avatar NiranV
Browse files

Changed: Replaced stand-stop-flying status buttons with a full BD status...

Changed: Replaced stand-stop-flying status buttons with a full BD status container showing several statuses in addition to just sitting and flying.
parent 7a0d8239
......@@ -40,6 +40,7 @@
#include "bdanimator.h"
#include "bdfunctions.h"
#include "bdposingmotion.h"
#include "bdstatus.h"
BDFloaterPoser::BDFloaterPoser(const LLSD& key)
......@@ -525,6 +526,7 @@ void BDFloaterPoser::onPoseStart()
if (avatar->isSelf())
{
gAgent.stopFidget();
gDragonStatus->setPosing(true);
}
avatar->startMotion(ANIM_BD_POSING_MOTION);
}
......@@ -536,6 +538,11 @@ void BDFloaterPoser::onPoseStart()
//BD - Clear posing when we're done now that we've safely endangered getting spaghetified.
avatar->clearPosing();
avatar->stopMotion(ANIM_BD_POSING_MOTION);
if (avatar->isSelf())
{
gDragonStatus->setPosing(false);
}
}
//BD - Wipe the joint list.
onJointRefresh();
......
......@@ -104,6 +104,7 @@
//BD
#include "lltoolfocus.h"
#include "bdsidebar.h"
#include "bdstatus.h"
using namespace LLAvatarAppearanceDefines;
......@@ -855,6 +856,9 @@ void LLAgent::setFlying(BOOL fly, BOOL fail_sound)
// Update Movement Controls according to Fly mode
LLFloaterMove::setFlyingMode(fly);
//BD
gDragonStatus->setFlying(fly);
mbFlagsDirty = TRUE;
}
......@@ -910,6 +914,9 @@ void LLAgent::standUp()
if ( (!rlv_handler_t::isEnabled()) || (RlvActions::canStand()) )
{
setControlFlags(AGENT_CONTROL_STAND_UP);
//BD
gDragonStatus->setSitting(false);
}
// [/RLVa:KB]
}
......@@ -1266,6 +1273,9 @@ void LLAgent::sitDown()
// [/RLVa:KB]
setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
//BD
gDragonStatus->setSitting(true);
}
......@@ -2182,8 +2192,6 @@ void LLAgent::endAnimationUpdateUI()
LLChicletBar::getInstance()->setVisible(TRUE);
LLPanelStandStopFlying::getInstance()->setVisible(TRUE);
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
LLFloaterCamera::onLeavingMouseLook();
......@@ -2308,8 +2316,6 @@ void LLAgent::endAnimationUpdateUI()
LLChicletBar::getInstance()->setVisible(FALSE);
LLPanelStandStopFlying::getInstance()->setVisible(FALSE);
// clear out camera lag effect
gAgentCamera.clearCameraLag();
......@@ -3308,6 +3314,9 @@ void LLAgent::sendWalkRun()
msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(getRunning()) );
// [/RLVa:KB]
sendReliableMessage();
//BD
gDragonStatus->setRunning(getRunning());
}
}
......
......@@ -2508,7 +2508,6 @@ void LLAgentCamera::changeCameraToDefault()
if (gSavedSettings.getBOOL("HideUIControls"))
{
gViewerWindow->setUIVisibility(false);
LLPanelStandStopFlying::getInstance()->setVisible(false);
}
}
......
......@@ -143,6 +143,17 @@ BOOL LLFloaterMove::postBuild()
initMovementMode();
//BD
mStandButton = getChild<LLButton>("stand_btn");
mStopFlyingButton = getChild<LLButton>("stop_fly_btn");
mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::onStandButtonClick, this));
mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::enableInstance));
mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::onStopFlyingButtonClick, this));
mStandButton->setVisible(FALSE);
mStopFlyingButton->setVisible(FALSE);
// gAgent.addParcelChangedCallback(LLFloaterMove::sUpdateFlyingStatus);
// [RLVa:KB] - Checked: 2011-05-27 (RLVa-1.4.0a) | Added: RLVa-1.4.0a
gAgent.addParcelChangedCallback(LLFloaterMove::sUpdateMovementStatus);
......@@ -162,21 +173,6 @@ void LLFloaterMove::setVisible(BOOL visible)
return;
}
if (visible)
{
LLFirstUse::notMoving(false);
// Attach the Stand/Stop Flying panel.
LLPanelStandStopFlying* ssf_panel = LLPanelStandStopFlying::getInstance();
ssf_panel->reparent(this);
const LLRect& mode_actions_rect = mModeActionsPanel->getRect();
ssf_panel->setOrigin(mode_actions_rect.mLeft, mode_actions_rect.mBottom);
}
else
{
// Detach the Stand/Stop Flying panel.
LLPanelStandStopFlying::getInstance()->reparent(NULL);
}
LLFloater::setVisible(visible);
}
......@@ -208,14 +204,15 @@ void LLFloaterMove::setFlyingMode(BOOL fly)
&& (!avatar_object->isDead())
&& avatar_object->isSitting();
instance->showModeButtons(!fly && !is_sitting);
}
if (fly)
{
LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
}
else
{
LLPanelStandStopFlying::clearStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
if (fly)
{
instance->setStandStopFlyingMode(SSFM_STOP_FLYING);
}
else
{
instance->clearStandStopFlyingMode(SSFM_STOP_FLYING);
}
}
}
//static
......@@ -244,18 +241,22 @@ void LLFloaterMove::setAlwaysRunModeImpl(bool run)
//static
void LLFloaterMove::setSittingMode(BOOL bSitting)
{
if (bSitting)
{
LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STAND);
}
else
LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
if (instance)
{
LLPanelStandStopFlying::clearStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STAND);
// show "Stop Flying" button if needed. EXT-871
if (gAgent.getFlying())
if (bSitting)
{
instance->setStandStopFlyingMode(SSFM_STAND);
}
else
{
LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING);
instance->clearStandStopFlyingMode(SSFM_STAND);
// show "Stop Flying" button if needed. EXT-871
if (gAgent.getFlying())
{
instance->setStandStopFlyingMode(SSFM_STOP_FLYING);
}
}
}
enableInstance();
......@@ -534,56 +535,29 @@ void LLFloaterMove::setModeButtonToggleState(const EMovementMode mode)
mModeControlButtonMap[mode]->setToggleState(TRUE);
}
/************************************************************************/
/* LLPanelStandStopFlying */
/************************************************************************/
LLPanelStandStopFlying::LLPanelStandStopFlying() :
mStandButton(NULL),
mStopFlyingButton(NULL),
mAttached(false)
{
// make sure we have the only instance of this class
static bool b = true;
llassert_always(b);
b=false;
}
// static
LLPanelStandStopFlying* LLPanelStandStopFlying::getInstance()
{
static LLPanelStandStopFlying* panel = getStandStopFlyingPanel();
return panel;
}
//static
void LLPanelStandStopFlying::setStandStopFlyingMode(EStandStopFlyingMode mode)
void LLFloaterMove::setStandStopFlyingMode(EStandStopFlyingMode mode)
{
LLPanelStandStopFlying* panel = getInstance();
if (mode == SSFM_STAND)
{
LLFirstUse::sit();
LLFirstUse::notMoving(false);
}
panel->mStandButton->setVisible(SSFM_STAND == mode);
panel->mStopFlyingButton->setVisible(SSFM_STOP_FLYING == mode);
mStandButton->setVisible(SSFM_STAND == mode);
mStopFlyingButton->setVisible(SSFM_STOP_FLYING == mode);
//visibility of it should be updated after updating visibility of the buttons
panel->setVisible(TRUE);
}
//static
void LLPanelStandStopFlying::clearStandStopFlyingMode(EStandStopFlyingMode mode)
void LLFloaterMove::clearStandStopFlyingMode(EStandStopFlyingMode mode)
{
LLPanelStandStopFlying* panel = getInstance();
switch(mode) {
case SSFM_STAND:
panel->mStandButton->setVisible(FALSE);
mStandButton->setVisible(FALSE);
break;
case SSFM_STOP_FLYING:
panel->mStopFlyingButton->setVisible(FALSE);
mStopFlyingButton->setVisible(FALSE);
break;
default:
LL_ERRS() << "Unexpected EStandStopFlyingMode is passed: " << mode << LL_ENDL;
......@@ -591,125 +565,7 @@ void LLPanelStandStopFlying::clearStandStopFlyingMode(EStandStopFlyingMode mode)
}
BOOL LLPanelStandStopFlying::postBuild()
{
mStandButton = getChild<LLButton>("stand_btn");
mStandButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStandButtonClick, this));
mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::enableInstance));
mStandButton->setVisible(FALSE);
LLHints::getInstance()->registerHintTarget("stand_btn", mStandButton->getHandle());
mStopFlyingButton = getChild<LLButton>("stop_fly_btn");
//mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE));
mStopFlyingButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStopFlyingButtonClick, this));
mStopFlyingButton->setVisible(FALSE);
gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLPanelStandStopFlying::updatePosition, this));
return TRUE;
}
//virtual
void LLPanelStandStopFlying::setVisible(BOOL visible)
{
//we dont need to show the panel if these buttons are not activated
if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false;
if (visible)
{
updatePosition();
}
// do not change parent visibility in case panel is attached into Move Floater: EXT-3632, EXT-4646
if (!mAttached)
{
//change visibility of parent layout_panel to animate in/out. EXT-2504
if (getParent()) getParent()->setVisible(visible);
}
// also change own visibility to avoid displaying the panel in mouselook (broken when EXT-2504 was implemented).
// See EXT-4718.
LLPanel::setVisible(visible);
}
BOOL LLPanelStandStopFlying::handleToolTip(S32 x, S32 y, MASK mask)
{
LLToolTipMgr::instance().unblockToolTips();
if (mStandButton->getVisible())
{
LLToolTipMgr::instance().show(mStandButton->getToolTip());
}
else if (mStopFlyingButton->getVisible())
{
LLToolTipMgr::instance().show(mStopFlyingButton->getToolTip());
}
return LLPanel::handleToolTip(x, y, mask);
}
void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view)
{
LLPanel* parent = dynamic_cast<LLPanel*>(getParent());
if (!parent)
{
LL_WARNS() << "Stand/stop flying panel parent is unset, already attached?: " << mAttached << ", new parent: " << (move_view == NULL ? "NULL" : "Move Floater") << LL_ENDL;
return;
}
if (move_view != NULL)
{
llassert(move_view != parent); // sanity check
// Save our original container.
if (!mOriginalParent.get())
mOriginalParent = parent->getHandle();
// Attach to movement controls.
parent->removeChild(this);
move_view->addChild(this);
// Origin must be set by movement controls.
mAttached = true;
}
else
{
if (!mOriginalParent.get())
{
LL_WARNS() << "Original parent of the stand / stop flying panel not found" << LL_ENDL;
return;
}
// Detach from movement controls.
parent->removeChild(this);
mOriginalParent.get()->addChild(this);
// update parent with self visibility (it is changed in setVisible()). EXT-4743
mOriginalParent.get()->setVisible(getVisible());
mAttached = false;
updatePosition(); // don't defer until next draw() to avoid flicker
}
}
//////////////////////////////////////////////////////////////////////////
// Private Section
//////////////////////////////////////////////////////////////////////////
//static
LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel()
{
LLPanelStandStopFlying* panel = new LLPanelStandStopFlying();
panel->buildFromFile("panel_stand_stop_flying.xml");
panel->setVisible(FALSE);
//LLUI::getInstance()->getRootView()->addChild(panel);
LL_INFOS() << "Build LLPanelStandStopFlying panel" << LL_ENDL;
panel->updatePosition();
return panel;
}
void LLPanelStandStopFlying::onStandButtonClick()
void LLFloaterMove::onStandButtonClick()
{
// [RLVa:KB] - Checked: 2010-03-07 (RLVa-1.2.0c) | Added: RLVa-1.2.0a
if ( (!RlvActions::isRlvEnabled()) || (RlvActions::canStand()) )
......@@ -722,46 +578,11 @@ void LLPanelStandStopFlying::onStandButtonClick()
// [/RLVa:KB]
// LLSelectMgr::getInstance()->deselectAllForStandingUp();
// gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
setFocus(FALSE);
}
void LLPanelStandStopFlying::onStopFlyingButtonClick()
void LLFloaterMove::onStopFlyingButtonClick()
{
gAgent.setFlying(FALSE);
setFocus(FALSE); // EXT-482
}
/**
* Updates position of the Stand & Stop Flying panel to be center aligned with Move button.
*/
void LLPanelStandStopFlying::updatePosition()
{
if (mAttached) return;
S32 bottom_tb_center = 0;
if (LLToolBar* toolbar_bottom = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_BOTTOM))
{
bottom_tb_center = toolbar_bottom->getRect().getCenterX();
}
S32 left_tb_width = 0;
if (LLToolBar* toolbar_left = gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT))
{
left_tb_width = toolbar_left->getRect().getWidth();
}
if (gToolBarView != NULL && gToolBarView->getToolbar(LLToolBarEnums::TOOLBAR_LEFT)->hasButtons())
{
S32 x_pos = bottom_tb_center - getRect().getWidth() / 2 - left_tb_width;
setOrigin( x_pos, 0);
}
else
{
S32 x_pos = bottom_tb_center - getRect().getWidth() / 2;
setOrigin( x_pos, 0);
}
}
// EOF
......@@ -47,6 +47,12 @@ class LLFloaterMove
LLFloaterMove(const LLSD& key);
~LLFloaterMove();
public:
//BD
typedef enum stand_stop_flying_mode_t
{
SSFM_STAND,
SSFM_STOP_FLYING
} EStandStopFlyingMode;
/*virtual*/ BOOL postBuild();
/*virtual*/ void setVisible(BOOL visible);
......@@ -59,6 +65,10 @@ class LLFloaterMove
static void enableInstance();
/*virtual*/ void onOpen(const LLSD& key);
//BD
void setStandStopFlyingMode(EStandStopFlyingMode mode);
void clearStandStopFlyingMode(EStandStopFlyingMode mode);
// static void sUpdateFlyingStatus();
// [RLVa:KB] - Checked: 2011-05-27 (RLVa-1.4.0a) | Added: RLVa-1.4.0a
static void sUpdateMovementStatus();
......@@ -78,6 +88,7 @@ class LLFloaterMove
MM_RUN,
MM_FLY
} EMovementMode;
void onWalkButtonClick();
void onRunButtonClick();
void onFlyButtonClick();
......@@ -91,6 +102,10 @@ class LLFloaterMove
void updateButtonsWithMovementMode(const EMovementMode newMode);
void showModeButtons(BOOL bShow);
//BD
void onStandButtonClick();
void onStopFlyingButtonClick();
public:
LLJoystickAgentTurn* mForwardButton;
......@@ -101,6 +116,10 @@ class LLFloaterMove
LLButton* mTurnRightButton;
LLButton* mMoveUpButton;
LLButton* mMoveDownButton;
//BD
LLButton* mStandButton;
LLButton* mStopFlyingButton;
private:
LLPanel* mModeActionsPanel;
......@@ -111,77 +130,6 @@ class LLFloaterMove
typedef std::map<EMovementMode, LLButton*> mode_control_button_map_t;
mode_control_button_map_t mModeControlButtonMap;
EMovementMode mCurrentMode;
};
/**
* This class contains Stand Up and Stop Flying buttons displayed above Move button in bottom tray
*/
class LLPanelStandStopFlying : public LLPanel
{
LOG_CLASS(LLPanelStandStopFlying);
public:
typedef enum stand_stop_flying_mode_t
{
SSFM_STAND,
SSFM_STOP_FLYING
} EStandStopFlyingMode;
/**
* Attach or detach the panel to/from the movement controls floater.
*
* Called when the floater gets opened/closed, user sits, stands up or starts/stops flying.
*
* @param move_view The floater to attach to (not always accessible via floater registry).
* If NULL is passed, the panel gets reparented to its original container.
*
* @see mAttached
* @see mOriginalParent
*/
void reparent(LLFloaterMove* move_view);
static LLPanelStandStopFlying* getInstance();
static void setStandStopFlyingMode(EStandStopFlyingMode mode);
static void clearStandStopFlyingMode(EStandStopFlyingMode mode);
/*virtual*/ BOOL postBuild();
/*virtual*/ void setVisible(BOOL visible);
// *HACK: due to hard enough to have this control aligned with "Move" button while resizing
// let update its position in each frame
/*virtual*/ void draw(){updatePosition(); LLPanel::draw();}
/*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
protected:
LLPanelStandStopFlying();
private:
static LLPanelStandStopFlying* getStandStopFlyingPanel();
void onStandButtonClick();
void onStopFlyingButtonClick();
void updatePosition();
LLButton* mStandButton;
LLButton* mStopFlyingButton;
/**
* The original parent of the panel.
*
* Makes it possible to move (reparent) the panel to the movement controls floater and back.
*
* @see reparent()
*/
LLHandle<LLPanel> mOriginalParent;
/**
* True if the panel is currently attached to the movement controls floater.
*
* @see reparent()
* @see updatePosition()
*/
bool mAttached;
};
......
......@@ -88,6 +88,7 @@
#include "llviewerobjectlist.h"
#include "bdsidebar.h"
#include "bdfunctions.h"
#include "bdstatus.h"
#include "llheadrotmotion.h"
// Third party library includes
......@@ -686,6 +687,10 @@ bool toggle_freeze_world(const LLSD& newvalue)
// freeze/thaw everything else
gSavedSettings.setBOOL("FreezeTime", val);
gDragonLibrary.mUseFreezeWorld = val;
//BD
gDragonStatus->setWorldFrozen(val);
return true;
}
......@@ -722,6 +727,19 @@ static bool handleRenderDeferredLightsChanged(const LLSD& newvalue)
return true;
}
//BD - Camera
static bool handleFreeDoFChanged(const LLSD& newvalue)
{
gDragonStatus->setFreeDoF(newvalue.asBoolean());
return true;
}
static bool handleLockDoFChanged(const LLSD& newvalue)
{
gDragonStatus->setLockedDoF(newvalue.asBoolean());
return true;
}
//BD - Always-on Mouse-steering.
static bool handleMouseSteeringChanged(const LLSD& newvalue)
{
......@@ -1215,6 +1233,8 @@ void settings_setup_listeners()
gSavedSettings.getControl("CameraPositionSmoothing")->getSignal()->connect(boost::bind(&handleCameraSmoothing, _2));
gSavedSettings.getControl("PitchFromMousePosition")->getSignal()->connect(boost::bind(&handleEyeConstrainsChanged, _2));
gSavedSettings.getControl("YawFromMousePosition")->getSignal()->connect(boost::bind(&handleHeadConstrainsChanged, _2));
gSavedSettings.getControl("CameraFreeDoFFocus")->getSignal()->connect(boost::bind(&handleFreeDoFChanged, _2));
gSavedSettings.getControl("CameraDoFLocked")->getSignal()->connect(boost::bind(&handleLockDoFChanged, _2));
// //BD - Third Person Steering Mode
gSavedSettings.getControl("EnableThirdPersonSteering")->getSignal()->connect(boost::bind(&handleMouseSteeringChanged, _2));
// //BD - Camera Rolling
......
......@@ -4549,7 +4549,6 @@ class LLViewToggleUI : public view_listener_t
if (option == 0) // OK
{
gViewerWindow->setUIVisibility(gSavedSettings.getBOOL("HideUIControls"));
LLPanelStandStopFlying::getInstance()->setVisible(gSavedSettings.getBOOL("HideUIControls"));
gSavedSettings.setBOOL("HideUIControls",!gSavedSettings.getBOOL("HideUIControls"));
}
}
......
......@@ -218,6 +218,7 @@
//BD
#include "bdsidebar.h"
#include "bdfunctions.h"
#include "bdstatus.h"