Code/Editor

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-16 15:56:36 -07:00
parent e6b5342c07
commit 2963739288
51 changed files with 286 additions and 337 deletions
@@ -661,8 +661,8 @@ bool CComponentEntityObject::HitHelperTest(HitContext& hc)
if (IsEntityIconVisible())
{
const QPoint entityScreenPos = hc.view->WorldToView(GetWorldPos());
const float screenPosX = entityScreenPos.x();
const float screenPosY = entityScreenPos.y();
const float screenPosX = static_cast<float>(entityScreenPos.x());
const float screenPosY = static_cast<float>(entityScreenPos.y());
const float iconRange = static_cast<float>(s_kIconSize / 2);
if ((hc.point2d.x() >= screenPosX - iconRange && hc.point2d.x() <= screenPosX + iconRange)
@@ -626,7 +626,7 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
{
view->GetDimensions(&width, &height);
}
m_contextMenuViewPoint.Set(width / 2, height / 2);
m_contextMenuViewPoint.Set(static_cast<float>(width / 2), static_cast<float>(height / 2));
}
else
{
@@ -998,7 +998,7 @@ void SandboxIntegrationManager::HandleObjectModeSelection(const AZ::Vector2& poi
if (m_inObjectPickMode)
{
CViewport* view = GetIEditor()->GetViewManager()->GetGameViewport();
const QPoint viewPoint(point.GetX(), point.GetY());
const QPoint viewPoint(static_cast<int>(point.GetX()), static_cast<int>(point.GetY()));
HitContext hitInfo;
hitInfo.view = view;
@@ -1440,7 +1440,7 @@ void SandboxIntegrationManager::ContextMenu_NewEntity()
// will be created at the origin.
if (view)
{
const QPoint viewPoint(m_contextMenuViewPoint.GetX(), m_contextMenuViewPoint.GetY());
const QPoint viewPoint(static_cast<int>(m_contextMenuViewPoint.GetX()), static_cast<int>(m_contextMenuViewPoint.GetY()));
worldPosition = view->GetHitLocation(viewPoint);
}
@@ -1630,7 +1630,7 @@ void SandboxIntegrationManager::InstantiateSliceFromAssetId(const AZ::Data::Asse
// will be instantiated at the origin.
if (view)
{
const QPoint viewPoint(m_contextMenuViewPoint.GetX(), m_contextMenuViewPoint.GetY());
const QPoint viewPoint(static_cast<int>(m_contextMenuViewPoint.GetX()), static_cast<int>(m_contextMenuViewPoint.GetY()));
sliceWorldTransform = AZ::Transform::CreateTranslation(LYVec3ToAZVec3(view->SnapToGrid(view->ViewToWorld(viewPoint))));
}
@@ -2476,10 +2476,10 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
auto backgroundBoxRect = option.rect;
backgroundBoxRect.setX(backgroundBoxRect.x() + 0.5);
backgroundBoxRect.setY(backgroundBoxRect.y() + 2.5);
backgroundBoxRect.setWidth(backgroundBoxRect.width() - 1.0);
backgroundBoxRect.setHeight(backgroundBoxRect.height() - 1.0);
backgroundBoxRect.setX(static_cast<int>(backgroundBoxRect.x() + 0.5f));
backgroundBoxRect.setY(static_cast<int>(backgroundBoxRect.y() + 2.5f));
backgroundBoxRect.setWidth(static_cast<int>(backgroundBoxRect.width() - 1.0f));
backgroundBoxRect.setHeight(static_cast<int>(backgroundBoxRect.height() - 1.0f));
const qreal sliceBorderHeight = 0.8f;
@@ -2513,7 +2513,7 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
else
{
auto newRect = option.rect;
newRect.setHeight(newRect.height() - 1.0);
newRect.setHeight(static_cast<int>(newRect.height() - 1.0f));
path.addRect(newRect);
}
@@ -274,8 +274,8 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const
// if the item has children offset the drawn line to compensate for drawn expander buttons
bool hasChildren = previousIndex.model()->index(0, 0, previousIndex).isValid();
int horizontalLineY = rect.top() + rectHalfHeight;
int horizontalLineLeft = rect.right() - indentation() * 1.5f;
int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : (lineBaseX - indentation() * 0.5f);
int horizontalLineLeft = static_cast<int>(rect.right() - indentation() * 1.5f);
int horizontalLineRight = hasChildren ? (lineBaseX - indentation()) : static_cast<int>(lineBaseX - indentation() * 0.5f);
painter->drawLine(horizontalLineLeft, horizontalLineY, horizontalLineRight, horizontalLineY);
}
@@ -284,7 +284,7 @@ void OutlinerTreeView::drawBranches(QPainter* painter, const QRect& rect, const
bool hasNext = previousIndex.sibling(previousIndex.row() + 1, previousIndex.column()).isValid();
if (hasNext || previousIndex == index)
{
int verticalLineX = lineBaseX - indentation() * 1.5f;
int verticalLineX = static_cast<int>(lineBaseX - indentation() * 1.5f);
int verticalLineTop = rect.top();
int verticalLineBottom = hasNext ? rect.bottom() : rect.bottom() - rectHalfHeight;
painter->drawLine(verticalLineX, verticalLineTop, verticalLineX, verticalLineBottom);