Merge branch 'development' of https://github.com/o3de/o3de into cgalvan/DraftStreamingImageAssetPixelAPI

This commit is contained in:
Chris Galvan
2022-01-12 13:57:49 -06:00
11 changed files with 13 additions and 289 deletions
@@ -41,8 +41,6 @@ void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& seria
->Field("ShowBBoxes", &Display::m_showBBoxes)
->Field("DrawEntityLabels", &Display::m_drawEntityLabels)
->Field("ShowTriggerBounds", &Display::m_showTriggerBounds)
->Field("ShowIcons", &Display::m_showIcons)
->Field("DistanceScaleIcons", &Display::m_distanceScaleIcons)
->Field("ShowFrozenHelpers", &Display::m_showFrozenHelpers)
->Field("FillSelectedShapes", &Display::m_fillSelectedShapes)
->Field("ShowGridGuide", &Display::m_showGridGuide)
@@ -118,10 +116,6 @@ void CEditorPreferencesPage_ViewportGeneral::Reflect(AZ::SerializeContext& seria
AZ::Edit::UIHandlers::CheckBox, &Display::m_drawEntityLabels, "Always Draw Entity Labels", "Always Draw Entity Labels")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &Display::m_showTriggerBounds, "Always Show Trigger Bounds", "Always Show Trigger Bounds")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Display::m_showIcons, "Show Object Icons", "Show Object Icons")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &Display::m_distanceScaleIcons, "Scale Object Icons with Distance",
"Scale Object Icons with Distance")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &Display::m_showFrozenHelpers, "Show Helpers of Frozen Objects",
"Show Helpers of Frozen Objects")
@@ -244,8 +238,6 @@ void CEditorPreferencesPage_ViewportGeneral::OnApply()
}
gSettings.viewports.bDrawEntityLabels = m_display.m_drawEntityLabels;
gSettings.viewports.bShowTriggerBounds = m_display.m_showTriggerBounds;
gSettings.viewports.bShowIcons = m_display.m_showIcons;
gSettings.viewports.bDistanceScaleIcons = m_display.m_distanceScaleIcons;
gSettings.viewports.nShowFrozenHelpers = m_display.m_showFrozenHelpers;
gSettings.viewports.bFillSelectedShapes = m_display.m_fillSelectedShapes;
gSettings.viewports.bShowGridGuide = m_display.m_showGridGuide;
@@ -300,8 +292,6 @@ void CEditorPreferencesPage_ViewportGeneral::InitializeSettings()
m_display.m_showBBoxes = (ds->GetRenderFlags() & RENDER_FLAG_BBOX) == RENDER_FLAG_BBOX;
m_display.m_drawEntityLabels = gSettings.viewports.bDrawEntityLabels;
m_display.m_showTriggerBounds = gSettings.viewports.bShowTriggerBounds;
m_display.m_showIcons = gSettings.viewports.bShowIcons;
m_display.m_distanceScaleIcons = gSettings.viewports.bDistanceScaleIcons;
m_display.m_showFrozenHelpers = gSettings.viewports.nShowFrozenHelpers;
m_display.m_fillSelectedShapes = gSettings.viewports.bFillSelectedShapes;
m_display.m_showGridGuide = gSettings.viewports.bShowGridGuide;
@@ -62,8 +62,6 @@ private:
bool m_showBBoxes;
bool m_drawEntityLabels;
bool m_showTriggerBounds;
bool m_showIcons;
bool m_distanceScaleIcons;
bool m_showFrozenHelpers;
bool m_fillSelectedShapes;
bool m_showGridGuide;
-2
View File
@@ -1027,8 +1027,6 @@ void EditorViewportWidget::OnTitleMenu(QMenu* menu)
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Safe Frame"), &gSettings.viewports.bShowSafeFrame);
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Construction Plane"), &gSettings.snap.constructPlaneDisplay);
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Trigger Bounds"), &gSettings.viewports.bShowTriggerBounds);
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Icons"), &gSettings.viewports.bShowIcons, &gSettings.viewports.bShowSizeBasedIcons);
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Size-based Icons"), &gSettings.viewports.bShowSizeBasedIcons, &gSettings.viewports.bShowIcons);
AZ::ViewportHelpers::AddCheckbox(menu, tr("Show Helpers of Frozen Objects"), &gSettings.viewports.nShowFrozenHelpers);
if (!m_predefinedAspectRatios.IsEmpty())
-157
View File
@@ -36,12 +36,6 @@
// To use the Andrew's algorithm in order to make convex hull from the points, this header is needed.
#include "Util/GeometryUtil.h"
namespace {
QColor kLinkColorParent = QColor(0, 255, 255);
QColor kLinkColorChild = QColor(0, 0, 255);
QColor kLinkColorGray = QColor(128, 128, 128);
}
extern CObjectManager* g_pObjectManager;
//////////////////////////////////////////////////////////////////////////
@@ -761,72 +755,6 @@ void CBaseObject::SetModified(bool)
{
}
void CBaseObject::DrawDefault(DisplayContext& dc, const QColor& labelColor)
{
Vec3 wp = GetWorldPos();
bool bDisplaySelectionHelper = false;
if (!CanBeDrawn(dc, bDisplaySelectionHelper))
{
return;
}
// Draw link between parent and child.
if (dc.flags & DISPLAY_LINKS)
{
if (GetParent())
{
dc.DrawLine(GetParentAttachPointWorldTM().GetTranslation(), wp, IsFrozen() ? kLinkColorGray : kLinkColorParent, IsFrozen() ? kLinkColorGray : kLinkColorChild);
}
size_t nChildCount = GetChildCount();
for (size_t i = 0; i < nChildCount; ++i)
{
const CBaseObject* pChild = GetChild(i);
dc.DrawLine(pChild->GetParentAttachPointWorldTM().GetTranslation(), pChild->GetWorldPos(), pChild->IsFrozen() ? kLinkColorGray : kLinkColorParent, pChild->IsFrozen() ? kLinkColorGray : kLinkColorChild);
}
}
// Draw Bounding box
if (dc.flags & DISPLAY_BBOX)
{
AABB box;
GetBoundBox(box);
dc.SetColor(Vec3(1, 1, 1));
dc.DrawWireBox(box.min, box.max);
}
if (IsHighlighted())
{
DrawHighlight(dc);
}
if (IsSelected())
{
DrawArea(dc);
CSelectionGroup* pSelection = GetObjectManager()->GetSelection();
// If the number of selected object is over 2, the merged boundbox should be used to render the measurement axis.
if (!pSelection || (pSelection && pSelection->GetCount() == 1))
{
DrawDimensions(dc);
}
}
if (bDisplaySelectionHelper)
{
DrawSelectionHelper(dc, wp, labelColor, 1.0f);
}
else if (!(dc.flags & DISPLAY_HIDENAMES))
{
DrawLabel(dc, wp, labelColor);
}
SetDrawTextureIconProperties(dc, wp);
DrawTextureIcon(dc, wp);
DrawWarningIcons(dc, wp);
}
//////////////////////////////////////////////////////////////////////////
void CBaseObject::DrawDimensions(DisplayContext&, AABB*)
{
@@ -850,91 +778,6 @@ void CBaseObject::DrawSelectionHelper(DisplayContext& dc, const Vec3& pos, const
dc.SetState(nPrevState);
}
//////////////////////////////////////////////////////////////////////////
void CBaseObject::SetDrawTextureIconProperties(DisplayContext& dc, const Vec3& pos, float alpha, int texIconFlags)
{
if (gSettings.viewports.bShowIcons || gSettings.viewports.bShowSizeBasedIcons)
{
if (IsHighlighted())
{
dc.SetColor(QColor(255, 120, 0), 0.8f * alpha);
}
else if (IsSelected())
{
dc.SetSelectedColor(alpha);
}
else if (IsFrozen())
{
dc.SetFreezeColor();
}
else
{
dc.SetColor(QColor(255, 255, 255), alpha);
}
m_vDrawIconPos = pos;
int nIconFlags = texIconFlags;
if (CheckFlags(OBJFLAG_SHOW_ICONONTOP))
{
Vec3 objectPos = GetWorldPos();
AABB box;
GetBoundBox(box);
m_vDrawIconPos.z = (m_vDrawIconPos.z - objectPos.z) + box.max.z;
nIconFlags |= DisplayContext::TEXICON_ALIGN_BOTTOM;
}
m_nIconFlags = nIconFlags;
}
}
//////////////////////////////////////////////////////////////////////////
void CBaseObject::DrawTextureIcon(DisplayContext& dc, [[maybe_unused]] const Vec3& pos, [[maybe_unused]] float alpha)
{
if (m_nTextureIcon && (gSettings.viewports.bShowIcons || gSettings.viewports.bShowSizeBasedIcons))
{
dc.DrawTextureLabel(GetTextureIconDrawPos(), OBJECT_TEXTURE_ICON_SIZEX, OBJECT_TEXTURE_ICON_SIZEY, GetTextureIcon(), GetTextureIconFlags());
}
}
//////////////////////////////////////////////////////////////////////////
void CBaseObject::DrawWarningIcons(DisplayContext& dc, const Vec3&)
{
if (gSettings.viewports.bShowIcons || gSettings.viewports.bShowSizeBasedIcons)
{
const int warningIconSizeX = OBJECT_TEXTURE_ICON_SIZEX / 2;
const int warningIconSizeY = OBJECT_TEXTURE_ICON_SIZEY / 2;
const int iconOffsetX = m_nTextureIcon ? (-OBJECT_TEXTURE_ICON_SIZEX / 2) : 0;
const int iconOffsetY = m_nTextureIcon ? (-OBJECT_TEXTURE_ICON_SIZEY / 2) : 0;
if (gSettings.viewports.bShowScaleWarnings)
{
const EScaleWarningLevel scaleWarningLevel = GetScaleWarningLevel();
if (scaleWarningLevel != eScaleWarningLevel_None)
{
dc.SetColor(QColor(255, scaleWarningLevel == eScaleWarningLevel_RescaledNonUniform ? 50 : 255, 50), 1.0f);
dc.DrawTextureLabel(GetTextureIconDrawPos(), warningIconSizeX, warningIconSizeY,
GetIEditor()->GetIconManager()->GetIconTexture(eIcon_ScaleWarning), GetTextureIconFlags(),
-warningIconSizeX / 2, iconOffsetX - (warningIconSizeY / 2));
}
}
if (gSettings.viewports.bShowRotationWarnings)
{
const ERotationWarningLevel rotationWarningLevel = GetRotationWarningLevel();
if (rotationWarningLevel != eRotationWarningLevel_None)
{
dc.SetColor(QColor(255, rotationWarningLevel == eRotationWarningLevel_RotatedNonRectangular ? 50 : 255, 50), 1.0f);
dc.DrawTextureLabel(GetTextureIconDrawPos(), warningIconSizeX, warningIconSizeY,
GetIEditor()->GetIconManager()->GetIconTexture(eIcon_RotationWarning), GetTextureIconFlags(),
warningIconSizeX / 2, iconOffsetY - (warningIconSizeY / 2));
}
}
}
}
//////////////////////////////////////////////////////////////////////////
void CBaseObject::DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& lC, float alpha, float size)
{
-10
View File
@@ -398,9 +398,6 @@ public:
// Interface to be implemented in plugins.
//////////////////////////////////////////////////////////////////////////
//! Draw object to specified viewport.
virtual void Display([[maybe_unused]] DisplayContext& disp) {}
//! Perform intersection testing of this object.
//! Return true if was hit.
virtual bool HitTest([[maybe_unused]] HitContext& hc) { return false; };
@@ -529,8 +526,6 @@ protected:
void ResolveParent(CBaseObject* object);
void SetColor(const QColor& color);
//! Draw default object items.
virtual void DrawDefault(DisplayContext& dc, const QColor& labelColor = QColor(255, 255, 255));
//! Draw object label.
void DrawLabel(DisplayContext& dc, const Vec3& pos, const QColor& labelColor = QColor(255, 255, 255), float alpha = 1.0f, float size = 1.f);
//! Draw 3D Axis at object position.
@@ -539,10 +534,6 @@ protected:
void DrawArea(DisplayContext& dc);
//! Draw selection helper.
void DrawSelectionHelper(DisplayContext& dc, const Vec3& pos, const QColor& labelColor = QColor(255, 255, 255), float alpha = 1.0f);
//! Draw helper icon.
virtual void DrawTextureIcon(DisplayContext& dc, const Vec3& pos, float alpha = 1.0f);
//! Draw warning icons
virtual void DrawWarningIcons(DisplayContext& dc, const Vec3& pos);
//! Check if dimension's figures can be displayed before draw them.
virtual void DrawDimensions(DisplayContext& dc, AABB* pMergedBoundBox = nullptr);
@@ -575,7 +566,6 @@ protected:
//! Only used by ObjectManager.
bool IsPotentiallyVisible() const;
void SetDrawTextureIconProperties(DisplayContext& dc, const Vec3& pos, float alpha = 1.0f, int texIconFlags = 0);
const Vec3& GetTextureIconDrawPos(){ return m_vDrawIconPos; };
int GetTextureIconFlags(){ return m_nIconFlags; };
@@ -723,97 +723,6 @@ CComponentEntityObject* CComponentEntityObject::FindObjectForEntity(AZ::EntityId
return nullptr;
}
void CComponentEntityObject::Display(DisplayContext& dc)
{
if (!(dc.flags & DISPLAY_2D))
{
m_entityIconVisible = false;
}
bool displaySelectionHelper = false;
if (!CanBeDrawn(dc, displaySelectionHelper))
{
return;
}
DrawDefault(dc);
bool showIcons = m_hasIcon;
if (showIcons)
{
SEditorSettings* editorSettings = GetIEditor()->GetEditorSettings();
if (!editorSettings->viewports.bShowIcons && !editorSettings->viewports.bShowSizeBasedIcons)
{
showIcons = false;
}
}
if (m_entityId.IsValid())
{
// Draw link to parent if this or the parent object are selected.
{
AZ::EntityId parentId;
EBUS_EVENT_ID_RESULT(parentId, m_entityId, AZ::TransformBus, GetParentId);
if (parentId.IsValid())
{
bool isParentVisible = false;
AzToolsFramework::EditorEntityInfoRequestBus::EventResult(isParentVisible, parentId, &AzToolsFramework::EditorEntityInfoRequestBus::Events::IsVisible);
CComponentEntityObject* parentObject = CComponentEntityObject::FindObjectForEntity(parentId);
if (isParentVisible && (IsSelected() || (parentObject && parentObject->IsSelected())))
{
const QColor kLinkColorParent(0, 255, 255);
const QColor kLinkColorChild(0, 0, 255);
AZ::Vector3 parentTranslation;
EBUS_EVENT_ID_RESULT(parentTranslation, parentId, AZ::TransformBus, GetWorldTranslation);
dc.DrawLine(AZVec3ToLYVec3(parentTranslation), GetWorldTM().GetTranslation(), kLinkColorParent, kLinkColorChild);
}
}
}
// Don't draw icons if we have an ancestor in the same location that has an icon - makes sure
// ancestor icons draw on top and are able to be selected over children. Also check if a descendant
// is selected at the same location. In cases of entity hierarchies where numerous ancestors have
// no position offset, we need this so the ancestors don't draw over us when we're selected
if (showIcons)
{
if ((dc.flags & DISPLAY_2D) ||
IsSelected() ||
IsAncestorIconDrawingAtSameLocation() ||
IsDescendantSelectedAtSameLocation())
{
showIcons = false;
}
}
// Allow components to override in-editor visualization.
{
const AzFramework::DisplayContextRequestGuard displayContextGuard(dc);
AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
AzFramework::DebugDisplayRequestBus::Bind(
debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
AzFramework::DebugDisplayRequests* debugDisplay =
AzFramework::DebugDisplayRequestBus::FindFirstHandler(debugDisplayBus);
AzFramework::EntityDebugDisplayEventBus::Event(
m_entityId, &AzFramework::EntityDebugDisplayEvents::DisplayEntityViewport,
AzFramework::ViewportInfo{ dc.GetView()->asCViewport()->GetViewportId() },
*debugDisplay);
}
}
}
void CComponentEntityObject::DrawDefault(DisplayContext& dc, const QColor& labelColor)
{
CEntityObject::DrawDefault(dc, labelColor);
DrawAccent(dc);
}
bool CComponentEntityObject::IsIsolated() const
{
return m_isIsolated;
@@ -55,7 +55,6 @@ public:
bool SetRotation(const Quat& rotate, int flags) override;
bool SetScale(const Vec3& scale, int flags) override;
void InvalidateTM(int nWhyFlags) override;
void Display(DisplayContext& disp) override;
bool HitTest(HitContext& hc) override;
void GetLocalBounds(AABB& box) override;
void GetBoundBox(AABB& box) override;
@@ -69,7 +68,6 @@ public:
void DetachThis(bool bKeepPos = true) override;
XmlNodeRef Export(const QString& levelPath, XmlNodeRef& xmlNode) override;
void DeleteEntity() override;
void DrawDefault(DisplayContext& dc, const QColor& labelColor = QColor(255, 255, 255)) override;
bool IsIsolated() const override;
bool IsSelected() const override;
-7
View File
@@ -142,9 +142,6 @@ SEditorSettings::SEditorSettings()
viewports.bShowMeshStatsOnMouseOver = false;
viewports.bDrawEntityLabels = false;
viewports.bShowTriggerBounds = false;
viewports.bShowIcons = true;
viewports.bDistanceScaleIcons = true;
viewports.bShowSizeBasedIcons = false;
viewports.nShowFrozenHelpers = true;
viewports.bFillSelectedShapes = false;
viewports.nTopMapTextureResolution = 512;
@@ -534,8 +531,6 @@ void SEditorSettings::Save(bool isEditorClosing)
SaveValue("Settings", "ShowMeshStatsOnMouseOver", viewports.bShowMeshStatsOnMouseOver);
SaveValue("Settings", "DrawEntityLabels", viewports.bDrawEntityLabels);
SaveValue("Settings", "ShowTriggerBounds", viewports.bShowTriggerBounds);
SaveValue("Settings", "ShowIcons", viewports.bShowIcons);
SaveValue("Settings", "ShowSizeBasedIcons", viewports.bShowSizeBasedIcons);
SaveValue("Settings", "ShowFrozenHelpers", viewports.nShowFrozenHelpers);
SaveValue("Settings", "FillSelectedShapes", viewports.bFillSelectedShapes);
SaveValue("Settings", "MapTextureResolution", viewports.nTopMapTextureResolution);
@@ -736,8 +731,6 @@ void SEditorSettings::Load()
LoadValue("Settings", "ShowMeshStatsOnMouseOver", viewports.bShowMeshStatsOnMouseOver);
LoadValue("Settings", "DrawEntityLabels", viewports.bDrawEntityLabels);
LoadValue("Settings", "ShowTriggerBounds", viewports.bShowTriggerBounds);
LoadValue("Settings", "ShowIcons", viewports.bShowIcons);
LoadValue("Settings", "ShowSizeBasedIcons", viewports.bShowSizeBasedIcons);
LoadValue("Settings", "ShowFrozenHelpers", viewports.nShowFrozenHelpers);
LoadValue("Settings", "FillSelectedShapes", viewports.bFillSelectedShapes);
LoadValue("Settings", "MapTextureResolution", viewports.nTopMapTextureResolution);
-7
View File
@@ -136,13 +136,6 @@ struct SViewportsSettings
bool bDrawEntityLabels;
//! Show Trigger bounds.
bool bShowTriggerBounds;
//! Show Icons in viewport.
bool bShowIcons;
//! Scale icons with distance, so they aren't a fixed size no matter how far away you are
bool bDistanceScaleIcons;
//! Show Size-based Icons in viewport.
bool bShowSizeBasedIcons;
//! Show Helpers in viewport for frozen objects.
int nShowFrozenHelpers;
@@ -952,7 +952,15 @@ namespace MCommon
}
else
{
worldTM = AZ::Transform::CreateFromQuaternion(MCore::AzEulerAnglesToAzQuat(0.0f, 0.0f, MCore::Math::DegreesToRadians(180.0f)));
if (direction.GetX() > 0)
{
worldTM = AZ::Transform::CreateFromQuaternion(MCore::AzEulerAnglesToAzQuat(MCore::Math::DegreesToRadians(180.0f), 0.0f, MCore::Math::DegreesToRadians(180.0f)));
}
else
{
worldTM = AZ::Transform::CreateFromQuaternion(MCore::AzEulerAnglesToAzQuat(0.0f, 0.0f, 0.0f));
}
}
// set the cylinder to the given position
@@ -125,6 +125,10 @@ namespace EMotionFX
Physics::RagdollNodeConfiguration* ragdollNodeConfig = GetRagdollNodeConfig();
if (ragdollNodeConfig)
{
AzPhysics::JointConfiguration* jointLimitConfig = ragdollNodeConfig->m_jointConfig.get();
jointLimitConfig->SetPropertyVisibility(AzPhysics::JointConfiguration::PropertyVisibility::ParentLocalRotation, jointLimitConfig != nullptr);
jointLimitConfig->SetPropertyVisibility(AzPhysics::JointConfiguration::PropertyVisibility::ChildLocalRotation, jointLimitConfig != nullptr);
m_addColliderButton->show();
m_addRemoveButton->setText("Remove from ragdoll");