!B (Sandbox) (CE-21795) Importing models with multisubmaterials via fbx switches...
[CRYENGINE.git] / Code / CryEngine / CrySchematyc2 / Serialization / ValidatorArchive.cpp
blob32e5557d166f7df7f042d5ead72d1830d4d2f677
1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
3 #include "StdAfx.h"
4 #include "ValidatorArchive.h"
6 #include <CrySchematyc2/Serialization/ISerializationContext.h>
7 #include <CrySchematyc2/Services/ILog.h>
9 namespace Schematyc2
11 CValidatorArchive::CValidatorArchive(const SValidatorArchiveParams& params)
12 : IValidatorArchive(Serialization::IArchive::OUTPUT | Serialization::IArchive::INPLACE | Serialization::IArchive::VALIDATION)
13 , m_flags(params.flags)
14 , m_warningCount(0)
15 , m_errorCount(0)
18 bool CValidatorArchive::operator () (bool& value, const char* szName, const char* szLabel)
20 return true;
23 bool CValidatorArchive::operator () (int8& value, const char* szName, const char* szLabel)
25 return true;
28 bool CValidatorArchive::operator () (uint8& value, const char* szName, const char* szLabel)
30 return true;
33 bool CValidatorArchive::operator () (int32& value, const char* szName, const char* szLabel)
35 return true;
38 bool CValidatorArchive::operator () (uint32& value, const char* szName, const char* szLabel)
40 return true;
43 bool CValidatorArchive::operator () (int64& value, const char* szName, const char* szLabel)
45 return true;
48 bool CValidatorArchive::operator () (uint64& value, const char* szName, const char* szLabel)
50 return true;
53 bool CValidatorArchive::operator () (float& value, const char* szName, const char* szLabel)
55 return true;
58 bool CValidatorArchive::operator () (Serialization::IString& value, const char* szName, const char* szLabel)
60 return true;
63 bool CValidatorArchive::operator () (const Serialization::SStruct& value, const char* szName, const char* szLabel)
65 value(*this);
66 return true;
69 bool CValidatorArchive::operator() (Serialization::IContainer& value, const char* szName, const char* szLabel)
71 if(value.size())
75 value(*this, szName, szLabel);
76 } while(value.next());
78 return true;
81 uint32 CValidatorArchive::GetWarningCount() const
83 return m_warningCount;
86 uint32 CValidatorArchive::GetErrorCount() const
88 return m_errorCount;
91 void CValidatorArchive::validatorMessage(bool bError, const void* handle, const Serialization::TypeID& type, const char* szMessage)
93 if(bError)
95 if((m_flags & EValidatorArchiveFlags::ForwardErrorsToLog) != 0)
97 SValidatorLink validatorLink;
98 if(SerializationContext::GetValidatorLink(*this, validatorLink))
100 const CLogMessageMetaInfo metaInfo(ECryLinkCommand::Show, SLogMetaItemGUID(validatorLink.itemGUID), SLogMetaChildGUID(validatorLink.detailGUID));
101 SCHEMATYC2_SYSTEM_METAINFO_ERROR(metaInfo, szMessage);
103 else
105 SCHEMATYC2_SYSTEM_ERROR(szMessage);
108 ++ m_errorCount;
110 else
112 if((m_flags & EValidatorArchiveFlags::ForwardWarningsToLog) != 0)
114 SValidatorLink validatorLink;
115 if(SerializationContext::GetValidatorLink(*this, validatorLink))
117 const CLogMessageMetaInfo metaInfo(ECryLinkCommand::Show, SLogMetaItemGUID(validatorLink.itemGUID), SLogMetaChildGUID(validatorLink.detailGUID));
118 SCHEMATYC2_SYSTEM_METAINFO_WARNING(metaInfo, szMessage);
120 else
122 SCHEMATYC2_SYSTEM_WARNING(szMessage);
125 ++ m_warningCount;