Merge remote-tracking branch 'upstream/main' into MoveDebugDisplayGlobalID

This commit is contained in:
rgba16f
2021-05-04 14:40:31 -05:00
484 changed files with 10665 additions and 27293 deletions
@@ -46,9 +46,7 @@
#include <LmbrCentral/Rendering/MaterialOwnerBus.h>
#include <IDisplayViewport.h>
#include <Material/MaterialManager.h>
#include <MathConversion.h>
#include <Objects/StatObjValidator.h>
#include <TrackView/TrackViewAnimNode.h>
#include <ViewManager.h>
#include <Viewport.h>
@@ -1096,56 +1094,3 @@ void CComponentEntityObject::DrawAccent(DisplayContext& dc)
dc.DrawWireBox(box.min, box.max);
}
}
void CComponentEntityObject::SetMaterial(CMaterial* material)
{
AZ::Entity* entity = nullptr;
EBUS_EVENT_RESULT(entity, AZ::ComponentApplicationBus, FindEntity, m_entityId);
if (entity)
{
if (material)
{
EBUS_EVENT_ID(m_entityId, LmbrCentral::MaterialOwnerRequestBus, SetMaterial, material->GetMatInfo());
}
else
{
EBUS_EVENT_ID(m_entityId, LmbrCentral::MaterialOwnerRequestBus, SetMaterial, nullptr);
}
}
ValidateMeshStatObject();
}
CMaterial* CComponentEntityObject::GetMaterial() const
{
_smart_ptr<IMaterial> material = nullptr;
EBUS_EVENT_ID_RESULT(material, m_entityId, LmbrCentral::MaterialOwnerRequestBus, GetMaterial);
return GetIEditor()->GetMaterialManager()->FromIMaterial(material);
}
CMaterial* CComponentEntityObject::GetRenderMaterial() const
{
AZ::Entity* entity = nullptr;
EBUS_EVENT_RESULT(entity, AZ::ComponentApplicationBus, FindEntity, m_entityId);
if (entity)
{
_smart_ptr<IMaterial> material = nullptr;
EBUS_EVENT_ID_RESULT(material, m_entityId, LmbrCentral::MaterialOwnerRequestBus, GetMaterial);
if (material)
{
return GetIEditor()->GetMaterialManager()->LoadMaterial(material->GetName(), false);
}
}
return nullptr;
}
void CComponentEntityObject::ValidateMeshStatObject()
{
IStatObj* statObj = GetIStatObj();
CMaterial* editorMaterial = GetMaterial();
CStatObjValidator statValidator;
statValidator.Validate(statObj, editorMaterial);
}
@@ -79,9 +79,6 @@ public:
CBaseObject* GetLinkParent() const override;
XmlNodeRef Export(const QString& levelPath, XmlNodeRef& xmlNode) override;
void DeleteEntity() override;
void SetMaterial(CMaterial* mtl) override;
CMaterial* GetMaterial() const override;
CMaterial* GetRenderMaterial() const override;
void DrawDefault(DisplayContext& dc, const QColor& labelColor = QColor(255, 255, 255)) override;
IStatObj* GetIStatObj() override;
bool IsIsolated() const override;
@@ -184,8 +181,6 @@ protected:
void DrawAccent(DisplayContext& dc);
void ValidateMeshStatObject();
class EditorActionGuard
{
public:
@@ -30,7 +30,6 @@
#include <AzFramework/Entity/EntityContextBus.h>
#include <AzFramework/Physics/Material.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzFramework/API/AtomActiveInterface.h>
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
@@ -162,13 +161,6 @@ void SandboxIntegrationManager::Setup()
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusConnect();
// turn on the this debug display request bus implementation if no other implementation is active
if( !(AZ::Interface<AzFramework::AtomActiveInterface>::Get() && AzFramework::DebugDisplayRequestBus::HasHandlers()))
{
m_debugDisplayBusImplementationActive = true;
AzFramework::DebugDisplayRequestBus::Handler::BusConnect(
AzFramework::g_defaultSceneEntityDebugDisplayId);
}
AzFramework::DisplayContextRequestBus::Handler::BusConnect();
SetupFileExtensionMap();
@@ -302,12 +294,15 @@ void SandboxIntegrationManager::OnCatalogAssetAdded(const AZ::Data::AssetId& ass
// operation writing to shared resource is queued on main thread.
void SandboxIntegrationManager::OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo& assetInfo)
{
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
// Check to see if the removed slice asset has any instance in the level, then check if
// those dangling instances are directly under the root slice (not sub-slices). If yes,
// detach them and save necessary information so they can be restored when their slice asset
// comes back.
if (assetInfo.m_assetType == AZ::AzTypeInfo<AZ::SliceAsset>::Uuid())
if (!isPrefabSystemEnabled && assetInfo.m_assetType == AZ::AzTypeInfo<AZ::SliceAsset>::Uuid())
{
AZ::SliceComponent* rootSlice = nullptr;
AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::BroadcastResult(rootSlice,