Main toolbar consolidation and cleanup (#1167)
* Moving menu options around * Consolidation and moving of toolbar functioanlity * Fixed non-unity build missing header * Updated camera icon to the correct one * Addressed review feedback * Addressed review feedback * Moved icons to new folder structure/namingmain
parent
36cb0f6d40
commit
593b679fa3
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Camera </title>
|
||||
<g id="Camera-" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Icon-2" fill="#FFFFFF" transform="translate(1.666667, 4.166667)">
|
||||
<path d="M11.5739175,9.2927927 C11.5739175,9.54639717 11.3384276,9.99926232 10.8312187,9.99926232 C10.3240097,9.99926232 2.37169783,10.0264342 2.13620796,10.0264342 C1.74674394,10.0264342 1.33916531,9.69131402 1.33916531,9.09353203 C1.33916531,8.76746913 1.35126587,5.13853395 1.35126587,4.84870026 C1.35126587,4.37772052 1.35727992,4.13013009 1.81014506,4.13013009 C2.2630102,4.13013009 10.840276,4.11201548 10.840276,4.11201548 C11.4199434,4.11201548 11.5829748,4.51959411 11.5829748,4.86377162 C11.5829748,5.20794912 11.5739175,9.03918822 11.5739175,9.2927927 L11.5739175,9.2927927 Z M2.65247422,1.24990779 C2.65247422,1.09593364 2.65247422,0.941959493 2.77927646,0.941959493 L9.83491536,0.941959493 C10.0070041,0.941959493 10.2062648,0.978188705 10.2062648,1.16839206 C10.2062648,1.35859542 10.1972075,2.73530545 10.1972075,2.73530545 L2.64943097,2.7111768 L2.65247422,1.24990779 Z M16.9539554,4.02144245 L16.374288,4.03049976 L14.6896297,5.50684012 L14.2548791,5.50684012 C14.2548791,5.50684012 13.1317736,3.56857731 13.0049713,3.31497283 C12.8781691,3.06136835 12.4615332,2.77153466 12.2622725,2.77153466 L11.139167,2.77153466 C11.139167,2.77153466 11.1210524,0.905730282 11.1210524,0.579667381 C11.1210524,0.253604479 10.8131041,2.81996648e-13 10.4145827,2.81996648e-13 L2.22678099,2.81996648e-13 C1.86144562,2.81996648e-13 1.66522821,0.208317965 1.66522821,0.45887919 L1.66522821,2.69907624 C1.3325716,2.7055975 1.26148988,2.70509029 1.06744623,2.70509029 C0.626681643,2.70509029 0.43343503,2.86812174 0.43343503,3.51423349 L0.43343503,9.83623086 C0.43343503,10.5698724 0.804784446,10.8778207 1.36633722,10.8778207 C1.72862933,10.8778207 11.5920321,10.8687634 12.0992411,10.8687634 C12.60645,10.8687634 12.8238253,10.4340129 13.0049713,10.198523 C13.1861174,9.9630331 14.309223,8.11534333 14.309223,8.11534333 L14.8164319,8.09722872 L16.4558037,9.60074099 L16.97207,9.60074099 L16.9539554,4.02144245 Z" id="Icon"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>debug</title>
|
||||
<g id="debug" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M11.3615865,7.917238 L15.2274672,9.63843901 L16.4675037,9.16172668 C16.6979214,9.07292417 16.9553551,9.18924382 17.0442998,9.41972476 C17.1330234,9.64993705 17.0253844,9.89284574 16.7952509,9.98177479 L16.7952509,9.98177479 L15.3951151,10.4956726 C15.2842902,10.5384499 15.1889358,10.4726675 15.0806503,10.4244557 L15.0806503,10.4244557 L14.1703124,10.0191471 C14.3857263,10.9664393 14.4599954,12.0211666 14.2565873,12.952264 L14.2565873,12.952264 L15.6721159,13.5824979 C15.8976398,13.6829076 15.9908466,13.9650071 15.8904369,14.190531 C15.7900905,14.4159128 15.5180189,14.5355501 15.292495,14.4351404 L15.292495,14.4351404 L13.9556938,13.8399581 C13.6322377,14.54733 13.1335636,15.1766897 12.5630158,15.6037725 L12.5630158,15.6037725 L12.8756514,15.7429668 C12.983937,15.7911787 13.0605157,15.8995144 13.1027401,16.0104336 L13.1027401,16.0104336 L13.6353002,17.4447605 C13.7234077,17.6752093 13.6080984,17.9334334 13.3776496,18.021541 C13.2626228,18.0653422 13.1408059,18.058613 13.0364993,18.0121727 C12.9319085,17.9656059 12.8452864,17.8786807 12.8011855,17.7631798 L12.8011855,17.7631798 L12.3264968,16.520128 L11.644667,16.2165578 C10.4621412,16.7117239 8.87932984,16.9345084 7.56328989,16.4483518 L7.56328989,16.4483518 L11.3615865,7.917238 Z M5.52878415,4.3232224 C5.75937506,4.23517812 6.01946614,4.34552927 6.10779463,4.57624672 L6.10779463,4.57624672 L6.58675456,5.80894035 L10.4526353,7.53014136 L6.6529468,16.0643815 C5.4063142,15.4223335 4.43289769,14.215203 4.07288375,12.8629772 L4.07288375,12.8629772 L3.41379116,12.5695302 L2.17275891,13.0473317 C2.05755786,13.0919067 1.93523585,13.0847824 1.83064504,13.0382156 C1.72633845,12.9917753 1.64104404,12.9033978 1.59654788,12.7884022 C1.5078242,12.5581899 1.62471629,12.294881 1.85492858,12.2061574 L1.85492858,12.2061574 L3.27301757,11.6515537 C3.38384243,11.6087763 3.51545059,11.5931314 3.62387829,11.6414065 L3.62387829,11.6414065 L3.91988732,11.7731982 C3.85933759,11.0651327 3.99592287,10.2745607 4.30516824,9.5608618 L4.30516824,9.5608618 L2.97859873,8.970235 C2.7530748,8.86982528 2.6599312,8.58758374 2.76027765,8.36220193 C2.86068737,8.13667801 3.13269567,8.01718285 3.35821959,8.11759257 L3.35821959,8.11759257 L4.7450425,8.73504591 C5.26222301,7.94364898 6.01359598,7.25652125 6.89624338,6.79811742 L6.89624338,6.79811742 L6.10101221,6.4440577 C5.99258451,6.39578258 5.88032145,6.36759526 5.83803372,6.25681811 L5.83803372,6.25681811 L5.26971048,4.90243425 C5.18174504,4.67204872 5.29833534,4.41132994 5.52878415,4.3232224 Z M10.8942352,2.34455584 C11.1427316,2.24942103 11.4210854,2.3733521 11.5165098,2.62161032 L11.5165098,2.62161032 L11.9777045,3.8224019 C12.2035494,3.86678469 12.4283918,3.93403345 12.6476126,4.03163684 C12.8668334,4.12924023 13.0677354,4.25026013 13.2518379,4.38839772 L13.2518379,4.38839772 L14.4533966,3.92589245 C14.7019612,3.83060445 14.9816108,3.95162483 15.0770352,4.19988305 C15.1723915,4.44829447 15.0509158,4.72113321 14.8025726,4.81633622 L14.8025726,4.81633622 L13.9775725,5.12324418 C14.5520125,5.98310253 14.7248639,7.02632912 14.247419,8.09868801 L14.247419,8.09868801 L8.55503156,5.56427385 C9.03247651,4.49191495 9.9234901,3.92253515 10.946252,3.77379694 L10.946252,3.77379694 L10.6171125,2.96698358 C10.5217563,2.71857217 10.6457388,2.43969065 10.8942352,2.34455584 Z" id="Combined-Shape" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>resolution</title>
|
||||
<g id="resolution" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M17.7222222,2.5 L17.7222222,17.7222222 L2.5,17.7222222 L2.5,2.5 L17.7222222,2.5 Z M16.721,4.45 L3.499,4.45 L3.499,10.111 L10.1293705,10.1111111 L10.129,16.722 L16.722,16.722 L16.721,4.45 Z M9.128,11.722 L3.999,11.722 L4,16.222 L9.129,16.222 L9.128,11.722 Z" id="Combined-Shape" fill="#FFFFFF" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 654 B |
@ -1,394 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "InfoBar.h"
|
||||
|
||||
// Editor
|
||||
#include "MainWindow.h"
|
||||
#include "DisplaySettings.h"
|
||||
#include "GameEngine.h"
|
||||
#include "Include/ITransformManipulator.h"
|
||||
#include "ActionManager.h"
|
||||
#include "Settings.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "MathConversion.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <ui_InfoBar.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
#include <AzQtComponents/Components/Style.h>
|
||||
|
||||
void BeautifyEulerAngles(Vec3& v)
|
||||
{
|
||||
if (v.x + v.y + v.z >= 360.0f)
|
||||
{
|
||||
v.x = 180.0f - v.x;
|
||||
v.y = 180.0f - v.y;
|
||||
v.z = 180.0f - v.z;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CInfoBar dialog
|
||||
CInfoBar::CInfoBar(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::CInfoBar)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_bSelectionChanged = false;
|
||||
m_bDragMode = false;
|
||||
m_prevMoveSpeed = 0;
|
||||
m_currValue = Vec3(-111, +222, -333); //this wasn't initialized. I don't know what a good value is
|
||||
m_oldMainVolume = 1.0f;
|
||||
|
||||
GetIEditor()->RegisterNotifyListener(this);
|
||||
|
||||
//audio request setup
|
||||
m_oMuteAudioRequest.pData = &m_oMuteAudioRequestData;
|
||||
m_oUnmuteAudioRequest.pData = &m_oUnmuteAudioRequestData;
|
||||
|
||||
OnInitDialog();
|
||||
|
||||
auto comboBoxTextChanged = static_cast<void(QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged);
|
||||
connect(ui->m_moveSpeed, comboBoxTextChanged, this, &CInfoBar::OnUpdateMoveSpeedText);
|
||||
connect(ui->m_moveSpeed->lineEdit(), &QLineEdit::returnPressed, this, &CInfoBar::OnSpeedComboBoxEnter);
|
||||
|
||||
// Hide some buttons from the expander menu
|
||||
AzQtComponents::Style::addClass(ui->m_physDoStepBtn, "expanderMenu_hide");
|
||||
AzQtComponents::Style::addClass(ui->m_physSingleStepBtn, "expanderMenu_hide");
|
||||
|
||||
connect(ui->m_physicsBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedPhysics);
|
||||
connect(ui->m_physSingleStepBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedSingleStepPhys);
|
||||
connect(ui->m_physDoStepBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedDoStepPhys);
|
||||
connect(ui->m_syncPlayerBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedSyncplayer);
|
||||
connect(ui->m_gotoPos, &QToolButton::clicked, this, &CInfoBar::OnBnClickedGotoPosition);
|
||||
connect(ui->m_muteBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedMuteAudio);
|
||||
connect(ui->m_vrBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedEnableVR);
|
||||
|
||||
connect(this, &CInfoBar::ActionTriggered, MainWindow::instance()->GetActionManager(), &ActionManager::ActionTriggered);
|
||||
|
||||
connect(ui->m_physicsBtn, &QAbstractButton::toggled, ui->m_physicsBtn, [this](bool checked) {
|
||||
ui->m_physicsBtn->setToolTip(checked ? tr("Stop Simulation (Ctrl+P)") : tr("Simulate (Ctrl+P)"));
|
||||
});
|
||||
connect(ui->m_physSingleStepBtn, &QAbstractButton::toggled, ui->m_physSingleStepBtn, [this](bool checked) {
|
||||
ui->m_physSingleStepBtn->setToolTip(checked ? tr("Disable Physics/AI Single-step Mode ('<' in Game Mode)") : tr("Enable Physics/AI Single-step Mode ('<' in Game Mode)"));
|
||||
});
|
||||
connect(ui->m_syncPlayerBtn, &QAbstractButton::toggled, ui->m_syncPlayerBtn, [this](bool checked) {
|
||||
ui->m_syncPlayerBtn->setToolTip(checked ? tr("Synchronize Player with Camera") : tr("Move Player and Camera Separately"));
|
||||
});
|
||||
connect(ui->m_muteBtn, &QAbstractButton::toggled, ui->m_muteBtn, [this](bool checked) {
|
||||
ui->m_muteBtn->setToolTip(checked ? tr("Un-mute Audio") : tr("Mute Audio"));
|
||||
});
|
||||
connect(ui->m_vrBtn, &QAbstractButton::toggled, ui->m_vrBtn, [this](bool checked) {
|
||||
ui->m_vrBtn->setToolTip(checked ? tr("Disable VR Preview") : tr("Enable VR Preview"));
|
||||
});
|
||||
|
||||
ui->m_moveSpeed->setValidator(new QDoubleValidator(m_minSpeed, m_maxSpeed, m_numDecimals, ui->m_moveSpeed));
|
||||
|
||||
// Save off the move speed here since setting up the combo box can cause it to update values in the background.
|
||||
float cameraMoveSpeed = gSettings.cameraMoveSpeed;
|
||||
|
||||
// Populate the presets in the ComboBox
|
||||
for (float presetValue : m_speedPresetValues)
|
||||
{
|
||||
ui->m_moveSpeed->addItem(QString().setNum(presetValue, 'f', m_numDecimals), presetValue);
|
||||
}
|
||||
|
||||
SetSpeedComboBox(cameraMoveSpeed);
|
||||
|
||||
ui->m_moveSpeed->setInsertPolicy(QComboBox::NoInsert);
|
||||
|
||||
using namespace AzToolsFramework::ComponentModeFramework;
|
||||
EditorComponentModeNotificationBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CInfoBar::~CInfoBar()
|
||||
{
|
||||
using namespace AzToolsFramework::ComponentModeFramework;
|
||||
EditorComponentModeNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
|
||||
AZ::VR::VREventBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CInfoBar::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
if (event == eNotify_OnIdleUpdate)
|
||||
{
|
||||
IdleUpdate();
|
||||
}
|
||||
else if (event == eNotify_OnBeginGameMode || event == eNotify_OnEndGameMode)
|
||||
{
|
||||
// Audio: determine muted state of audio
|
||||
//m_bMuted = gEnv->pAudioSystem->GetMainVolume() == 0.f;
|
||||
ui->m_muteBtn->setChecked(gSettings.bMuteAudio);
|
||||
}
|
||||
else if (event == eNotify_OnBeginLoad || event == eNotify_OnCloseScene)
|
||||
{
|
||||
// make sure AI/Physics is disabled on level load (CE-4229)
|
||||
if (GetIEditor()->GetGameEngine()->GetSimulationMode())
|
||||
{
|
||||
OnBnClickedPhysics();
|
||||
}
|
||||
|
||||
ui->m_physicsBtn->setEnabled(false);
|
||||
ui->m_physSingleStepBtn->setEnabled(false);
|
||||
ui->m_physDoStepBtn->setEnabled(false);
|
||||
}
|
||||
else if (event == eNotify_OnEndLoad || event == eNotify_OnEndNewScene)
|
||||
{
|
||||
ui->m_physicsBtn->setEnabled(true);
|
||||
ui->m_physSingleStepBtn->setEnabled(true);
|
||||
ui->m_physDoStepBtn->setEnabled(true);
|
||||
}
|
||||
else if (event == eNotify_OnSelectionChange)
|
||||
{
|
||||
m_bSelectionChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CInfoBar::IdleUpdate()
|
||||
{
|
||||
if (!m_idleUpdateEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool updateUI = false;
|
||||
// Update Width/Height of selection rectangle.
|
||||
AABB box;
|
||||
GetIEditor()->GetSelectedRegion(box);
|
||||
float width = box.max.x - box.min.x;
|
||||
float height = box.max.y - box.min.y;
|
||||
if (m_width != width || m_height != height)
|
||||
{
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
updateUI = true;
|
||||
}
|
||||
|
||||
Vec3 marker = GetIEditor()->GetMarkerPosition();
|
||||
|
||||
int selectedEntitiesCount = 0;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount);
|
||||
if (selectedEntitiesCount != m_numSelected)
|
||||
{
|
||||
m_numSelected = selectedEntitiesCount;
|
||||
updateUI = true;
|
||||
}
|
||||
|
||||
QString str;
|
||||
if (updateUI)
|
||||
{
|
||||
if (m_numSelected == 0)
|
||||
{
|
||||
str = tr("None Selected");
|
||||
}
|
||||
else if (m_numSelected == 1)
|
||||
{
|
||||
str = tr("1 Object Selected");
|
||||
}
|
||||
else
|
||||
{
|
||||
str = tr("%1 Objects Selected").arg(m_numSelected);
|
||||
}
|
||||
|
||||
ui->m_statusText->setText(str);
|
||||
m_sLastText = str;
|
||||
}
|
||||
|
||||
if (gSettings.cameraMoveSpeed != m_prevMoveSpeed &&
|
||||
!ui->m_moveSpeed->lineEdit()->hasFocus())
|
||||
{
|
||||
m_prevMoveSpeed = gSettings.cameraMoveSpeed;
|
||||
SetSpeedComboBox(gSettings.cameraMoveSpeed);
|
||||
}
|
||||
|
||||
{
|
||||
bool bPhysics = GetIEditor()->GetGameEngine()->GetSimulationMode();
|
||||
if ((ui->m_physicsBtn->isChecked() && !bPhysics) ||
|
||||
(!ui->m_physicsBtn->isChecked() && bPhysics))
|
||||
{
|
||||
ui->m_physicsBtn->setChecked(bPhysics);
|
||||
}
|
||||
|
||||
// Unsupported for Phyics:: atm
|
||||
bool bSingleStep = false;
|
||||
if (ui->m_physSingleStepBtn->isChecked() != bSingleStep)
|
||||
{
|
||||
ui->m_physSingleStepBtn->setChecked(bSingleStep);
|
||||
}
|
||||
|
||||
bool bSyncPlayer = GetIEditor()->GetGameEngine()->IsSyncPlayerPosition();
|
||||
if ((!ui->m_syncPlayerBtn->isChecked() && !bSyncPlayer) ||
|
||||
(ui->m_syncPlayerBtn->isChecked() && bSyncPlayer))
|
||||
{
|
||||
ui->m_syncPlayerBtn->setChecked(!bSyncPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
// if our selection changed, or if our display values are out of date
|
||||
if (m_bSelectionChanged)
|
||||
{
|
||||
m_bSelectionChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
inline double Round(double fVal, double fStep)
|
||||
{
|
||||
if (fStep > 0.f)
|
||||
{
|
||||
fVal = int_round(fVal / fStep) * fStep;
|
||||
}
|
||||
return fVal;
|
||||
}
|
||||
|
||||
void CInfoBar::OnUpdateMoveSpeedText(const QString& text)
|
||||
{
|
||||
gSettings.cameraMoveSpeed = aznumeric_cast<float>(Round(text.toDouble(), m_speedStep));
|
||||
}
|
||||
|
||||
void CInfoBar::OnSpeedComboBoxEnter()
|
||||
{
|
||||
ui->m_moveSpeed->clearFocus();
|
||||
}
|
||||
|
||||
void CInfoBar::OnInitDialog()
|
||||
{
|
||||
QFontMetrics metrics({});
|
||||
int width = metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier;
|
||||
|
||||
ui->m_moveSpeed->setFixedWidth(width);
|
||||
|
||||
ui->m_physicsBtn->setEnabled(false);
|
||||
ui->m_physSingleStepBtn->setEnabled(false);
|
||||
ui->m_physDoStepBtn->setEnabled(false);
|
||||
|
||||
ui->m_muteBtn->setChecked(gSettings.bMuteAudio);
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequest, gSettings.bMuteAudio ? m_oMuteAudioRequest : m_oUnmuteAudioRequest);
|
||||
|
||||
//This is here just in case this class hasn't been created before
|
||||
//a VR headset was initialized
|
||||
ui->m_vrBtn->setEnabled(false);
|
||||
if (AZ::VR::HMDDeviceRequestBus::GetTotalNumOfEventHandlers() != 0)
|
||||
{
|
||||
ui->m_vrBtn->setEnabled(true);
|
||||
}
|
||||
|
||||
AZ::VR::VREventBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void CInfoBar::OnHMDInitialized()
|
||||
{
|
||||
ui->m_vrBtn->setEnabled(true);
|
||||
}
|
||||
|
||||
void CInfoBar::OnHMDShutdown()
|
||||
{
|
||||
ui->m_vrBtn->setEnabled(false);
|
||||
}
|
||||
|
||||
void CInfoBar::OnBnClickedTerrainCollision()
|
||||
{
|
||||
emit ActionTriggered(ID_TERRAIN_COLLISION);
|
||||
}
|
||||
|
||||
void CInfoBar::OnBnClickedPhysics()
|
||||
{
|
||||
if (!ui->m_physicsBtn->isEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool bPhysics = GetIEditor()->GetGameEngine()->GetSimulationMode();
|
||||
ui->m_physicsBtn->setChecked(bPhysics);
|
||||
emit ActionTriggered(ID_SWITCH_PHYSICS);
|
||||
|
||||
if (bPhysics && ui->m_physSingleStepBtn->isChecked())
|
||||
{
|
||||
OnBnClickedSingleStepPhys();
|
||||
}
|
||||
}
|
||||
|
||||
void CInfoBar::OnBnClickedSingleStepPhys()
|
||||
{
|
||||
}
|
||||
|
||||
void CInfoBar::OnBnClickedDoStepPhys()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CInfoBar::OnBnClickedSyncplayer()
|
||||
{
|
||||
emit ActionTriggered(ID_GAME_SYNCPLAYER);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CInfoBar::OnBnClickedGotoPosition()
|
||||
{
|
||||
emit ActionTriggered(ID_DISPLAY_GOTOPOSITION);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CInfoBar::OnBnClickedMuteAudio()
|
||||
{
|
||||
gSettings.bMuteAudio = !gSettings.bMuteAudio;
|
||||
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequest, gSettings.bMuteAudio ? m_oMuteAudioRequest : m_oUnmuteAudioRequest);
|
||||
|
||||
ui->m_muteBtn->setChecked(gSettings.bMuteAudio);
|
||||
}
|
||||
|
||||
void CInfoBar::OnBnClickedEnableVR()
|
||||
{
|
||||
gSettings.bEnableGameModeVR = !gSettings.bEnableGameModeVR;
|
||||
ui->m_vrBtn->setChecked(gSettings.bEnableGameModeVR);
|
||||
}
|
||||
|
||||
void CInfoBar::EnteredComponentMode(const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
|
||||
{
|
||||
ui->m_physicsBtn->setDisabled(true);
|
||||
}
|
||||
|
||||
void CInfoBar::LeftComponentMode(const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
|
||||
{
|
||||
ui->m_physicsBtn->setEnabled(true);
|
||||
}
|
||||
|
||||
void CInfoBar::SetSpeedComboBox(double value)
|
||||
{
|
||||
value = AZStd::clamp(Round(value, m_speedStep), m_minSpeed, m_maxSpeed);
|
||||
|
||||
int index = ui->m_moveSpeed->findData(value);
|
||||
if (index != -1)
|
||||
{
|
||||
ui->m_moveSpeed->setCurrentIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->m_moveSpeed->lineEdit()->setText(QString().setNum(value, 'f', m_numDecimals));
|
||||
}
|
||||
}
|
||||
|
||||
#include <moc_InfoBar.cpp>
|
||||
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_INFOBAR_H
|
||||
#define CRYINCLUDE_EDITOR_INFOBAR_H
|
||||
|
||||
#pragma once
|
||||
// InfoBar.h : header file
|
||||
//
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
|
||||
#include <IAudioSystem.h>
|
||||
#include <HMDBus.h>
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CInfoBar dialog
|
||||
|
||||
namespace Ui {
|
||||
class CInfoBar;
|
||||
}
|
||||
|
||||
class CInfoBar
|
||||
: public QWidget
|
||||
, public IEditorNotifyListener
|
||||
, public AZ::VR::VREventBus::Handler
|
||||
, private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CInfoBar(QWidget* parent = nullptr);
|
||||
~CInfoBar();
|
||||
|
||||
// Toggle the mute audio button
|
||||
void ToggleAudio() { OnBnClickedMuteAudio(); }
|
||||
void SetSpeedComboBox(double value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void ActionTriggered(int command);
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
void IdleUpdate();
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
|
||||
virtual void OnOK() {};
|
||||
virtual void OnCancel() {};
|
||||
|
||||
void OnBnClickedSyncplayer();
|
||||
void OnBnClickedGotoPosition();
|
||||
|
||||
void OnSpeedComboBoxEnter();
|
||||
void OnUpdateMoveSpeedText(const QString&);
|
||||
void OnBnClickedTerrainCollision();
|
||||
void OnBnClickedPhysics();
|
||||
void OnBnClickedSingleStepPhys();
|
||||
void OnBnClickedDoStepPhys();
|
||||
void OnBnClickedMuteAudio();
|
||||
void OnBnClickedEnableVR();
|
||||
void OnInitDialog();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/// VR Event Bus Implementation
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void OnHMDInitialized() override;
|
||||
void OnHMDShutdown() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// EditorComponentModeNotificationBus
|
||||
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
|
||||
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
|
||||
|
||||
float m_width, m_height;
|
||||
//int m_heightMapX,m_heightMapY;
|
||||
double m_fieldWidthMultiplier = 1.8;
|
||||
|
||||
int m_numSelected;
|
||||
float m_prevMoveSpeed;
|
||||
|
||||
// Speed combobox/lineEdit settings
|
||||
double m_minSpeed = 0.1;
|
||||
double m_maxSpeed = 100.0;
|
||||
double m_speedStep = 0.1;
|
||||
int m_numDecimals = 1;
|
||||
|
||||
// Speed presets
|
||||
float m_speedPresetValues[3] = { 0.1f, 1.0f, 10.0f };
|
||||
|
||||
bool m_bSelectionChanged;
|
||||
|
||||
bool m_bDragMode;
|
||||
QString m_sLastText;
|
||||
|
||||
Vec3 m_lastValue;
|
||||
Vec3 m_currValue;
|
||||
float m_oldMainVolume;
|
||||
|
||||
Audio::SAudioRequest m_oMuteAudioRequest;
|
||||
Audio::SAudioManagerRequestData<Audio::eAMRT_MUTE_ALL> m_oMuteAudioRequestData;
|
||||
Audio::SAudioRequest m_oUnmuteAudioRequest;
|
||||
Audio::SAudioManagerRequestData<Audio::eAMRT_UNMUTE_ALL> m_oUnmuteAudioRequestData;
|
||||
|
||||
QScopedPointer<Ui::CInfoBar> ui;
|
||||
|
||||
bool m_idleUpdateEnabled = true;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_INFOBAR_H
|
||||
@ -1,333 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CInfoBar</class>
|
||||
<widget class="QWidget" name="CInfoBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1600</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">b</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetFixedSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_statusText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No Objects Selected</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_gotoPos">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Go to Position</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go to Position</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/GotoLocation-default.svg</normaloff>:/InfoBar/GotoLocation-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Speed</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_moveSpeed">
|
||||
<property name="toolTip">
|
||||
<string>Camera Movement Speed</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_syncPlayerBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Synchronize Player with Camera</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Synchronize Player with Camera</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/NoPlayerSync-default.svg</normaloff>
|
||||
<activeon>:/InfoBar/NoPlayerSync-selected.svg</activeon>
|
||||
:/InfoBar/NoPlayerSync-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_physicsBtn">
|
||||
<property name="toolTip">
|
||||
<string>Simulate (Ctrl+P)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Simulate (Ctrl+P)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/PhysicsCol-default.svg</normaloff>:/InfoBar/PhysicsCol-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_physSingleStepBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enable Physics/AI Single-step Mode ('<' in Game Mode)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Physics/AI Single-step Mode ('<' in Game Mode)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/Pause-default.svg</normaloff>:/InfoBar/Pause-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_physDoStepBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Perform a Single Physics/AI Simulation Step ('>' in Game Mode)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Perform a Single Physics/AI Simulation Step ('>' in Game Mode)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/PausePlay-default.svg</normaloff>:/InfoBar/PausePlay-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_muteBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Mute Audio</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mute Audio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/Mute-default.svg</normaloff>:/InfoBar/Mute-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="m_vrBtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enable VR Preview</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable VR Preview</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="InfoBar.qrc">
|
||||
<normaloff>:/InfoBar/VR-default.svg</normaloff>:/InfoBar/VR-default.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="InfoBar.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Reference in New Issue