Gems/LyShine

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-20 17:59:06 -07:00
parent 794d656c66
commit 3c56faceb4
20 changed files with 14 additions and 47 deletions
@@ -824,8 +824,6 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float
{ {
const QPen pOldPen = painter->pen(); const QPen pOldPen = painter->pen();
const QRect rcClip = painter->clipBoundingRect().intersected(m_rcSpline).toRect();
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
ISplineInterpolator* pSpline = splineInfo.pSpline; ISplineInterpolator* pSpline = splineInfo.pSpline;
ISplineInterpolator* pDetailSpline = splineInfo.pDetailSpline; ISplineInterpolator* pDetailSpline = splineInfo.pDetailSpline;
@@ -134,7 +134,6 @@ protected:
void DrawFrameTicks(QPainter* dc); void DrawFrameTicks(QPainter* dc);
private: private:
bool m_bAutoDelete;
QRect m_rcClient; QRect m_rcClient;
QRect m_rcTimeline; QRect m_rcTimeline;
float m_fTimeMarker; float m_fTimeMarker;
@@ -149,8 +149,6 @@ void CUiAnimViewAnimNode::UiElementPropertyChanged()
bool valueChanged = false; bool valueChanged = false;
const float time = GetSequence()->GetTime();
if (m_nodeEntityId.IsValid() && !m_azEntityDataCache.empty()) if (m_nodeEntityId.IsValid() && !m_azEntityDataCache.empty())
{ {
AZ::Entity* pNodeEntity = nullptr; AZ::Entity* pNodeEntity = nullptr;
@@ -537,9 +535,6 @@ void CUiAnimViewAnimNode::BindToEditorObjects()
CUiAnimViewSequenceNotificationContext context(GetSequence()); CUiAnimViewSequenceNotificationContext context(GetSequence());
CUiAnimViewAnimNode* pDirector = GetDirector();
const bool bBelongsToActiveDirector = pDirector ? pDirector->IsActiveDirector() : true;
// if this node represents an AZ entity then register for updates // if this node represents an AZ entity then register for updates
if (m_nodeEntityId.IsValid()) if (m_nodeEntityId.IsValid())
{ {
@@ -1632,7 +1627,7 @@ void CUiAnimViewAnimNode::OnSelectionChanged(const bool bSelected)
{ {
if (m_pAnimNode) if (m_pAnimNode)
{ {
const EUiAnimNodeType animNodeType = GetType(); [[maybe_unused]] const EUiAnimNodeType animNodeType = GetType();
assert(animNodeType == eUiAnimNodeType_Camera || animNodeType == eUiAnimNodeType_Entity || animNodeType == eUiAnimNodeType_GeomCache); assert(animNodeType == eUiAnimNodeType_Camera || animNodeType == eUiAnimNodeType_Entity || animNodeType == eUiAnimNodeType_GeomCache);
const EUiAnimNodeFlags flags = (EUiAnimNodeFlags)m_pAnimNode->GetFlags(); const EUiAnimNodeFlags flags = (EUiAnimNodeFlags)m_pAnimNode->GetFlags();
@@ -192,7 +192,6 @@ void CUiAnimViewDopeSheetBase::SetTimeRange(float start, float end)
void CUiAnimViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime) void CUiAnimViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime)
{ {
const double fOldOffset = -fAnchorTime * m_timeScale; const double fOldOffset = -fAnchorTime * m_timeScale;
const double fOldScale = m_timeScale;
timeScale = std::max(timeScale, 0.001f); timeScale = std::max(timeScale, 0.001f);
timeScale = std::min(timeScale, 100000.0f); timeScale = std::min(timeScale, 100000.0f);
@@ -1308,8 +1307,6 @@ void CUiAnimViewDopeSheetBase::OnCaptureChanged()
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
bool CUiAnimViewDopeSheetBase::IsOkToAddKeyHere(const CUiAnimViewTrack* pTrack, float time) const bool CUiAnimViewDopeSheetBase::IsOkToAddKeyHere(const CUiAnimViewTrack* pTrack, float time) const
{ {
const float timeEpsilon = 0.05f;
for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i) for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i)
{ {
CUiAnimViewKeyHandle keyHandle = const_cast<CUiAnimViewTrack*>(pTrack)->GetKey(i); CUiAnimViewKeyHandle keyHandle = const_cast<CUiAnimViewTrack*>(pTrack)->GetKey(i);
@@ -1795,8 +1792,6 @@ void CUiAnimViewDopeSheetBase::AcceptUndo()
{ {
if (UiAnimUndo::IsRecording()) if (UiAnimUndo::IsRecording())
{ {
const QPoint mousePos = mapFromGlobal(QCursor::pos());
if (m_mouseMode == eUiAVMouseMode_Paste) if (m_mouseMode == eUiAVMouseMode_Paste)
{ {
UiAnimUndoManager::Get()->Cancel(); UiAnimUndoManager::Get()->Cancel();
@@ -2242,7 +2237,6 @@ void CUiAnimViewDopeSheetBase::DrawBoolTrack(const Range& timeRange, QPainter* p
{ {
int x0 = TimeToClient(timeRange.start); int x0 = TimeToClient(timeRange.start);
float t0 = timeRange.start; float t0 = timeRange.start;
QRect trackRect;
const QBrush prevBrush = painter->brush(); const QBrush prevBrush = painter->brush();
painter->setBrush(m_visibilityBrush); painter->setBrush(m_visibilityBrush);
@@ -19,13 +19,11 @@ class CUiAnimViewKeyConstHandle
{ {
public: public:
CUiAnimViewKeyConstHandle() CUiAnimViewKeyConstHandle()
: m_bIsValid(false) : m_keyIndex(0)
, m_keyIndex(0)
, m_pTrack(nullptr) {} , m_pTrack(nullptr) {}
CUiAnimViewKeyConstHandle(const CUiAnimViewTrack* pTrack, unsigned int keyIndex) CUiAnimViewKeyConstHandle(const CUiAnimViewTrack* pTrack, unsigned int keyIndex)
: m_bIsValid(true) : m_keyIndex(keyIndex)
, m_keyIndex(keyIndex)
, m_pTrack(pTrack) {} , m_pTrack(pTrack) {}
void GetKey(IKey* pKey) const; void GetKey(IKey* pKey) const;
@@ -33,7 +31,6 @@ public:
const CUiAnimViewTrack* GetTrack() const { return m_pTrack; } const CUiAnimViewTrack* GetTrack() const { return m_pTrack; }
private: private:
bool m_bIsValid;
unsigned int m_keyIndex; unsigned int m_keyIndex;
const CUiAnimViewTrack* m_pTrack; const CUiAnimViewTrack* m_pTrack;
}; };
@@ -1096,9 +1096,6 @@ void CUiAnimViewNodesCtrl::AddGroupNodeAddItems(UiAnimContextMenu& contextMenu,
contextMenu.main.addAction("Add Event Node")->setData(eMI_AddEvent); contextMenu.main.addAction("Add Event Node")->setData(eMI_AddEvent);
} }
const bool bIsDirectorOrSequence = (pAnimNode->GetType() == eUiAnimNodeType_Director || pAnimNode->GetNodeType() == eUiAVNT_Sequence);
#if UI_ANIMATION_REMOVED #if UI_ANIMATION_REMOVED
contextMenu.main.addAction("Add Comment Node")->setData(eMI_AddCommentNode); contextMenu.main.addAction("Add Comment Node")->setData(eMI_AddCommentNode);
contextMenu.main.addAction("Add Console Variable")->setData(eMI_AddConsoleVariable); contextMenu.main.addAction("Add Console Variable")->setData(eMI_AddConsoleVariable);
@@ -182,7 +182,6 @@ private:
// Drag and drop // Drag and drop
CUiAnimViewAnimNodeBundle m_draggedNodes; CUiAnimViewAnimNodeBundle m_draggedNodes;
CUiAnimViewAnimNode* m_pDragTarget;
std::unordered_map<const CUiAnimViewNode*, CRecord*> m_nodeToRecordMap; std::unordered_map<const CUiAnimViewNode*, CRecord*> m_nodeToRecordMap;
@@ -488,11 +488,12 @@ void CUiAnimViewSequence::SelectSelectedNodesInViewport()
assert(UiAnimUndo::IsRecording()); assert(UiAnimUndo::IsRecording());
CUiAnimViewAnimNodeBundle selectedNodes = GetSelectedAnimNodes(); CUiAnimViewAnimNodeBundle selectedNodes = GetSelectedAnimNodes();
const unsigned int numSelectedNodes = selectedNodes.GetCount();
std::vector<CBaseObject*> entitiesToBeSelected; std::vector<CBaseObject*> entitiesToBeSelected;
#if UI_ANIMATION_REMOVED // lights #if UI_ANIMATION_REMOVED // lights
const unsigned int numSelectedNodes = selectedNodes.GetCount();
// Also select objects that refer to light animation // Also select objects that refer to light animation
const bool bLightAnimationSetActive = GetFlags() & IUiAnimSequence::eSeqFlags_LightAnimationSet; const bool bLightAnimationSetActive = GetFlags() & IUiAnimSequence::eSeqFlags_LightAnimationSet;
if (bLightAnimationSetActive) if (bLightAnimationSetActive)
@@ -589,7 +589,6 @@ void CUiAnimViewSplineCtrl::mouseMoveEvent(QMouseEvent* event)
CUiAnimViewSequenceNotificationContext context(pSequence); CUiAnimViewSequenceNotificationContext context(pSequence);
QPoint cMousePosPrev = m_cMousePos;
m_cMousePos = point; m_cMousePos = point;
if (m_editMode == SelectMode) if (m_editMode == SelectMode)
+1 -1
View File
@@ -704,7 +704,7 @@ void EditorWindow::AddMenu_View()
action->setEnabled(canvasLoaded); action->setEnabled(canvasLoaded);
QObject::connect(action, QObject::connect(action,
&QAction::triggered, &QAction::triggered,
[this]([[maybe_unused]] bool checked) []([[maybe_unused]] bool checked)
{ {
gEnv->pCryFont->ReloadAllFonts(); gEnv->pCryFont->ReloadAllFonts();
}); });
+1 -1
View File
@@ -330,7 +330,7 @@ void HierarchyMenu::SliceMenuItems(HierarchyWidget* hierarchy,
slicesAddedToMenu.push_back(sliceAsset.GetId()); slicesAddedToMenu.push_back(sliceAsset.GetId());
QAction* action = menu->addAction(assetPath.c_str()); QAction* action = menu->addAction(assetPath.c_str());
QObject::connect(action, &QAction::triggered, [this, hierarchy, sliceAsset] QObject::connect(action, &QAction::triggered, [hierarchy, sliceAsset]
{ {
hierarchy->GetEditorWindow()->EditSliceInNewTab(sliceAsset.GetId()); hierarchy->GetEditorWindow()->EditSliceInNewTab(sliceAsset.GetId());
} }
+1 -1
View File
@@ -32,7 +32,7 @@ MainToolbar::MainToolbar(EditorWindow* parent)
QObject::connect(m_zoomFactorSpinBox, QObject::connect(m_zoomFactorSpinBox,
QOverload<double>::of(&AzQtComponents::DoubleSpinBox::valueChanged), QOverload<double>::of(&AzQtComponents::DoubleSpinBox::valueChanged),
[this, parent](double value) [parent](double value)
{ {
parent->GetViewport()->GetViewportInteraction()->SetCanvasZoomPercent(static_cast<float>(value)); parent->GetViewport()->GetViewportInteraction()->SetCanvasZoomPercent(static_cast<float>(value));
}); });
@@ -119,7 +119,6 @@ private:
PropertiesWidget* m_propertiesWidget; PropertiesWidget* m_propertiesWidget;
EditorWindow* m_editorWindow; EditorWindow* m_editorWindow;
QWidget* m_containerWidget;
QWidget* m_componentListContents; QWidget* m_componentListContents;
QVBoxLayout* m_rowLayout; QVBoxLayout* m_rowLayout;
QLineEdit* m_selectedEntityDisplayNameWidget; QLineEdit* m_selectedEntityDisplayNameWidget;
@@ -350,10 +350,8 @@ void PropertyHandlerAnchor::WriteGUIValuesIntoProperty(size_t index, PropertyAnc
} }
} }
bool PropertyHandlerAnchor::ReadValuesIntoGUI(size_t index, PropertyAnchorCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) bool PropertyHandlerAnchor::ReadValuesIntoGUI([[maybe_unused]] size_t index, PropertyAnchorCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
{ {
(int)index;
AzQtComponents::VectorInput* ctrl = GUI->GetPropertyVectorCtrl(); AzQtComponents::VectorInput* ctrl = GUI->GetPropertyVectorCtrl();
ctrl->blockSignals(true); ctrl->blockSignals(true);
@@ -27,19 +27,16 @@ void PropertyHandlerChar::ConsumeAttribute(AzToolsFramework::PropertyStringLineE
{ {
} }
void PropertyHandlerChar::WriteGUIValuesIntoProperty(size_t index, AzToolsFramework::PropertyStringLineEditCtrl* GUI, property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) void PropertyHandlerChar::WriteGUIValuesIntoProperty([[maybe_unused]] size_t index, AzToolsFramework::PropertyStringLineEditCtrl* GUI, property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
{ {
(int)index;
AZStd::string str = GUI->value(); AZStd::string str = GUI->value();
wchar_t character = '\0'; wchar_t character = '\0';
AZStd::to_wstring(&character, 1, str.c_str()); AZStd::to_wstring(&character, 1, str.c_str());
instance = character; instance = character;
} }
bool PropertyHandlerChar::ReadValuesIntoGUI(size_t index, AzToolsFramework::PropertyStringLineEditCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) bool PropertyHandlerChar::ReadValuesIntoGUI([[maybe_unused]] size_t index, AzToolsFramework::PropertyStringLineEditCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
{ {
(int)index;
GUI->blockSignals(true); GUI->blockSignals(true);
{ {
// NOTE: this assumes the uint32_t can be interpreted as a wchar_t, it seems to // NOTE: this assumes the uint32_t can be interpreted as a wchar_t, it seems to
@@ -53,7 +53,7 @@ PropertyDirectoryCtrl::PropertyDirectoryCtrl(QWidget* parent)
QObject::connect(refreshButton, QObject::connect(refreshButton,
&QPushButton::clicked, &QPushButton::clicked,
[this]([[maybe_unused]] bool checked) []([[maybe_unused]] bool checked)
{ {
UiEditorRefreshDirectoryNotificationBus::Broadcast(&UiEditorRefreshDirectoryNotificationInterface::OnRefreshDirectory); UiEditorRefreshDirectoryNotificationBus::Broadcast(&UiEditorRefreshDirectoryNotificationInterface::OnRefreshDirectory);
}); });
@@ -106,10 +106,8 @@ void PropertyHandlerOffset::WriteGUIValuesIntoProperty(size_t index, AzQtCompone
EBUS_EVENT_ID(id, UiTransform2dBus, SetOffsets, newInternalOffset); EBUS_EVENT_ID(id, UiTransform2dBus, SetOffsets, newInternalOffset);
} }
bool PropertyHandlerOffset::ReadValuesIntoGUI(size_t index, AzQtComponents::VectorInput* GUI, const UiTransform2dInterface::Offsets& instance, AzToolsFramework::InstanceDataNode* node) bool PropertyHandlerOffset::ReadValuesIntoGUI([[maybe_unused]] size_t index, AzQtComponents::VectorInput* GUI, const UiTransform2dInterface::Offsets& instance, AzToolsFramework::InstanceDataNode* node)
{ {
(int)index;
// IMPORTANT: We DON'T need to do validation of data here because that's // IMPORTANT: We DON'T need to do validation of data here because that's
// done for us BEFORE we get here. We DO need to set the labels here. // done for us BEFORE we get here. We DO need to set the labels here.
@@ -143,10 +143,8 @@ void PropertyHandlerPivot::WriteGUIValuesIntoProperty(size_t index, PropertyPivo
} }
} }
bool PropertyHandlerPivot::ReadValuesIntoGUI(size_t index, PropertyPivotCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) bool PropertyHandlerPivot::ReadValuesIntoGUI([[maybe_unused]] size_t index, PropertyPivotCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
{ {
(int)index;
AzQtComponents::VectorInput* ctrl = GUI->GetPropertyVectorCtrl(); AzQtComponents::VectorInput* ctrl = GUI->GetPropertyVectorCtrl();
ctrl->blockSignals(true); ctrl->blockSignals(true);
@@ -227,7 +227,6 @@ void SpriteBorderEditor::DisplaySelectedCell(AZ::u32 cellIndex)
// Determine how much we need to scale the view to fit the cell // Determine how much we need to scale the view to fit the cell
// contents to the displayed properties image. // contents to the displayed properties image.
const AZ::Vector2 cellSize = m_sprite->GetCellSize(cellIndex); const AZ::Vector2 cellSize = m_sprite->GetCellSize(cellIndex);
const AZ::Vector2 cellScale = AZ::Vector2(m_unscaledSpriteSheet.size().width() / cellSize.GetX(), m_unscaledSpriteSheet.size().height() / cellSize.GetY());
// Scale-to-fit, while preserving aspect ratio. // Scale-to-fit, while preserving aspect ratio.
QRect croppedRect = m_unscaledSpriteSheet.rect(); QRect croppedRect = m_unscaledSpriteSheet.rect();
@@ -261,7 +261,6 @@ private: // data
AZStd::string m_cursorStr; AZStd::string m_cursorStr;
QCursor m_cursorRotate; QCursor m_cursorRotate;
bool m_inObjectPickMode = false;
ViewportInteraction::InteractionMode m_interactionModeBeforePickMode; ViewportInteraction::InteractionMode m_interactionModeBeforePickMode;
AZ::EntityId m_hoverElement; AZ::EntityId m_hoverElement;
bool m_entityPickedOnMousePress; // used to ignore mouse move/release events if element was picked on the mouse press bool m_entityPickedOnMousePress; // used to ignore mouse move/release events if element was picked on the mouse press