Add toolbar for anim viewport and some more camera controls.
Signed-off-by: rhhong <rhhong@amazon.com>monroegm-disable-blank-issue-2
parent
960e3fc1b9
commit
13781a759f
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 60 (88103) - https://sketch.com -->
|
||||
<title>Icons / Video Control / Video</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Icons-/-Video-Control-/-Video" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<rect id="Path" fill-opacity="0" fill="#E9E9E9" x="0" y="0" width="24" height="24"></rect>
|
||||
<polygon id="Combined-Shape" fill="#FFFFFF" points="20 19 15 14 15 20 2 20 2 4 15 4 15 10 20 5 22 5 22 19"></polygon>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 681 B |
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/EMotionFXAtom">
|
||||
<file>Camera_category.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
|
||||
|
||||
namespace EMStudio
|
||||
{
|
||||
enum CameraViewMode
|
||||
{
|
||||
FRONT,
|
||||
BACK,
|
||||
TOP,
|
||||
BOTTOM,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
DEFAULT
|
||||
};
|
||||
|
||||
class AnimViewportRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
|
||||
//! Reset the camera to initial state.
|
||||
virtual void ResetCamera() = 0;
|
||||
|
||||
//! Set the camera view mode.
|
||||
virtual void SetCameraViewMode(CameraViewMode mode) = 0;
|
||||
};
|
||||
|
||||
using AnimViewportRequestBus = AZ::EBus<AnimViewportRequests>;
|
||||
} // namespace EMStudio
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QMenu>
|
||||
#include <EMStudio/AnimViewportToolBar.h>
|
||||
#include <EMStudio/AnimViewportRequestBus.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzQtComponents/Components/Widgets/ToolBar.h>
|
||||
|
||||
|
||||
namespace EMStudio
|
||||
{
|
||||
AnimViewportToolBar::AnimViewportToolBar(QWidget* parent)
|
||||
: QToolBar(parent)
|
||||
{
|
||||
AzQtComponents::ToolBar::addMainToolBarStyle(this);
|
||||
|
||||
// Add the camera button
|
||||
QToolButton* cameraButton = new QToolButton(this);
|
||||
QMenu* cameraMenu = new QMenu(cameraButton);
|
||||
|
||||
// Add the camera option
|
||||
const AZStd::vector<AZStd::pair<CameraViewMode, AZStd::string>> cameraOptionNames = {
|
||||
{ CameraViewMode::FRONT, "Front" }, { CameraViewMode::BACK, "Back" }, { CameraViewMode::TOP, "Top" },
|
||||
{ CameraViewMode::BOTTOM, "Bottom" }, { CameraViewMode::LEFT, "Left" }, { CameraViewMode::RIGHT, "Right" },
|
||||
};
|
||||
|
||||
for (const auto& pair : cameraOptionNames)
|
||||
{
|
||||
CameraViewMode mode = pair.first;
|
||||
cameraMenu->addAction(
|
||||
pair.second.c_str(),
|
||||
[mode]()
|
||||
{
|
||||
// Send the reset camera event.
|
||||
AnimViewportRequestBus::Broadcast(&AnimViewportRequestBus::Events::SetCameraViewMode, mode);
|
||||
});
|
||||
}
|
||||
|
||||
cameraMenu->addSeparator();
|
||||
cameraMenu->addAction("Reset Camera",
|
||||
[]()
|
||||
{
|
||||
// Send the reset camera event.
|
||||
AnimViewportRequestBus::Broadcast(&AnimViewportRequestBus::Events::ResetCamera);
|
||||
});
|
||||
cameraButton->setMenu(cameraMenu);
|
||||
cameraButton->setText("Camera Option");
|
||||
cameraButton->setPopupMode(QToolButton::InstantPopup);
|
||||
cameraButton->setVisible(true);
|
||||
cameraButton->setIcon(QIcon(":/EMotionFXAtom/Camera_category.svg"));
|
||||
addWidget(cameraButton);
|
||||
}
|
||||
} // namespace EMStudio
|
||||
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QAction>
|
||||
#include <QToolBar>
|
||||
#endif
|
||||
|
||||
namespace EMStudio
|
||||
{
|
||||
class AnimViewportToolBar : public QToolBar
|
||||
{
|
||||
public:
|
||||
AnimViewportToolBar(QWidget* parent = nullptr);
|
||||
~AnimViewportToolBar() = default;
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue