Merged main in

This commit is contained in:
Aristo7
2021-05-04 10:13:50 -05:00
427 changed files with 9465 additions and 26529 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: