[LYN-3078] Removed legacy CMaterial and all related/unused classes.
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#include "ViewManager.h"
|
||||
#include "Settings.h"
|
||||
#include "RenderHelpers/AxisHelper.h"
|
||||
#include "RenderHelpers/AxisHelperExtended.h"
|
||||
#include "IObjectManager.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -36,7 +35,6 @@ CAxisGizmo::CAxisGizmo(CBaseObject* object)
|
||||
assert(object != 0);
|
||||
m_object = object;
|
||||
m_pAxisHelper.reset(new CAxisHelper);
|
||||
m_pAxisHelperExtended.reset(new CAxisHelperExtended);
|
||||
|
||||
// Set selectable flag.
|
||||
SetFlags(EGIZMO_SELECTABLE | EGIZMO_TRANSFORM_MANIPULATOR);
|
||||
@@ -60,7 +58,6 @@ CAxisGizmo::CAxisGizmo()
|
||||
SetFlags(EGIZMO_SELECTABLE);
|
||||
m_axisGizmoCount++;
|
||||
m_pAxisHelper.reset(new CAxisHelper);
|
||||
m_pAxisHelperExtended.reset(new CAxisHelperExtended);
|
||||
m_bDragging = false;
|
||||
m_bAlwaysUseLocal = false;
|
||||
m_coordSysBackUp = COORDS_VIEW;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
// forward declarations.
|
||||
struct DisplayContext;
|
||||
class CAxisHelper;
|
||||
class CAxisHelperExtended;
|
||||
|
||||
/** Gizmo of Objects animation track.
|
||||
*/
|
||||
@@ -75,7 +74,6 @@ private:
|
||||
CBaseObjectPtr m_object;
|
||||
AABB m_bbox;
|
||||
std::unique_ptr<CAxisHelper> m_pAxisHelper;
|
||||
std::unique_ptr<CAxisHelperExtended> m_pAxisHelperExtended;
|
||||
|
||||
bool m_bDragging;
|
||||
QPoint m_cMouseDownPos;
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include "DisplaySettings.h"
|
||||
#include "Undo/Undo.h"
|
||||
#include "UsedResources.h"
|
||||
#include "Material/Material.h"
|
||||
#include "Material/MaterialManager.h"
|
||||
#include "GizmoManager.h"
|
||||
#include "Include/IIconManager.h"
|
||||
#include "Objects/SelectionGroup.h"
|
||||
@@ -398,7 +396,6 @@ CBaseObject::CBaseObject()
|
||||
, m_classDesc(nullptr)
|
||||
, m_numRefs(0)
|
||||
, m_parent(nullptr)
|
||||
, m_pMaterial(nullptr)
|
||||
, m_bInSelectionBox(false)
|
||||
, m_pTransformDelegate(nullptr)
|
||||
, m_bMatrixInWorldSpace(false)
|
||||
@@ -438,7 +435,6 @@ bool CBaseObject::Init([[maybe_unused]] IEditor* ie, CBaseObject* prev, [[maybe_
|
||||
SetArea(prev->GetArea());
|
||||
SetColor(prev->GetColor());
|
||||
m_nMaterialLayersMask = prev->m_nMaterialLayersMask;
|
||||
SetMaterial(prev->GetMaterial());
|
||||
SetMinSpec(prev->GetMinSpec(), false);
|
||||
|
||||
// Copy all basic variables.
|
||||
@@ -485,12 +481,6 @@ void CBaseObject::Done()
|
||||
|
||||
NotifyListeners(CBaseObject::ON_DELETE);
|
||||
m_eventListeners.clear();
|
||||
|
||||
if (m_pMaterial)
|
||||
{
|
||||
m_pMaterial->Release();
|
||||
m_pMaterial = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -1838,11 +1828,6 @@ void CBaseObject::Serialize(CObjectArchive& ar)
|
||||
SetFrozen(bFrozen);
|
||||
SetHidden(bHidden);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load material.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
SetMaterial(mtlName);
|
||||
|
||||
ar.SetResolveCallback(this, parentId, AZStd::bind(&CBaseObject::ResolveParent, this, AZStd::placeholders::_1 ));
|
||||
ar.SetResolveCallback(this, lookatId, AZStd::bind(&CBaseObject::SetLookAt, this, AZStd::placeholders::_1));
|
||||
|
||||
@@ -1912,11 +1897,6 @@ void CBaseObject::Serialize(CObjectArchive& ar)
|
||||
xmlNode->setAttr("Flags", flags);
|
||||
}
|
||||
|
||||
if (m_pMaterial)
|
||||
{
|
||||
xmlNode->setAttr("Material", GetMaterialName().toUtf8().data());
|
||||
}
|
||||
|
||||
if (m_nMinSpec != 0)
|
||||
{
|
||||
xmlNode->setAttr("MinSpec", (uint32)m_nMinSpec);
|
||||
@@ -1937,11 +1917,6 @@ XmlNodeRef CBaseObject::Export([[maybe_unused]] const QString& levelPath, XmlNod
|
||||
objNode->setAttr("Type", GetTypeName().toUtf8().data());
|
||||
objNode->setAttr("Name", GetName().toUtf8().data());
|
||||
|
||||
if (m_pMaterial)
|
||||
{
|
||||
objNode->setAttr("Material", m_pMaterial->GetName().toUtf8().data());
|
||||
}
|
||||
|
||||
Vec3 pos, scale;
|
||||
Quat rotate;
|
||||
if (m_parent)
|
||||
@@ -2926,7 +2901,6 @@ bool CBaseObject::ConvertFromObject(CBaseObject* object)
|
||||
{
|
||||
object->GetParent()->AttachChild(this);
|
||||
}
|
||||
SetMaterial(object->GetMaterial());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2981,14 +2955,6 @@ void CBaseObject::Validate(IErrorReport* report)
|
||||
report->ReportError(err);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (GetMaterial() != NULL && GetMaterial()->IsDummy())
|
||||
{
|
||||
CErrorRecord err;
|
||||
err.error = QStringLiteral("Material: %1 for object: %2 not found,").arg(GetMaterial()->GetName(), GetName());
|
||||
err.pObject = this;
|
||||
report->ReportError(err);
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -3055,10 +3021,6 @@ void CBaseObject::GatherUsedResources(CUsedResources& resources)
|
||||
{
|
||||
GetVarBlock()->GatherUsedResources(resources);
|
||||
}
|
||||
if (m_pMaterial)
|
||||
{
|
||||
m_pMaterial->GatherUsedResources(resources);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -3071,50 +3033,6 @@ bool CBaseObject::IsSimilarObject(CBaseObject* pObject)
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::SetMaterial(CMaterial* mtl)
|
||||
{
|
||||
if (m_pMaterial == mtl)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StoreUndo("Assign Material");
|
||||
if (m_pMaterial)
|
||||
{
|
||||
m_pMaterial->Release();
|
||||
}
|
||||
m_pMaterial = mtl;
|
||||
if (m_pMaterial)
|
||||
{
|
||||
m_pMaterial->AddRef();
|
||||
}
|
||||
|
||||
OnMaterialChanged(MATERIALCHANGE_ALL);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CBaseObject::GetMaterialName() const
|
||||
{
|
||||
if (m_pMaterial)
|
||||
{
|
||||
return m_pMaterial->GetName();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::SetMaterial(const QString& materialName)
|
||||
{
|
||||
CMaterial* pMaterial = NULL;
|
||||
CMaterialManager* pManager = GetIEditor()->GetMaterialManager();
|
||||
if (!materialName.isEmpty() && pManager != NULL)
|
||||
{
|
||||
pMaterial = pManager->LoadMaterial(materialName);
|
||||
}
|
||||
SetMaterial(pMaterial);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,6 @@ class CUndoBaseObject;
|
||||
class CObjectManager;
|
||||
class CGizmo;
|
||||
class CObjectArchive;
|
||||
class CMaterial;
|
||||
class CEdGeometry;
|
||||
struct SSubObjSelectionModifyContext;
|
||||
struct SRayHitInfo;
|
||||
@@ -135,13 +134,6 @@ enum ObjectEditFlags
|
||||
OBJECT_COLLAPSE_OBJECTPANEL = 0x004
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
enum MaterialChangeFlags
|
||||
{
|
||||
MATERIALCHANGE_SURFACETYPE = 0x001,
|
||||
MATERIALCHANGE_ALL = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Return values from CBaseObject::MouseCreateCallback method.
|
||||
enum MouseCreateResult
|
||||
@@ -554,22 +546,6 @@ public:
|
||||
//! Remove event listener callback.
|
||||
void RemoveEventListener(EventListener* listener);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Material handling for this base object.
|
||||
//! Override in derived classes.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Assign new material to this object.
|
||||
virtual void SetMaterial(CMaterial* mtl);
|
||||
//! Assign new material to this object as a material name.
|
||||
virtual void SetMaterial(const QString& materialName);
|
||||
//! Get assigned material for this object.
|
||||
virtual CMaterial* GetMaterial() const { return m_pMaterial; };
|
||||
// Get actual rendering material for this object.
|
||||
virtual CMaterial* GetRenderMaterial() const { return m_pMaterial; };
|
||||
// Get the material name. Even though the material pointer is null, the material name can exist separately.
|
||||
virtual QString GetMaterialName() const;
|
||||
virtual void OnMaterialChanged([[maybe_unused]] MaterialChangeFlags change) {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Analyze errors for this object.
|
||||
virtual void Validate(IErrorReport* report);
|
||||
@@ -861,9 +837,6 @@ private:
|
||||
//! Pointer to parent node.
|
||||
mutable CBaseObject* m_parent;
|
||||
|
||||
//! Material of this object.
|
||||
CMaterial* m_pMaterial;
|
||||
|
||||
AABB m_worldBounds;
|
||||
|
||||
// The transform delegate
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "Settings.h"
|
||||
#include "Viewport.h"
|
||||
#include "LineGizmo.h"
|
||||
#include "Material/MaterialManager.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "Objects/ObjectManager.h"
|
||||
#include "ViewManager.h"
|
||||
@@ -1077,11 +1076,6 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN
|
||||
|
||||
objNode->setAttr("Name", GetName().toUtf8().data());
|
||||
|
||||
if (GetMaterial())
|
||||
{
|
||||
objNode->setAttr("Material", GetMaterial()->GetName().toUtf8().data());
|
||||
}
|
||||
|
||||
Vec3 pos = GetPos(), scale = GetScale();
|
||||
Quat rotate = GetRotation();
|
||||
|
||||
@@ -1860,17 +1854,6 @@ void CEntityObject::OnLoadFailed()
|
||||
GetIEditor()->GetErrorReport()->ReportError(err);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMaterial* CEntityObject::GetRenderMaterial() const
|
||||
{
|
||||
if (GetMaterial())
|
||||
{
|
||||
return GetMaterial();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEntityObject::SetHelperScale(float scale)
|
||||
{
|
||||
@@ -1943,21 +1926,6 @@ void CEntityObject::OnContextMenu(QMenu* pMenu)
|
||||
CBaseObject::OnContextMenu(pMenu);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEntityObject::OnMaterialChanged(MaterialChangeFlags change)
|
||||
{
|
||||
if (change & MATERIALCHANGE_SURFACETYPE)
|
||||
{
|
||||
m_statObjValidator.Validate(0, GetRenderMaterial());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString CEntityObject::GetTooltip() const
|
||||
{
|
||||
return m_statObjValidator.GetDescription();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IOpticsElementBasePtr CEntityObject::GetOpticsElement()
|
||||
{
|
||||
@@ -1979,7 +1947,6 @@ void CEntityObject::SetOpticsName(const QString& opticsFullName)
|
||||
{
|
||||
pLight->SetLensOpticsElement(NULL);
|
||||
}
|
||||
SetMaterial(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
#include "IEntityObjectListener.h"
|
||||
#include "StatObjValidator.h"
|
||||
#include "Gizmo.h"
|
||||
#include "CryListenerSet.h"
|
||||
#include "StatObjBus.h"
|
||||
@@ -108,8 +107,6 @@ public:
|
||||
void SetEntityPropertyFloat(const char* name, float value);
|
||||
void SetEntityPropertyString(const char* name, const QString& value);
|
||||
|
||||
virtual QString GetTooltip() const;
|
||||
|
||||
virtual int MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags);
|
||||
virtual void OnContextMenu(QMenu* menu);
|
||||
|
||||
@@ -134,9 +131,6 @@ public:
|
||||
|
||||
virtual void SetTransformDelegate(ITransformDelegate* pTransformDelegate) override;
|
||||
|
||||
virtual CMaterial* GetRenderMaterial() const;
|
||||
virtual void OnMaterialChanged(MaterialChangeFlags change);
|
||||
|
||||
// Set attach flags and target
|
||||
enum EAttachmentType
|
||||
{
|
||||
@@ -405,8 +399,6 @@ protected:
|
||||
|
||||
static float m_helperScale;
|
||||
|
||||
CStatObjValidator m_statObjValidator;
|
||||
|
||||
EAttachmentType m_attachmentType;
|
||||
|
||||
bool m_bEnableReload;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
// Editor
|
||||
#include "Util/PakFile.h"
|
||||
#include "Material/MaterialManager.h"
|
||||
#include "WaitProgress.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
|
||||
@@ -239,14 +238,6 @@ void CObjectArchive::ResolveObjects()
|
||||
|
||||
obj.pObject->CreateGameObject();
|
||||
|
||||
CMaterial* pMaterial = obj.pObject->GetRenderMaterial();
|
||||
CMaterialManager* pManager = GetIEditor()->GetMaterialManager();
|
||||
|
||||
if (pMaterial && pMaterial->GetMatInfo() && pManager)
|
||||
{
|
||||
pManager->OnRequestMaterial(pMaterial->GetMatInfo());
|
||||
}
|
||||
|
||||
// unset the current validator object because the wait Step
|
||||
// might generate unrelated errors
|
||||
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
// Editor
|
||||
#include "ViewManager.h"
|
||||
#include "SurfaceInfoPicker.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -238,16 +238,6 @@ void CSelectionGroup::Move(const Vec3& offset, EMoveSelectionFlag moveFlag, [[ma
|
||||
}
|
||||
|
||||
SRayHitInfo pickedInfo;
|
||||
if (moveFlag == eMS_FollowGeometryPosNorm && bValidFollowGeometryMode)
|
||||
{
|
||||
CSurfaceInfoPicker::CExcludedObjects excludeObjects;
|
||||
for (int i = 0; i < GetFilteredCount(); ++i)
|
||||
{
|
||||
excludeObjects.Add(GetFilteredObject(i));
|
||||
}
|
||||
CSurfaceInfoPicker surfacePicker;
|
||||
bValidFollowGeometryMode = surfacePicker.Pick(point, pickedInfo, &excludeObjects);
|
||||
}
|
||||
|
||||
if (moveFlag == eMS_FollowGeometryPosNorm)
|
||||
{
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "StatObjValidator.h"
|
||||
|
||||
// Editor
|
||||
#include "Material/Material.h"
|
||||
|
||||
|
||||
CStatObjValidator::CStatObjValidator()
|
||||
: m_isValid(true)
|
||||
{
|
||||
}
|
||||
|
||||
template<size_t size>
|
||||
bool HasPrefix(const char* name, const char (&prefix)[size])
|
||||
{
|
||||
return _strnicmp(name, prefix, size - 1) == 0;
|
||||
}
|
||||
|
||||
struct SMeshMaterialIssue
|
||||
{
|
||||
AZStd::string nodeName;
|
||||
AZStd::string description;
|
||||
int subMaterialIndex;
|
||||
|
||||
SMeshMaterialIssue()
|
||||
: subMaterialIndex(-1)
|
||||
{
|
||||
}
|
||||
|
||||
SMeshMaterialIssue(const AZStd::string& name, const AZStd::string& description)
|
||||
: nodeName(name)
|
||||
, description(description)
|
||||
, subMaterialIndex(-1)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
static void ValidateMeshMaterials(std::vector<SMeshMaterialIssue>* issues, IStatObj* pStatObj, CMaterial* pMaterial)
|
||||
{
|
||||
_smart_ptr<IMaterial> pIMaterial = 0;
|
||||
if (pMaterial)
|
||||
{
|
||||
if (pMaterial->GetParent())
|
||||
{
|
||||
pIMaterial = pMaterial->GetParent()->GetMatInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
pIMaterial = pMaterial->GetMatInfo();
|
||||
}
|
||||
}
|
||||
|
||||
IIndexedMesh* pIndexedMesh = pStatObj->GetIndexedMesh(true);
|
||||
if (pIndexedMesh)
|
||||
{
|
||||
int breakableSubmeshes = 0;
|
||||
int nonbreakableSubmeshes = 0;
|
||||
|
||||
int subsetCount = pIndexedMesh->GetSubSetCount();
|
||||
for (int i = 0; i < subsetCount; ++i)
|
||||
{
|
||||
const SMeshSubset& subset = pIndexedMesh->GetSubSet(i);
|
||||
if (subset.nNumVerts == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check to see if the material uses multiple uv sets and if the vertex format has the same number of texCoord attributes
|
||||
SShaderItem shaderItem = pIMaterial->GetShaderItem(i);
|
||||
if (shaderItem.m_pShader)
|
||||
{
|
||||
size_t materialUVs = shaderItem.m_pShader->GetNumberOfUVSets();
|
||||
size_t meshUVs = subset.vertexFormat.GetAttributeUsageCount(AZ::Vertex::AttributeUsage::TexCoord);
|
||||
if (materialUVs != meshUVs)
|
||||
{
|
||||
const char* meshName = pStatObj->GetRenderMesh() ? pStatObj->GetRenderMesh()->GetSourceName() : "unknown";
|
||||
AZStd::string errorMessage;
|
||||
errorMessage = AZStd::string::format("Material '%s' sub-material %d with %zu uv set(s) was assigned to mesh '%s' with %zu uv set(s). ", pIMaterial->GetName(), i + 1, materialUVs, meshName, meshUVs);
|
||||
|
||||
AZStd::string recommendedAction;
|
||||
if (materialUVs < meshUVs)
|
||||
{
|
||||
recommendedAction = AZStd::string::format("If you do not intend to use %zu uv sets, remove the extra uv set(s) from the source mesh during the import process. Otherwise, consider checking the desired 'Use uv set 2 for...' shader gen params in the material editor.", meshUVs);
|
||||
}
|
||||
else
|
||||
{
|
||||
recommendedAction = AZStd::string::format("If you intend to use %zu uv sets, include the additional uv set(s) in the source mesh during the import process. Otherwise, consider unchecking the 'Use uv set 2 for...' shader gen params in the material editor.", materialUVs);
|
||||
}
|
||||
errorMessage += recommendedAction;
|
||||
AZ_Warning("Material Editor", false, errorMessage.c_str());
|
||||
SMeshMaterialIssue issue(meshName, errorMessage);
|
||||
issues->push_back(issue);
|
||||
}
|
||||
}
|
||||
|
||||
_smart_ptr<IMaterial> pSubMaterial = pIMaterial->GetSubMtl(subset.nMatID);
|
||||
if (!pSubMaterial)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (size_t(subset.nMatID) > size_t(pMaterial->GetSubMaterialCount()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pSubMaterial->GetSurfaceType()->GetBreakable2DParams())
|
||||
{
|
||||
++breakableSubmeshes;
|
||||
}
|
||||
else
|
||||
{
|
||||
++nonbreakableSubmeshes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int subobjectCount = pStatObj->GetSubObjectCount();
|
||||
for (int i = 0; i < subobjectCount; ++i)
|
||||
{
|
||||
const IStatObj::SSubObject* subobject = pStatObj->GetSubObject(i);
|
||||
if (subobject->pStatObj)
|
||||
{
|
||||
ValidateMeshMaterials(issues, subobject->pStatObj, pMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CStatObjValidator::Validate(IStatObj* statObj, CMaterial* editorMaterial)
|
||||
{
|
||||
m_description = QString();
|
||||
m_isValid = true;
|
||||
|
||||
_smart_ptr<IMaterial> pIMaterial = 0;
|
||||
if (editorMaterial)
|
||||
{
|
||||
if (editorMaterial->GetParent())
|
||||
{
|
||||
pIMaterial = editorMaterial->GetParent()->GetMatInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
pIMaterial = editorMaterial->GetMatInfo();
|
||||
}
|
||||
}
|
||||
|
||||
if (statObj && editorMaterial)
|
||||
{
|
||||
std::vector<SMeshMaterialIssue> issues;
|
||||
ValidateMeshMaterials(&issues, statObj, editorMaterial);
|
||||
|
||||
if (!issues.empty())
|
||||
{
|
||||
m_isValid = false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < issues.size(); ++i)
|
||||
{
|
||||
const SMeshMaterialIssue& issue = issues[i];
|
||||
if (!m_description.isEmpty())
|
||||
{
|
||||
m_description += "\n";
|
||||
}
|
||||
if (!issue.nodeName.empty())
|
||||
{
|
||||
m_description += "Node ";
|
||||
m_description += issue.nodeName.c_str();
|
||||
m_description += ":";
|
||||
}
|
||||
if (issue.subMaterialIndex >= 0)
|
||||
{
|
||||
m_description += QStringLiteral("SubMaterial %1:").arg(issue.subMaterialIndex + 1);
|
||||
}
|
||||
if (!issue.nodeName.empty() || issue.subMaterialIndex >= 0)
|
||||
{
|
||||
m_description += "\n ";
|
||||
}
|
||||
if (!issue.description.empty())
|
||||
{
|
||||
m_description += issue.description.c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// This class is supposed to validate CGF with assigned material.
|
||||
// Some of the asset issues may be diagnosed only when SurfaceType is known.
|
||||
|
||||
#pragma once
|
||||
|
||||
class CRYEDIT_API CStatObjValidator
|
||||
{
|
||||
public:
|
||||
CStatObjValidator();
|
||||
|
||||
void Validate(IStatObj* statObj, CMaterial* editorMaterial);
|
||||
bool IsValid() const { return m_isValid; }
|
||||
|
||||
QString GetDescription() const { return m_description; }
|
||||
private:
|
||||
bool m_isValid;
|
||||
QString m_description;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user