Merge remote-tracking branch 'origin/ly-as-sdk/LYN-2948-phistere' into ly-as-sdk/LYN-2948
# Conflicts: # scripts/o3de.py
This commit is contained in:
@@ -35,6 +35,9 @@ ly_add_target(
|
||||
AZ::AzToolsFramework
|
||||
Legacy::CryCommon
|
||||
Legacy::EditorLib
|
||||
AZ::AtomCore
|
||||
Gem::Atom_RPI.Public
|
||||
Gem::AtomToolsFramework.Static
|
||||
Gem::LmbrCentral.Editor
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::LmbrCentral.Editor
|
||||
|
||||
@@ -16,12 +16,15 @@
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/RTTI/AttributeReader.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/std/functional.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/numeric.h>
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
@@ -30,7 +33,9 @@
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Physics/Material.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/Visibility/BoundsBus.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/API/EditorEntityAPI.h>
|
||||
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
@@ -56,8 +61,14 @@
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx>
|
||||
#include <AzToolsFramework/UI/Layer/NameConflictWarning.hxx>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorHelpers.h>
|
||||
#include <MathConversion.h>
|
||||
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <Atom/RPI.Public/ViewportContextBus.h>
|
||||
#include <AtomToolsFramework/Viewport/ModularViewportCameraControllerRequestBus.h>
|
||||
|
||||
|
||||
#include "Objects/ComponentEntityObject.h"
|
||||
#include "ISourceControl.h"
|
||||
#include "UI/QComponentEntityEditorMainWindow.h"
|
||||
@@ -75,6 +86,7 @@
|
||||
#include <Editor/Settings.h>
|
||||
#include <Editor/StringDlg.h>
|
||||
#include <Editor/QtViewPaneManager.h>
|
||||
#include <Editor/EditorViewportSettings.h>
|
||||
#include <IResourceSelectorHost.h>
|
||||
#include "CryEdit.h"
|
||||
|
||||
@@ -181,6 +193,9 @@ void SandboxIntegrationManager::Setup()
|
||||
(m_prefabIntegrationInterface != nullptr),
|
||||
"SandboxIntegrationManager requires a PrefabIntegrationInterface instance to be present on Setup().");
|
||||
|
||||
m_editorEntityAPI = AZ::Interface<AzToolsFramework::EditorEntityAPI>::Get();
|
||||
AZ_Assert(m_editorEntityAPI, "SandboxIntegrationManager requires an EditorEntityAPI instance to be present on Setup().");
|
||||
|
||||
AzToolsFramework::Layers::EditorLayerComponentNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
@@ -367,11 +382,6 @@ void SandboxIntegrationManager::Teardown()
|
||||
{
|
||||
AzToolsFramework::Layers::EditorLayerComponentNotificationBus::Handler::BusDisconnect();
|
||||
AzFramework::DisplayContextRequestBus::Handler::BusDisconnect();
|
||||
if( m_debugDisplayBusImplementationActive)
|
||||
{
|
||||
AzFramework::DebugDisplayRequestBus::Handler::BusDisconnect();
|
||||
m_debugDisplayBusImplementationActive = false;
|
||||
}
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
|
||||
@@ -1204,9 +1214,20 @@ void SandboxIntegrationManager::CloneSelection(bool& handled)
|
||||
|
||||
if (!duplicationSet.empty())
|
||||
{
|
||||
AZStd::unordered_set<AZ::EntityId> clonedEntities;
|
||||
handled = AzToolsFramework::CloneInstantiatedEntities(duplicationSet, clonedEntities);
|
||||
m_unsavedEntities.insert(clonedEntities.begin(), clonedEntities.end());
|
||||
bool prefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (prefabSystemEnabled)
|
||||
{
|
||||
m_editorEntityAPI->DuplicateSelected();
|
||||
handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::unordered_set<AZ::EntityId> clonedEntities;
|
||||
handled = AzToolsFramework::CloneInstantiatedEntities(duplicationSet, clonedEntities);
|
||||
m_unsavedEntities.insert(clonedEntities.begin(), clonedEntities.end());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1674,32 +1695,77 @@ bool CollectEntityBoundingBoxesForZoom(const AZ::EntityId& entityId, AABB& selec
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SandboxIntegrationManager::GoToEntitiesInViewports(const AzToolsFramework::EntityIdList& entityIds)
|
||||
{
|
||||
if (entityIds.size() == 0)
|
||||
if (entityIds.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AABB selectionBounds;
|
||||
selectionBounds.Reset();
|
||||
bool entitiesAvailableForGoTo = false;
|
||||
|
||||
for (const AZ::EntityId& entityId : entityIds)
|
||||
if (SandboxEditor::UsingNewCameraSystem())
|
||||
{
|
||||
if(CollectEntityBoundingBoxesForZoom(entityId, selectionBounds))
|
||||
const AZ::Aabb aabb = AZStd::accumulate(
|
||||
AZStd::begin(entityIds), AZStd::end(entityIds), AZ::Aabb::CreateNull(), [](AZ::Aabb acc, const AZ::EntityId entityId) {
|
||||
const AZ::Aabb aabb = AzFramework::CalculateEntityWorldBoundsUnion(AzToolsFramework::GetEntityById(entityId));
|
||||
acc.AddAabb(aabb);
|
||||
return acc;
|
||||
});
|
||||
|
||||
float radius;
|
||||
AZ::Vector3 center;
|
||||
aabb.GetAsSphere(center, radius);
|
||||
|
||||
// minimum center size is 40cm
|
||||
const float minSelectionRadius = 0.4f;
|
||||
const float selectionSize = AZ::GetMax(minSelectionRadius, radius);
|
||||
|
||||
auto viewportContextManager = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
|
||||
|
||||
const int viewCount = GetIEditor()->GetViewManager()->GetViewCount(); // legacy call
|
||||
for (int viewIndex = 0; viewIndex < viewCount; ++viewIndex)
|
||||
{
|
||||
entitiesAvailableForGoTo = true;
|
||||
if (auto viewportContext = viewportContextManager->GetViewportContextById(viewIndex))
|
||||
{
|
||||
const AZ::Transform cameraTransform = viewportContext->GetCameraTransform();
|
||||
const AZ::Vector3 forward = (center - cameraTransform.GetTranslation()).GetNormalized();
|
||||
|
||||
// move camera 25% further back than required
|
||||
const float centerScale = 1.25f;
|
||||
// compute new camera transform
|
||||
const float fov = AzFramework::RetrieveFov(viewportContext->GetCameraProjectionMatrix());
|
||||
const float fovScale = (1.0f / AZStd::tan(fov * 0.5f));
|
||||
const float distanceToTarget = selectionSize * fovScale * centerScale;
|
||||
const AZ::Transform nextCameraTransform =
|
||||
AZ::Transform::CreateLookAt(aabb.GetCenter() - (forward * distanceToTarget), aabb.GetCenter());
|
||||
|
||||
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
|
||||
viewportContext->GetId(),
|
||||
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, nextCameraTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entitiesAvailableForGoTo)
|
||||
else
|
||||
{
|
||||
int numViews = GetIEditor()->GetViewManager()->GetViewCount();
|
||||
for (int viewIndex = 0; viewIndex < numViews; ++viewIndex)
|
||||
AABB selectionBounds;
|
||||
selectionBounds.Reset();
|
||||
bool entitiesAvailableForGoTo = false;
|
||||
|
||||
for (const AZ::EntityId& entityId : entityIds)
|
||||
{
|
||||
CViewport* viewport = GetIEditor()->GetViewManager()->GetView(viewIndex);
|
||||
if (viewport)
|
||||
if (CollectEntityBoundingBoxesForZoom(entityId, selectionBounds))
|
||||
{
|
||||
viewport->CenterOnAABB(selectionBounds);
|
||||
entitiesAvailableForGoTo = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (entitiesAvailableForGoTo)
|
||||
{
|
||||
int numViews = GetIEditor()->GetViewManager()->GetViewCount();
|
||||
for (int viewIndex = 0; viewIndex < numViews; ++viewIndex)
|
||||
{
|
||||
CViewport* viewport = GetIEditor()->GetViewManager()->GetView(viewIndex);
|
||||
if (viewport)
|
||||
{
|
||||
viewport->CenterOnAABB(selectionBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1970,678 +2036,6 @@ void SandboxIntegrationManager::BrowseForAssets(AssetSelectionModel& selection)
|
||||
AssetBrowserComponentRequestBus::Broadcast(&AssetBrowserComponentRequests::PickAssets, selection, GetMainWindow());
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::SetColor(float r, float g, float b, float a)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->SetColor(Vec3(r, g, b), a);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::SetColor(const AZ::Color& color)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->SetColor(AZColorToLYColorF(color));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::SetColor(const AZ::Vector4& color)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->SetColor(AZVec3ToLYVec3(color.GetAsVector3()), color.GetW());
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::SetAlpha(float a)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->SetAlpha(a);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawQuad(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawQuad(
|
||||
AZVec3ToLYVec3(p1),
|
||||
AZVec3ToLYVec3(p2),
|
||||
AZVec3ToLYVec3(p3),
|
||||
AZVec3ToLYVec3(p4));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawQuad(float width, float height)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawQuad(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireQuad(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireQuad(
|
||||
AZVec3ToLYVec3(p1),
|
||||
AZVec3ToLYVec3(p2),
|
||||
AZVec3ToLYVec3(p3),
|
||||
AZVec3ToLYVec3(p4));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireQuad(float width, float height)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireQuad(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawQuadGradient(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4, const AZ::Vector4& firstColor, const AZ::Vector4& secondColor)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawQuadGradient(
|
||||
AZVec3ToLYVec3(p1),
|
||||
AZVec3ToLYVec3(p2),
|
||||
AZVec3ToLYVec3(p3),
|
||||
AZVec3ToLYVec3(p4),
|
||||
ColorF(AZVec3ToLYVec3(firstColor.GetAsVector3()), firstColor.GetW()),
|
||||
ColorF(AZVec3ToLYVec3(secondColor.GetAsVector3()), secondColor.GetW()));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTri(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawTri(
|
||||
AZVec3ToLYVec3(p1),
|
||||
AZVec3ToLYVec3(p2),
|
||||
AZVec3ToLYVec3(p3));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTriangles(const AZStd::vector<AZ::Vector3>& vertices, const AZ::Color& color)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
// transform to world space
|
||||
const auto vecTransform = [this](const AZ::Vector3& vec)
|
||||
{
|
||||
return m_dc->GetMatrix() * AZVec3ToLYVec3(vec);
|
||||
};
|
||||
|
||||
AZStd::vector<Vec3> cryVertices;
|
||||
cryVertices.reserve(vertices.size());
|
||||
AZStd::transform(vertices.begin(), vertices.end(), AZStd::back_inserter(cryVertices), vecTransform);
|
||||
m_dc->DrawTriangles(
|
||||
cryVertices,
|
||||
AZColorToLYColorF(color));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTrianglesIndexed(const AZStd::vector<AZ::Vector3>& vertices, const AZStd::vector<AZ::u32>& indices, const AZ::Color& color)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
// transform to world space
|
||||
const auto vecTransform = [this](const AZ::Vector3& vec)
|
||||
{
|
||||
return m_dc->GetMatrix() * AZVec3ToLYVec3(vec);
|
||||
};
|
||||
|
||||
AZStd::vector<Vec3> cryVertices;
|
||||
cryVertices.reserve(vertices.size());
|
||||
AZStd::transform(vertices.begin(), vertices.end(), AZStd::back_inserter(cryVertices), vecTransform);
|
||||
m_dc->DrawTrianglesIndexed(
|
||||
cryVertices,
|
||||
indices,
|
||||
AZColorToLYColorF(color));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireBox(const AZ::Vector3& min, const AZ::Vector3& max)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireBox(
|
||||
AZVec3ToLYVec3(min),
|
||||
AZVec3ToLYVec3(max));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawSolidBox(const AZ::Vector3& min, const AZ::Vector3& max)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawSolidBox(
|
||||
AZVec3ToLYVec3(min),
|
||||
AZVec3ToLYVec3(max));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawSolidOBB(const AZ::Vector3& center, const AZ::Vector3& axisX, const AZ::Vector3& axisY, const AZ::Vector3& axisZ, const AZ::Vector3& halfExtents)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawSolidOBB(AZVec3ToLYVec3(center), AZVec3ToLYVec3(axisX), AZVec3ToLYVec3(axisY), AZVec3ToLYVec3(axisZ), AZVec3ToLYVec3(halfExtents));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawPoint(const AZ::Vector3& p, int nSize)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawPoint(AZVec3ToLYVec3(p), nSize);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawLine(const AZ::Vector3& p1, const AZ::Vector3& p2)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawLine(
|
||||
AZVec3ToLYVec3(p1),
|
||||
AZVec3ToLYVec3(p2));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawLine(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector4& col1, const AZ::Vector4& col2)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawLine(
|
||||
AZVec3ToLYVec3(p1),
|
||||
AZVec3ToLYVec3(p2),
|
||||
ColorF(AZVec3ToLYVec3(col1.GetAsVector3()), col1.GetW()),
|
||||
ColorF(AZVec3ToLYVec3(col2.GetAsVector3()), col2.GetW()));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawLines(const AZStd::vector<AZ::Vector3>& lines, const AZ::Color& color)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
// transform to world space
|
||||
const auto vecTransform = [this](const AZ::Vector3& vec)
|
||||
{
|
||||
return m_dc->GetMatrix() * AZVec3ToLYVec3(vec);
|
||||
};
|
||||
|
||||
AZStd::vector<Vec3> cryLines;
|
||||
cryLines.reserve(cryLines.size());
|
||||
AZStd::transform(lines.begin(), lines.end(), AZStd::back_inserter(cryLines), vecTransform);
|
||||
m_dc->DrawLines(cryLines, AZColorToLYColorF(color));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawPolyLine(const AZ::Vector3* pnts, int numPoints, bool cycled)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
Vec3* points = new Vec3[numPoints];
|
||||
for (int i = 0; i < numPoints; ++i)
|
||||
{
|
||||
points[i] = AZVec3ToLYVec3(pnts[i]);
|
||||
}
|
||||
|
||||
m_dc->DrawPolyLine(points, numPoints, cycled);
|
||||
|
||||
delete[] points;
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireQuad2d(const AZ::Vector2& p1, const AZ::Vector2& p2, float z)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireQuad2d(
|
||||
QPoint(static_cast<int>(p1.GetX()), static_cast<int>(p1.GetY())),
|
||||
QPoint(static_cast<int>(p2.GetX()), static_cast<int>(p2.GetY())),
|
||||
z);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawLine2d(const AZ::Vector2& p1, const AZ::Vector2& p2, float z)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawLine2d(
|
||||
QPoint(static_cast<int>(p1.GetX()), static_cast<int>(p1.GetY())),
|
||||
QPoint(static_cast<int>(p2.GetX()), static_cast<int>(p2.GetY())),
|
||||
z);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawLine2dGradient(const AZ::Vector2& p1, const AZ::Vector2& p2, float z, const AZ::Vector4& firstColor, const AZ::Vector4& secondColor)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawLine2dGradient(
|
||||
QPoint(static_cast<int>(p1.GetX()), static_cast<int>(p1.GetY())),
|
||||
QPoint(static_cast<int>(p2.GetX()), static_cast<int>(p2.GetY())),
|
||||
z,
|
||||
ColorF(AZVec3ToLYVec3(firstColor.GetAsVector3()), firstColor.GetW()),
|
||||
ColorF(AZVec3ToLYVec3(secondColor.GetAsVector3()), secondColor.GetW()));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireCircle2d(const AZ::Vector2& center, float radius, float z)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireCircle2d(
|
||||
QPoint(static_cast<int>(center.GetX()), static_cast<int>(center.GetY())),
|
||||
radius, z);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTerrainCircle(const AZ::Vector3& worldPos, float radius, float height)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawTerrainCircle(
|
||||
AZVec3ToLYVec3(worldPos), radius, height);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTerrainCircle(const AZ::Vector3& center, float radius, float angle1, float angle2, float height)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawTerrainCircle(
|
||||
AZVec3ToLYVec3(center), radius, angle1, angle2, height);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawArc(const AZ::Vector3& pos, float radius, float startAngleDegrees, float sweepAngleDegrees, float angularStepDegrees, int referenceAxis)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawArc(
|
||||
AZVec3ToLYVec3(pos),
|
||||
radius,
|
||||
startAngleDegrees,
|
||||
sweepAngleDegrees,
|
||||
angularStepDegrees,
|
||||
referenceAxis);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawArc(const AZ::Vector3& pos, float radius, float startAngleDegrees, float sweepAngleDegrees, float angularStepDegrees, const AZ::Vector3& fixedAxis)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawArc(
|
||||
AZVec3ToLYVec3(pos),
|
||||
radius,
|
||||
startAngleDegrees,
|
||||
sweepAngleDegrees,
|
||||
angularStepDegrees,
|
||||
AZVec3ToLYVec3(fixedAxis));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawCircle(const AZ::Vector3& pos, float radius, int nUnchangedAxis)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawCircle(
|
||||
AZVec3ToLYVec3(pos),
|
||||
radius,
|
||||
nUnchangedAxis);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawHalfDottedCircle(const AZ::Vector3& pos, float radius, const AZ::Vector3& viewPos, int nUnchangedAxis)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawHalfDottedCircle(
|
||||
AZVec3ToLYVec3(pos),
|
||||
radius,
|
||||
AZVec3ToLYVec3(viewPos),
|
||||
nUnchangedAxis);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawCone(
|
||||
AZVec3ToLYVec3(pos),
|
||||
AZVec3ToLYVec3(dir),
|
||||
radius,
|
||||
height,
|
||||
drawShaded);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireCylinder(
|
||||
AZVec3ToLYVec3(center),
|
||||
AZVec3ToLYVec3(axis),
|
||||
radius,
|
||||
height);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawSolidCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawSolidCylinder(
|
||||
AZVec3ToLYVec3(center),
|
||||
AZVec3ToLYVec3(axis),
|
||||
radius,
|
||||
height,
|
||||
drawShaded);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireCapsule(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireCapsule(
|
||||
AZVec3ToLYVec3(center),
|
||||
AZVec3ToLYVec3(axis),
|
||||
radius,
|
||||
height);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTerrainRect(float x1, float y1, float x2, float y2, float height)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawTerrainRect(x1, y1, x2, y2, height);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTerrainLine(AZ::Vector3 worldPos1, AZ::Vector3 worldPos2)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawTerrainLine(
|
||||
AZVec3ToLYVec3(worldPos1),
|
||||
AZVec3ToLYVec3(worldPos2));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireSphere(const AZ::Vector3& pos, float radius)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireSphere(AZVec3ToLYVec3(pos), radius);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireSphere(const AZ::Vector3& pos, const AZ::Vector3 radius)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireSphere(
|
||||
AZVec3ToLYVec3(pos),
|
||||
AZVec3ToLYVec3(radius));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawWireDisk(
|
||||
AZVec3ToLYVec3(pos),
|
||||
AZVec3ToLYVec3(dir),
|
||||
radius);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawBall(const AZ::Vector3& pos, float radius, bool drawShaded)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawBall(AZVec3ToLYVec3(pos), radius, drawShaded);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawDisk(
|
||||
AZVec3ToLYVec3(pos),
|
||||
AZVec3ToLYVec3(dir),
|
||||
radius);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawArrow(const AZ::Vector3& src, const AZ::Vector3& trg, float fHeadScale, bool b2SidedArrow)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawArrow(
|
||||
AZVec3ToLYVec3(src),
|
||||
AZVec3ToLYVec3(trg),
|
||||
fHeadScale,
|
||||
b2SidedArrow);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTextLabel(const AZ::Vector3& pos, float size, const char* text, const bool bCenter, int srcOffsetX, int srcOffsetY)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawTextLabel(
|
||||
AZVec3ToLYVec3(pos),
|
||||
size,
|
||||
text,
|
||||
bCenter,
|
||||
srcOffsetX,
|
||||
srcOffsetY);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->Draw2dTextLabel(x, y, size, text, bCenter);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTextureLabel(ITexture* texture, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
float textureWidth = aznumeric_caster(texture->GetWidth());
|
||||
float textureHeight = aznumeric_caster(texture->GetHeight());
|
||||
|
||||
// resize the label in proportion to the actual texture size
|
||||
if (textureWidth > textureHeight)
|
||||
{
|
||||
sizeY = sizeX * (textureHeight / textureWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
sizeX = sizeY * (textureWidth / textureHeight);
|
||||
}
|
||||
|
||||
m_dc->DrawTextureLabel(AZVec3ToLYVec3(pos), sizeX, sizeY, texture->GetTextureID(), texIconFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTextureLabel(int textureId, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags)
|
||||
{
|
||||
// ToDo: With Atom?
|
||||
AZ_UNUSED(textureId);
|
||||
AZ_UNUSED(pos);
|
||||
AZ_UNUSED(sizeX);
|
||||
AZ_UNUSED(sizeY);
|
||||
AZ_UNUSED(texIconFlags);
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::SetLineWidth(float width)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->SetLineWidth(width);
|
||||
}
|
||||
}
|
||||
|
||||
bool SandboxIntegrationManager::IsVisible(const AZ::Aabb& bounds)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
const AABB aabb(
|
||||
AZVec3ToLYVec3(bounds.GetMin()),
|
||||
AZVec3ToLYVec3(bounds.GetMax()));
|
||||
|
||||
return m_dc->IsVisible(aabb);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SandboxIntegrationManager::SetFillMode(int nFillMode)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
return m_dc->SetFillMode(nFillMode);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
float SandboxIntegrationManager::GetLineWidth()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
return m_dc->GetLineWidth();
|
||||
}
|
||||
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
float SandboxIntegrationManager::GetAspectRatio()
|
||||
{
|
||||
if (m_dc && m_dc->GetView())
|
||||
{
|
||||
return m_dc->GetView()->GetAspectRatio();
|
||||
}
|
||||
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DepthTestOff()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DepthTestOff();
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DepthTestOn()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DepthTestOn();
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DepthWriteOff()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DepthWriteOff();
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DepthWriteOn()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DepthWriteOn();
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::CullOff()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->CullOff();
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::CullOn()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->CullOn();
|
||||
}
|
||||
}
|
||||
|
||||
bool SandboxIntegrationManager::SetDrawInFrontMode(bool bOn)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
return m_dc->SetDrawInFrontMode(bOn);
|
||||
}
|
||||
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
AZ::u32 SandboxIntegrationManager::GetState()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
return m_dc->GetState();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AZ::u32 SandboxIntegrationManager::SetState(AZ::u32 state)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
return m_dc->SetState(state);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::PushMatrix(const AZ::Transform& tm)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
const Matrix34 m = AZTransformToLYTransform(tm);
|
||||
m_dc->PushMatrix(m);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::PopMatrix()
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->PopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
bool SandboxIntegrationManager::DisplayHelpersVisible()
|
||||
{
|
||||
return GetIEditor()->GetDisplaySettings()->IsDisplayHelpers();
|
||||
|
||||
@@ -77,6 +77,7 @@ class CHyperGraph;
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
class EditorEntityAPI;
|
||||
class EditorEntityUiInterface;
|
||||
|
||||
namespace AssetBrowser
|
||||
@@ -99,7 +100,6 @@ class SandboxIntegrationManager
|
||||
, private AzToolsFramework::EditorEvents::Bus::Handler
|
||||
, private AzToolsFramework::EditorWindowRequests::Bus::Handler
|
||||
, private AzFramework::AssetCatalogEventBus::Handler
|
||||
, private AzFramework::DebugDisplayRequestBus::Handler
|
||||
, private AzFramework::DisplayContextRequestBus::Handler
|
||||
, private AzToolsFramework::EditorEntityContextNotificationBus::Handler
|
||||
, private AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler
|
||||
@@ -201,70 +201,6 @@ private:
|
||||
const AzFramework::SliceInstantiationTicket& ticket) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// AzToolsFramework::DebugDisplayRequestBus
|
||||
void SetColor(float r, float g, float b, float a) override;
|
||||
void SetColor(const AZ::Color& color) override;
|
||||
void SetColor(const AZ::Vector4& color) override;
|
||||
void SetAlpha(float a) override;
|
||||
void DrawQuad(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4) override;
|
||||
void DrawQuad(float width, float height) override;
|
||||
void DrawWireQuad(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4) override;
|
||||
void DrawWireQuad(float width, float height) override;
|
||||
void DrawQuadGradient(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4, const AZ::Vector4& firstColor, const AZ::Vector4& secondColor) override;
|
||||
void DrawTri(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3) override;
|
||||
void DrawTriangles(const AZStd::vector<AZ::Vector3>& vertices, const AZ::Color& color) override;
|
||||
void DrawTrianglesIndexed(const AZStd::vector<AZ::Vector3>& vertices, const AZStd::vector<AZ::u32>& indices, const AZ::Color& color) override;
|
||||
void DrawWireBox(const AZ::Vector3& min, const AZ::Vector3& max) override;
|
||||
void DrawSolidBox(const AZ::Vector3& min, const AZ::Vector3& max) override;
|
||||
void DrawSolidOBB(const AZ::Vector3& center, const AZ::Vector3& axisX, const AZ::Vector3& axisY, const AZ::Vector3& axisZ, const AZ::Vector3& halfExtents) override;
|
||||
void DrawPoint(const AZ::Vector3& p, int nSize) override;
|
||||
void DrawLine(const AZ::Vector3& p1, const AZ::Vector3& p2) override;
|
||||
void DrawLine(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector4& col1, const AZ::Vector4& col2) override;
|
||||
void DrawLines(const AZStd::vector<AZ::Vector3>& lines, const AZ::Color& color) override;
|
||||
void DrawPolyLine(const AZ::Vector3* pnts, int numPoints, bool cycled) override;
|
||||
void DrawWireQuad2d(const AZ::Vector2& p1, const AZ::Vector2& p2, float z) override;
|
||||
void DrawLine2d(const AZ::Vector2& p1, const AZ::Vector2& p2, float z) override;
|
||||
void DrawLine2dGradient(const AZ::Vector2& p1, const AZ::Vector2& p2, float z, const AZ::Vector4& firstColor, const AZ::Vector4& secondColor) override;
|
||||
void DrawWireCircle2d(const AZ::Vector2& center, float radius, float z) override;
|
||||
void DrawTerrainCircle(const AZ::Vector3& worldPos, float radius, float height) override;
|
||||
void DrawTerrainCircle(const AZ::Vector3& center, float radius, float angle1, float angle2, float height) override;
|
||||
void DrawArc(const AZ::Vector3& pos, float radius, float startAngleDegrees, float sweepAngleDegrees, float angularStepDegrees, int referenceAxis) override;
|
||||
void DrawArc(const AZ::Vector3& pos, float radius, float startAngleDegrees, float sweepAngleDegrees, float angularStepDegrees, const AZ::Vector3& fixedAxis) override;
|
||||
void DrawCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded = true) override;
|
||||
void DrawCircle(const AZ::Vector3& pos, float radius, int nUnchangedAxis) override;
|
||||
void DrawHalfDottedCircle(const AZ::Vector3& pos, float radius, const AZ::Vector3& viewPos, int nUnchangedAxis) override;
|
||||
void DrawWireCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) override;
|
||||
void DrawSolidCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded = true) override;
|
||||
void DrawWireCapsule(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) override;
|
||||
void DrawTerrainRect(float x1, float y1, float x2, float y2, float height) override;
|
||||
void DrawTerrainLine(AZ::Vector3 worldPos1, AZ::Vector3 worldPos2) override;
|
||||
void DrawWireSphere(const AZ::Vector3& pos, float radius) override;
|
||||
void DrawWireSphere(const AZ::Vector3& pos, const AZ::Vector3 radius) override;
|
||||
void DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) override;
|
||||
void DrawBall(const AZ::Vector3& pos, float radius, bool drawShaded = true) override;
|
||||
void DrawDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) override;
|
||||
void DrawArrow(const AZ::Vector3& src, const AZ::Vector3& trg, float fHeadScale, bool b2SidedArrow) override;
|
||||
void DrawTextLabel(const AZ::Vector3& pos, float size, const char* text, const bool bCenter, int srcOffsetX, int scrOffsetY) override;
|
||||
void Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter) override;
|
||||
void DrawTextureLabel(ITexture* texture, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags) override;
|
||||
void DrawTextureLabel(int textureId, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags) override;
|
||||
void SetLineWidth(float width) override;
|
||||
bool IsVisible(const AZ::Aabb& bounds) override;
|
||||
int SetFillMode(int nFillMode) override;
|
||||
float GetLineWidth() override;
|
||||
float GetAspectRatio() override;
|
||||
void DepthTestOff() override;
|
||||
void DepthTestOn() override;
|
||||
void DepthWriteOff() override;
|
||||
void DepthWriteOn() override;
|
||||
void CullOff() override;
|
||||
void CullOn() override;
|
||||
bool SetDrawInFrontMode(bool bOn) override;
|
||||
AZ::u32 GetState() override;
|
||||
AZ::u32 SetState(AZ::u32 state) override;
|
||||
void PushMatrix(const AZ::Transform& tm) override;
|
||||
void PopMatrix() override;
|
||||
|
||||
// AzFramework::DisplayContextRequestBus (and @deprecated EntityDebugDisplayRequestBus)
|
||||
// AzFramework::DisplayContextRequestBus
|
||||
void SetDC(DisplayContext* dc) override;
|
||||
@@ -371,6 +307,7 @@ private:
|
||||
|
||||
AzToolsFramework::EditorEntityUiInterface* m_editorEntityUiInterface = nullptr;
|
||||
AzToolsFramework::Prefab::PrefabIntegrationInterface* m_prefabIntegrationInterface = nullptr;
|
||||
AzToolsFramework::EditorEntityAPI* m_editorEntityAPI = nullptr;
|
||||
|
||||
// Overrides UI styling and behavior for Layer Entities
|
||||
AzToolsFramework::LayerUiHandler m_layerUiOverrideHandler;
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include "OutlinerTreeView.hxx"
|
||||
#include "Include/ICommandManager.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "OutlinerCacheBus.h"
|
||||
|
||||
#include <Editor/CryEditDoc.h>
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
@@ -1538,6 +1539,16 @@ void OutlinerListModel::OnEntityInfoUpdatedName(AZ::EntityId entityId, const AZS
|
||||
{
|
||||
(void)name;
|
||||
QueueEntityUpdate(entityId);
|
||||
|
||||
bool isSelected = false;
|
||||
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
|
||||
isSelected, &AzToolsFramework::ToolsApplicationRequests::IsSelected, entityId);
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
// Ask the system to scroll to the entity in case it is off screen after the rename
|
||||
OutlinerModelNotificationBus::Broadcast(&OutlinerModelNotifications::QueueScrollToNewContent, entityId);
|
||||
}
|
||||
}
|
||||
|
||||
void OutlinerListModel::OnEntityInfoUpdatedUnsavedChanges(AZ::EntityId entityId)
|
||||
|
||||
Reference in New Issue
Block a user