Add Develop menu option 'Debug Camera Controls'
parent
43049bcff4
commit
61935a13f4
|
|
@ -60,6 +60,7 @@ static const S32 LINE_HEIGHT = 15;
|
|||
S32 LLView::sDepth = 0;
|
||||
bool LLView::sDebugRects = false;
|
||||
bool LLView::sDebugUnicode = false;
|
||||
bool LLView::sDebugCamera = false;
|
||||
bool LLView::sIsRectDirty = false;
|
||||
LLRect LLView::sDirtyRect;
|
||||
bool LLView::sDebugRectsShowNames = true;
|
||||
|
|
|
|||
|
|
@ -662,6 +662,9 @@ public:
|
|||
// Show hexadecimal byte values of unicode symbols in a tooltip
|
||||
static bool sDebugUnicode;
|
||||
|
||||
// Show camera position and direction in Camera Controls floater
|
||||
static bool sDebugCamera;
|
||||
|
||||
static bool sIsRectDirty;
|
||||
static LLRect sDirtyRect;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "llfirstuse.h"
|
||||
#include "llhints.h"
|
||||
#include "lltabcontainer.h"
|
||||
#include "llviewercamera.h"
|
||||
#include "llvoavatarself.h"
|
||||
|
||||
static LLDefaultChildRegistry::Register<LLPanelCameraItem> r("panel_camera_item");
|
||||
|
|
@ -65,13 +66,19 @@ class LLPanelCameraZoom
|
|||
: public LLPanel
|
||||
{
|
||||
LOG_CLASS(LLPanelCameraZoom);
|
||||
|
||||
public:
|
||||
LLPanelCameraZoom();
|
||||
struct Params : public LLInitParam::Block<Params, LLPanel::Params> {};
|
||||
|
||||
LLPanelCameraZoom() { onCreate(); }
|
||||
|
||||
/* virtual */ BOOL postBuild();
|
||||
/* virtual */ void draw();
|
||||
|
||||
protected:
|
||||
LLPanelCameraZoom(const Params& p) { onCreate(); }
|
||||
|
||||
void onCreate();
|
||||
void onZoomPlusHeldDown();
|
||||
void onZoomMinusHeldDown();
|
||||
void onSliderValueChanged();
|
||||
|
|
@ -80,9 +87,11 @@ protected:
|
|||
F32 getOrbitRate(F32 time);
|
||||
|
||||
private:
|
||||
LLButton* mPlusBtn;
|
||||
LLButton* mMinusBtn;
|
||||
LLSlider* mSlider;
|
||||
LLButton* mPlusBtn { nullptr };
|
||||
LLButton* mMinusBtn{ nullptr };
|
||||
LLSlider* mSlider{ nullptr };
|
||||
|
||||
friend class LLUICtrlFactory;
|
||||
};
|
||||
|
||||
LLPanelCameraItem::Params::Params()
|
||||
|
|
@ -158,10 +167,7 @@ static LLPanelInjector<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel
|
|||
// LLPanelCameraZoom
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
LLPanelCameraZoom::LLPanelCameraZoom()
|
||||
: mPlusBtn( NULL ),
|
||||
mMinusBtn( NULL ),
|
||||
mSlider( NULL )
|
||||
void LLPanelCameraZoom::onCreate()
|
||||
{
|
||||
mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this));
|
||||
mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this));
|
||||
|
|
@ -172,9 +178,9 @@ LLPanelCameraZoom::LLPanelCameraZoom()
|
|||
|
||||
BOOL LLPanelCameraZoom::postBuild()
|
||||
{
|
||||
mPlusBtn = getChild <LLButton> ("zoom_plus_btn");
|
||||
mMinusBtn = getChild <LLButton> ("zoom_minus_btn");
|
||||
mSlider = getChild <LLSlider> ("zoom_slider");
|
||||
mPlusBtn = getChild<LLButton>("zoom_plus_btn");
|
||||
mMinusBtn = getChild<LLButton>("zoom_minus_btn");
|
||||
mSlider = getChild<LLSlider>("zoom_slider");
|
||||
return LLPanel::postBuild();
|
||||
}
|
||||
|
||||
|
|
@ -240,11 +246,59 @@ void activate_camera_tool()
|
|||
LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
|
||||
};
|
||||
|
||||
class LLCameraInfoPanel : public LLPanel
|
||||
{
|
||||
const S32 MARGIN { 10 };
|
||||
|
||||
const char* mTitle;
|
||||
const LLCoordFrame* mCamera;
|
||||
const LLFontGL* mFont;
|
||||
|
||||
public:
|
||||
LLCameraInfoPanel(const LLView* parent, const LLCoordFrame* camera, const char* title)
|
||||
: LLPanel([&]() -> LLPanel::Params
|
||||
{
|
||||
LLPanel::Params params;
|
||||
params.rect = LLRect(parent->getLocalRect());
|
||||
return params;
|
||||
}())
|
||||
, mTitle(title)
|
||||
, mCamera(camera)
|
||||
, mFont(LLFontGL::getFontSansSerifBig())
|
||||
{
|
||||
}
|
||||
|
||||
virtual void draw() override
|
||||
{
|
||||
LLPanel::draw();
|
||||
|
||||
S32 width = getRect().getWidth();
|
||||
S32 height = getRect().getHeight();
|
||||
S32 top = MARGIN / 2 + (height - MARGIN) / 10 * 9;
|
||||
mFont->renderUTF8(mTitle, 0, MARGIN, top, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER);
|
||||
const LLVector3* const vectors[] = { &mCamera->getOrigin(), &mCamera->getXAxis(), &mCamera->getYAxis(), &mCamera->getZAxis() };
|
||||
for (int row = 0; row < 4; ++row)
|
||||
{
|
||||
top -= (height - MARGIN) / 5;
|
||||
static const char* const labels[] = { "Origin:", "X Axis:", "Y Axis:", "Z Axis:" };
|
||||
mFont->renderUTF8(labels[row], 0, MARGIN, top, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER);
|
||||
const LLVector3& vector = *vectors[row];
|
||||
for (int col = 0; col < 3; ++col)
|
||||
{
|
||||
std::string text = llformat("%.6f", vector[col]);
|
||||
S32 right = width / 4 * (col + 2) - MARGIN;
|
||||
mFont->renderUTF8(text, 0, right, top, LLColor4::white, LLFontGL::RIGHT, LLFontGL::VCENTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Member functions
|
||||
//
|
||||
|
||||
/*static*/ bool LLFloaterCamera::inFreeCameraMode()
|
||||
// static
|
||||
bool LLFloaterCamera::inFreeCameraMode()
|
||||
{
|
||||
LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
|
||||
if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
|
||||
|
|
@ -254,6 +308,7 @@ void activate_camera_tool()
|
|||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterCamera::resetCameraMode()
|
||||
{
|
||||
LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
|
||||
|
|
@ -261,6 +316,7 @@ void LLFloaterCamera::resetCameraMode()
|
|||
floater_camera->switchMode(CAMERA_CTRL_MODE_PAN);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterCamera::onAvatarEditingAppearance(bool editing)
|
||||
{
|
||||
sAppearanceEditing = editing;
|
||||
|
|
@ -269,15 +325,44 @@ void LLFloaterCamera::onAvatarEditingAppearance(bool editing)
|
|||
floater_camera->handleAvatarEditingAppearance(editing);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterCamera::onDebugCameraToggled()
|
||||
{
|
||||
if (LLFloaterCamera* instance = LLFloaterCamera::findInstance())
|
||||
{
|
||||
instance->showDebugInfo(LLView::sDebugCamera);
|
||||
}
|
||||
|
||||
if (LLView::sDebugCamera)
|
||||
{
|
||||
LLFloaterReg::showInstanceOrBringToFront("camera");
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterCamera::showDebugInfo(bool show)
|
||||
{
|
||||
// Initially LLPanel contains 1 child "view_border"
|
||||
if (show && mViewerCameraInfo->getChildCount() < 2)
|
||||
{
|
||||
mViewerCameraInfo->addChild(new LLCameraInfoPanel(mViewerCameraInfo, LLViewerCamera::getInstance(), "Viewer Camera"));
|
||||
mAgentCameraInfo->addChild(new LLCameraInfoPanel(mAgentCameraInfo, &gAgent.getFrameAgent(), "Agent Camera"));
|
||||
}
|
||||
|
||||
mAgentCameraInfo->setVisible(show);
|
||||
mViewerCameraInfo->setVisible(show);
|
||||
}
|
||||
|
||||
void LLFloaterCamera::handleAvatarEditingAppearance(bool editing)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LLFloaterCamera::update()
|
||||
{
|
||||
ECameraControlMode mode = determineMode();
|
||||
if (mode != mCurrMode) setMode(mode);
|
||||
if (mode != mCurrMode)
|
||||
{
|
||||
setMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -286,7 +371,8 @@ void LLFloaterCamera::toPrevMode()
|
|||
switchMode(mPrevMode);
|
||||
}
|
||||
|
||||
/*static*/ void LLFloaterCamera::onLeavingMouseLook()
|
||||
// static
|
||||
void LLFloaterCamera::onLeavingMouseLook()
|
||||
{
|
||||
LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
|
||||
if (floater_camera)
|
||||
|
|
@ -320,12 +406,14 @@ void LLFloaterCamera::onOpen(const LLSD& key)
|
|||
mClosed = FALSE;
|
||||
|
||||
populatePresetCombo();
|
||||
|
||||
showDebugInfo(LLView::sDebugCamera);
|
||||
}
|
||||
|
||||
void LLFloaterCamera::onClose(bool app_quitting)
|
||||
{
|
||||
//We don't care of camera mode if app is quitting
|
||||
if(app_quitting)
|
||||
if (app_quitting)
|
||||
return;
|
||||
// It is necessary to reset mCurrMode to CAMERA_CTRL_MODE_PAN so
|
||||
// to avoid seeing an empty floater when reopening the control.
|
||||
|
|
@ -360,14 +448,18 @@ BOOL LLFloaterCamera::postBuild()
|
|||
{
|
||||
updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
|
||||
|
||||
mControls = getChild<LLPanel>("controls");
|
||||
mAgentCameraInfo = getChild<LLPanel>("agent_camera_info");
|
||||
mViewerCameraInfo = getChild<LLPanel>("viewer_camera_info");
|
||||
mRotate = getChild<LLJoystickCameraRotate>(ORBIT);
|
||||
mZoom = findChild<LLPanelCameraZoom>(ZOOM);
|
||||
mZoom = getChild<LLPanelCameraZoom>(ZOOM);
|
||||
mTrack = getChild<LLJoystickCameraTrack>(PAN);
|
||||
mPresetCombo = getChild<LLComboBox>("preset_combo");
|
||||
mPreciseCtrls = getChild<LLTextBox>("precise_ctrs_label");
|
||||
|
||||
getChild<LLTextBox>("precise_ctrs_label")->setShowCursorHand(false);
|
||||
getChild<LLTextBox>("precise_ctrs_label")->setSoundFlags(LLView::MOUSE_UP);
|
||||
getChild<LLTextBox>("precise_ctrs_label")->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), FALSE));
|
||||
mPreciseCtrls->setShowCursorHand(false);
|
||||
mPreciseCtrls->setSoundFlags(LLView::MOUSE_UP);
|
||||
mPreciseCtrls->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), FALSE));
|
||||
|
||||
mPresetCombo->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this));
|
||||
LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCamera::populatePresetCombo, this));
|
||||
|
|
@ -507,6 +599,7 @@ void LLFloaterCamera::updateItemsSelection()
|
|||
getChild<LLPanelCameraItem>("object_view")->setValue(argument);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterCamera::onClickCameraItem(const LLSD& param)
|
||||
{
|
||||
std::string name = param.asString();
|
||||
|
|
@ -533,7 +626,7 @@ void LLFloaterCamera::onClickCameraItem(const LLSD& param)
|
|||
}
|
||||
}
|
||||
|
||||
/*static*/
|
||||
// static
|
||||
void LLFloaterCamera::switchToPreset(const std::string& name)
|
||||
{
|
||||
sFreeCamera = false;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ public:
|
|||
/** Called when Avatar is entered/exited editing appearance mode */
|
||||
static void onAvatarEditingAppearance(bool editing);
|
||||
|
||||
/** Called when opening and when "Advanced | Debug Camera" menu item is toggled */
|
||||
static void onDebugCameraToggled();
|
||||
|
||||
/* determines actual mode and updates ui */
|
||||
void update();
|
||||
|
||||
|
|
@ -77,9 +80,9 @@ public:
|
|||
|
||||
void populatePresetCombo();
|
||||
|
||||
LLJoystickCameraRotate* mRotate;
|
||||
LLPanelCameraZoom* mZoom;
|
||||
LLJoystickCameraTrack* mTrack;
|
||||
LLJoystickCameraRotate* mRotate { nullptr };
|
||||
LLPanelCameraZoom* mZoom { nullptr };
|
||||
LLJoystickCameraTrack* mTrack { nullptr };
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -117,6 +120,8 @@ private:
|
|||
|
||||
void handleAvatarEditingAppearance(bool editing);
|
||||
|
||||
void showDebugInfo(bool show);
|
||||
|
||||
// set to true when free camera mode is selected in modes list
|
||||
// remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed
|
||||
static bool sFreeCamera;
|
||||
|
|
@ -126,7 +131,11 @@ private:
|
|||
ECameraControlMode mCurrMode;
|
||||
std::map<ECameraControlMode, LLButton*> mMode2Button;
|
||||
|
||||
LLComboBox* mPresetCombo;
|
||||
LLPanel* mControls { nullptr };
|
||||
LLPanel* mViewerCameraInfo { nullptr };
|
||||
LLPanel* mAgentCameraInfo { nullptr };
|
||||
LLComboBox* mPresetCombo { nullptr };
|
||||
LLTextBox* mPreciseCtrls { nullptr };
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1462,6 +1462,31 @@ class LLAdvancedCheckDebugUnicode : public view_listener_t
|
|||
|
||||
|
||||
|
||||
//////////////////
|
||||
// DEBUG CAMERA //
|
||||
//////////////////
|
||||
|
||||
|
||||
class LLAdvancedToggleDebugCamera : public view_listener_t
|
||||
{
|
||||
bool handleEvent(const LLSD& userdata)
|
||||
{
|
||||
LLView::sDebugCamera = !(LLView::sDebugCamera);
|
||||
LLFloaterCamera::onDebugCameraToggled();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLAdvancedCheckDebugCamera : public view_listener_t
|
||||
{
|
||||
bool handleEvent(const LLSD& userdata)
|
||||
{
|
||||
return LLView::sDebugCamera;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
///////////////////////
|
||||
// XUI NAME TOOLTIPS //
|
||||
///////////////////////
|
||||
|
|
@ -9543,6 +9568,8 @@ void initialize_menus()
|
|||
view_listener_t::addMenu(new LLAdvancedToggleDebugViews(), "Advanced.ToggleDebugViews");
|
||||
view_listener_t::addMenu(new LLAdvancedCheckDebugUnicode(), "Advanced.CheckDebugUnicode");
|
||||
view_listener_t::addMenu(new LLAdvancedToggleDebugUnicode(), "Advanced.ToggleDebugUnicode");
|
||||
view_listener_t::addMenu(new LLAdvancedCheckDebugCamera(), "Advanced.CheckDebugCamera");
|
||||
view_listener_t::addMenu(new LLAdvancedToggleDebugCamera(), "Advanced.ToggleDebugCamera");
|
||||
view_listener_t::addMenu(new LLAdvancedToggleXUINameTooltips(), "Advanced.ToggleXUINameTooltips");
|
||||
view_listener_t::addMenu(new LLAdvancedCheckXUINameTooltips(), "Advanced.CheckXUINameTooltips");
|
||||
view_listener_t::addMenu(new LLAdvancedToggleDebugMouseEvents(), "Advanced.ToggleDebugMouseEvents");
|
||||
|
|
|
|||
|
|
@ -138,13 +138,13 @@
|
|||
</panel>
|
||||
</panel>
|
||||
<panel
|
||||
follows="all"
|
||||
follows="left|top"
|
||||
height="102"
|
||||
layout="topleft"
|
||||
left_pad="2"
|
||||
right="-2"
|
||||
name="buttons_panel"
|
||||
top="22"
|
||||
width="212">
|
||||
top="22">
|
||||
<panel_camera_item
|
||||
name="front_view"
|
||||
tool_tip="Front View"
|
||||
|
|
@ -253,4 +253,22 @@
|
|||
function="CameraPresets.Save"/>
|
||||
</button>
|
||||
</panel>
|
||||
<panel
|
||||
name="viewer_camera_info"
|
||||
left="0"
|
||||
top="135"
|
||||
width="400"
|
||||
height="130"
|
||||
border="true"
|
||||
visible="false"
|
||||
background_visible="true"/>
|
||||
<panel
|
||||
name="agent_camera_info"
|
||||
left="0"
|
||||
top="265"
|
||||
width="400"
|
||||
height="130"
|
||||
border="true"
|
||||
visible="false"
|
||||
background_visible="true"/>
|
||||
</floater>
|
||||
|
|
|
|||
|
|
@ -3633,6 +3633,14 @@ function="World.EnvPreset"
|
|||
<menu_item_check.on_click
|
||||
function="Advanced.ToggleDebugUnicode" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Debug Camera Controls"
|
||||
name="Debug Camera Controls">
|
||||
<menu_item_check.on_check
|
||||
function="Advanced.CheckDebugCamera" />
|
||||
<menu_item_check.on_click
|
||||
function="Advanced.ToggleDebugCamera" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Debug Name Tooltips"
|
||||
name="Debug Name Tooltips">
|
||||
|
|
|
|||
Loading…
Reference in New Issue