mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-14 23:56:23 +00:00
More cleanup, renamed CMasterTemplate to CGameTemplate
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
#include "CMasterTemplate.h"
|
||||
#include "CGameTemplate.h"
|
||||
#include "Core/Resource/Factory/CWorldLoader.h"
|
||||
#include <Common/Log.h>
|
||||
|
||||
CMasterTemplate::CMasterTemplate()
|
||||
CGameTemplate::CGameTemplate()
|
||||
: mFullyLoaded(false)
|
||||
{
|
||||
}
|
||||
|
||||
void CMasterTemplate::Serialize(IArchive& Arc)
|
||||
void CGameTemplate::Serialize(IArchive& Arc)
|
||||
{
|
||||
Arc << SerialParameter("ScriptObjects", mScriptTemplates)
|
||||
<< SerialParameter("PropertyArchetypes", mPropertyTemplates)
|
||||
@@ -15,7 +15,7 @@ void CMasterTemplate::Serialize(IArchive& Arc)
|
||||
<< SerialParameter("Messages", mMessages);
|
||||
}
|
||||
|
||||
void CMasterTemplate::LoadSubTemplates()
|
||||
void CGameTemplate::LoadSubTemplates()
|
||||
{
|
||||
for (auto Iter = mScriptTemplates.begin(); Iter != mScriptTemplates.end(); Iter++)
|
||||
Internal_LoadScriptTemplate( Iter->second );
|
||||
@@ -24,7 +24,7 @@ void CMasterTemplate::LoadSubTemplates()
|
||||
Internal_LoadPropertyTemplate( Iter->second );
|
||||
}
|
||||
|
||||
void CMasterTemplate::Internal_LoadScriptTemplate(SScriptTemplatePath& Path)
|
||||
void CGameTemplate::Internal_LoadScriptTemplate(SScriptTemplatePath& Path)
|
||||
{
|
||||
ASSERT(Path.pTemplate == nullptr); // make sure it hasn't been loaded yet
|
||||
|
||||
@@ -38,7 +38,7 @@ void CMasterTemplate::Internal_LoadScriptTemplate(SScriptTemplatePath& Path)
|
||||
Path.pTemplate->PostLoad();
|
||||
}
|
||||
|
||||
void CMasterTemplate::Internal_LoadPropertyTemplate(SPropertyTemplatePath& Path)
|
||||
void CGameTemplate::Internal_LoadPropertyTemplate(SPropertyTemplatePath& Path)
|
||||
{
|
||||
if (Path.pTemplate != nullptr) // don't load twice
|
||||
return;
|
||||
@@ -55,7 +55,7 @@ void CMasterTemplate::Internal_LoadPropertyTemplate(SPropertyTemplatePath& Path)
|
||||
Path.pTemplate->Initialize(nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
void CMasterTemplate::SaveSubTemplates()
|
||||
void CGameTemplate::SaveSubTemplates()
|
||||
{
|
||||
const TString kGameDir = GetGameDirectory(true);
|
||||
|
||||
@@ -80,12 +80,21 @@ void CMasterTemplate::SaveSubTemplates()
|
||||
}
|
||||
}
|
||||
|
||||
u32 CMasterTemplate::GameVersion(TString VersionName)
|
||||
void CGameTemplate::SaveScriptTemplate(CScriptTemplate* pTemplate)
|
||||
{
|
||||
ASSERT( pTemplate->GameTemplate() == this );
|
||||
}
|
||||
|
||||
void CGameTemplate::SavePropertyTemplate(IProperty* pProperty)
|
||||
{
|
||||
}
|
||||
|
||||
u32 CGameTemplate::GameVersion(TString VersionName)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
CScriptTemplate* CMasterTemplate::TemplateByID(u32 ObjectID)
|
||||
CScriptTemplate* CGameTemplate::TemplateByID(u32 ObjectID)
|
||||
{
|
||||
auto it = mScriptTemplates.find(ObjectID);
|
||||
|
||||
@@ -95,18 +104,18 @@ CScriptTemplate* CMasterTemplate::TemplateByID(u32 ObjectID)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CScriptTemplate* CMasterTemplate::TemplateByID(const CFourCC& ObjectID)
|
||||
CScriptTemplate* CGameTemplate::TemplateByID(const CFourCC& ObjectID)
|
||||
{
|
||||
return TemplateByID(ObjectID.ToLong());
|
||||
}
|
||||
|
||||
CScriptTemplate* CMasterTemplate::TemplateByIndex(u32 Index)
|
||||
CScriptTemplate* CGameTemplate::TemplateByIndex(u32 Index)
|
||||
{
|
||||
auto it = mScriptTemplates.begin();
|
||||
return (std::next(it, Index))->second.pTemplate.get();
|
||||
}
|
||||
|
||||
SState CMasterTemplate::StateByID(u32 StateID)
|
||||
SState CGameTemplate::StateByID(u32 StateID)
|
||||
{
|
||||
auto Iter = mStates.find(StateID);
|
||||
|
||||
@@ -116,19 +125,19 @@ SState CMasterTemplate::StateByID(u32 StateID)
|
||||
return SState(-1, "Invalid");
|
||||
}
|
||||
|
||||
SState CMasterTemplate::StateByID(const CFourCC& State)
|
||||
SState CGameTemplate::StateByID(const CFourCC& State)
|
||||
{
|
||||
return StateByID(State.ToLong());
|
||||
}
|
||||
|
||||
SState CMasterTemplate::StateByIndex(u32 Index)
|
||||
SState CGameTemplate::StateByIndex(u32 Index)
|
||||
{
|
||||
auto Iter = mStates.begin();
|
||||
Iter = std::next(Iter, Index);
|
||||
return SState(Iter->first, Iter->second);
|
||||
}
|
||||
|
||||
SMessage CMasterTemplate::MessageByID(u32 MessageID)
|
||||
SMessage CGameTemplate::MessageByID(u32 MessageID)
|
||||
{
|
||||
auto Iter = mMessages.find(MessageID);
|
||||
|
||||
@@ -138,19 +147,19 @@ SMessage CMasterTemplate::MessageByID(u32 MessageID)
|
||||
return SMessage(-1, "Invalid");
|
||||
}
|
||||
|
||||
SMessage CMasterTemplate::MessageByID(const CFourCC& MessageID)
|
||||
SMessage CGameTemplate::MessageByID(const CFourCC& MessageID)
|
||||
{
|
||||
return MessageByID(MessageID.ToLong());
|
||||
}
|
||||
|
||||
SMessage CMasterTemplate::MessageByIndex(u32 Index)
|
||||
SMessage CGameTemplate::MessageByIndex(u32 Index)
|
||||
{
|
||||
auto Iter = mMessages.begin();
|
||||
Iter = std::next(Iter, Index);
|
||||
return SMessage(Iter->first, Iter->second);
|
||||
}
|
||||
|
||||
IProperty* CMasterTemplate::FindPropertyArchetype(const TString& kTypeName)
|
||||
IProperty* CGameTemplate::FindPropertyArchetype(const TString& kTypeName)
|
||||
{
|
||||
auto Iter = mPropertyTemplates.find(kTypeName);
|
||||
|
||||
@@ -174,54 +183,54 @@ IProperty* CMasterTemplate::FindPropertyArchetype(const TString& kTypeName)
|
||||
return Path.pTemplate.get();
|
||||
}
|
||||
|
||||
TString CMasterTemplate::GetGameDirectory(bool Absolute) const
|
||||
TString CGameTemplate::GetGameDirectory(bool Absolute) const
|
||||
{
|
||||
TString Out = mSourceFile.GetFileDirectory();
|
||||
return Absolute ? "../templates_new/" + Out : Out;
|
||||
}
|
||||
|
||||
// ************ STATIC ************
|
||||
CMasterTemplate* CMasterTemplate::MasterForGame(EGame Game)
|
||||
CGameTemplate* CGameTemplate::GetGameTemplate(EGame Game)
|
||||
{
|
||||
auto it = smMasterMap.find(Game);
|
||||
auto it = smGameMap.find(Game);
|
||||
|
||||
if (it != smMasterMap.end())
|
||||
if (it != smGameMap.end())
|
||||
return it->second;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::list<CMasterTemplate*> CMasterTemplate::MasterList()
|
||||
std::list<CGameTemplate*> CGameTemplate::GameTemplateList()
|
||||
{
|
||||
std::list<CMasterTemplate*> list;
|
||||
std::list<CGameTemplate*> list;
|
||||
|
||||
for (auto it = smMasterMap.begin(); it != smMasterMap.end(); it++)
|
||||
for (auto it = smGameMap.begin(); it != smGameMap.end(); it++)
|
||||
list.push_back(it->second);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
TString CMasterTemplate::FindGameName(EGame Game)
|
||||
TString CGameTemplate::FindGameName(EGame Game)
|
||||
{
|
||||
CMasterTemplate *pMaster = MasterForGame(Game);
|
||||
return pMaster ? pMaster->GameName() : "Unknown Game";
|
||||
CGameTemplate *pGame = GetGameTemplate(Game);
|
||||
return pGame ? pGame->GameName() : "Unknown Game";
|
||||
}
|
||||
|
||||
EGame CMasterTemplate::FindGameForName(const TString& rkName)
|
||||
EGame CGameTemplate::FindGameForName(const TString& rkName)
|
||||
{
|
||||
std::list<CMasterTemplate*> Masters = MasterList();
|
||||
std::list<CGameTemplate*> Games = GameTemplateList();
|
||||
|
||||
for (auto It = Masters.begin(); It != Masters.end(); It++)
|
||||
for (auto It = Games.begin(); It != Games.end(); It++)
|
||||
{
|
||||
CMasterTemplate *pMaster = *It;
|
||||
if (pMaster->GameName() == rkName)
|
||||
return pMaster->Game();
|
||||
CGameTemplate *pGame = *It;
|
||||
if (pGame->GameName() == rkName)
|
||||
return pGame->Game();
|
||||
}
|
||||
|
||||
return eUnknownGame;
|
||||
}
|
||||
|
||||
TString CMasterTemplate::PropertyName(u32 PropertyID)
|
||||
TString CGameTemplate::PropertyName(u32 PropertyID)
|
||||
{
|
||||
auto it = smPropertyNames.find(PropertyID);
|
||||
|
||||
@@ -232,7 +241,7 @@ TString CMasterTemplate::PropertyName(u32 PropertyID)
|
||||
}
|
||||
|
||||
// Removing these functions for now. I'm not sure of the best way to go about implementing them under the new system yet.
|
||||
u32 CMasterTemplate::CreatePropertyID(IProperty* pProp)
|
||||
u32 CGameTemplate::CreatePropertyID(IProperty* pProp)
|
||||
{
|
||||
// MP1 properties don't have IDs so we can use this function to create one to track instances of a particular property.
|
||||
// To ensure the IDs are unique we'll create a hash using two things: the struct source file and the ID string (relative to the struct).
|
||||
@@ -250,7 +259,7 @@ u32 CMasterTemplate::CreatePropertyID(IProperty* pProp)
|
||||
return Hash.Digest();
|
||||
}
|
||||
|
||||
void CMasterTemplate::AddProperty(IProperty* pProp, const TString& rkTemplateName /*= ""*/)
|
||||
void CGameTemplate::AddProperty(IProperty* pProp, const TString& rkTemplateName /*= ""*/)
|
||||
{
|
||||
u32 ID;
|
||||
|
||||
@@ -307,16 +316,16 @@ void CMasterTemplate::AddProperty(IProperty* pProp, const TString& rkTemplateNam
|
||||
}
|
||||
}
|
||||
|
||||
void CMasterTemplate::RenameProperty(IProperty* pProp, const TString& rkNewName)
|
||||
void CGameTemplate::RenameProperty(IProperty* pProp, const TString& rkNewName)
|
||||
{
|
||||
u32 ID = pProp->ID();
|
||||
if (ID <= 0xFF) ID = CreatePropertyID(pProp);
|
||||
RenameProperty(ID, rkNewName);
|
||||
}
|
||||
|
||||
void CMasterTemplate::RenameProperty(u32 ID, const TString& rkNewName)
|
||||
void CGameTemplate::RenameProperty(u32 ID, const TString& rkNewName)
|
||||
{
|
||||
// Master name list
|
||||
// Game name list
|
||||
auto NameIt = smPropertyNames.find(ID);
|
||||
TString Original;
|
||||
|
||||
@@ -341,7 +350,7 @@ void CMasterTemplate::RenameProperty(u32 ID, const TString& rkNewName)
|
||||
}
|
||||
}
|
||||
|
||||
void CMasterTemplate::XMLsUsingID(u32 ID, std::vector<TString>& rOutList)
|
||||
void CGameTemplate::XMLsUsingID(u32 ID, std::vector<TString>& rOutList)
|
||||
{
|
||||
auto InfoIt = smIDMap.find(ID);
|
||||
|
||||
@@ -352,7 +361,7 @@ void CMasterTemplate::XMLsUsingID(u32 ID, std::vector<TString>& rOutList)
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<IProperty*>* CMasterTemplate::TemplatesWithMatchingID(IProperty* pProp)
|
||||
const std::vector<IProperty*>* CGameTemplate::TemplatesWithMatchingID(IProperty* pProp)
|
||||
{
|
||||
u32 ID = pProp->ID();
|
||||
if (ID <= 0xFF) ID = CreatePropertyID(pProp);
|
||||
@@ -367,7 +376,7 @@ const std::vector<IProperty*>* CMasterTemplate::TemplatesWithMatchingID(IPropert
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::map<u32, CMasterTemplate::SPropIDInfo> CMasterTemplate::smIDMap;
|
||||
std::map<EGame, CMasterTemplate*> CMasterTemplate::smMasterMap;
|
||||
std::map<u32, TString> CMasterTemplate::smPropertyNames;
|
||||
u32 CMasterTemplate::smGameListVersion;
|
||||
std::map<u32, CGameTemplate::SPropIDInfo> CGameTemplate::smIDMap;
|
||||
std::map<EGame, CGameTemplate*> CGameTemplate::smGameMap;
|
||||
std::map<u32, TString> CGameTemplate::smPropertyNames;
|
||||
u32 CGameTemplate::smGameListVersion;
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CMASTERTEMPLATE_H
|
||||
#define CMASTERTEMPLATE_H
|
||||
#ifndef CGAMETEMPLATE_H
|
||||
#define CGAMETEMPLATE_H
|
||||
|
||||
#include "CLink.h"
|
||||
#include "CScriptTemplate.h"
|
||||
@@ -35,7 +35,7 @@ struct SObjId
|
||||
}
|
||||
};
|
||||
|
||||
class CMasterTemplate
|
||||
class CGameTemplate
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
@@ -120,7 +120,7 @@ class CMasterTemplate
|
||||
std::vector<IProperty*> PropertyList; // List of all properties that use this ID
|
||||
};
|
||||
static std::map<u32, SPropIDInfo> smIDMap;
|
||||
static std::map<EGame, CMasterTemplate*> smMasterMap;
|
||||
static std::map<EGame, CGameTemplate*> smGameMap;
|
||||
static std::map<u32, TString> smPropertyNames;
|
||||
static u32 smGameListVersion;
|
||||
|
||||
@@ -128,10 +128,12 @@ class CMasterTemplate
|
||||
void Internal_LoadPropertyTemplate(SPropertyTemplatePath& Path);
|
||||
|
||||
public:
|
||||
CMasterTemplate();
|
||||
CGameTemplate();
|
||||
void Serialize(IArchive& Arc);
|
||||
void LoadSubTemplates();
|
||||
void SaveSubTemplates();
|
||||
void SaveScriptTemplate(CScriptTemplate* pTemplate);
|
||||
void SavePropertyTemplate(IProperty* pProperty);
|
||||
u32 GameVersion(TString VersionName);
|
||||
CScriptTemplate* TemplateByID(u32 ObjectID);
|
||||
CScriptTemplate* TemplateByID(const CFourCC& ObjectID);
|
||||
@@ -154,8 +156,8 @@ public:
|
||||
inline bool IsLoadedSuccessfully() { return mFullyLoaded; }
|
||||
|
||||
// Static
|
||||
static CMasterTemplate* MasterForGame(EGame Game);
|
||||
static std::list<CMasterTemplate*> MasterList();
|
||||
static CGameTemplate* GetGameTemplate(EGame Game);
|
||||
static std::list<CGameTemplate*> GameTemplateList();
|
||||
static TString FindGameName(EGame Game);
|
||||
static EGame FindGameForName(const TString& rkName);
|
||||
static TString PropertyName(u32 PropertyID);
|
||||
@@ -167,4 +169,4 @@ public:
|
||||
static const std::vector<IProperty*>* TemplatesWithMatchingID(IProperty *pTemp);
|
||||
};
|
||||
|
||||
#endif // CMASTERTEMPLATE_H
|
||||
#endif // CGAMETEMPLATE_H
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CScriptObject.h"
|
||||
#include "CScriptLayer.h"
|
||||
#include "CMasterTemplate.h"
|
||||
#include "CGameTemplate.h"
|
||||
#include "Core/Resource/Animation/CAnimSet.h"
|
||||
|
||||
CScriptObject::CScriptObject(u32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate)
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
// Accessors
|
||||
CScriptTemplate* Template() const { return mpTemplate; }
|
||||
CMasterTemplate* MasterTemplate() const { return mpTemplate->MasterTemplate(); }
|
||||
CGameTemplate* GameTemplate() const { return mpTemplate->GameTemplate(); }
|
||||
CGameArea* Area() const { return mpArea; }
|
||||
CScriptLayer* Layer() const { return mpLayer; }
|
||||
u32 Version() const { return mVersion; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "CScriptTemplate.h"
|
||||
#include "CScriptObject.h"
|
||||
#include "CMasterTemplate.h"
|
||||
#include "CGameTemplate.h"
|
||||
#include "Core/GameProject/CResourceStore.h"
|
||||
#include "Core/Resource/Animation/CAnimSet.h"
|
||||
#include <Common/Log.h>
|
||||
@@ -9,8 +9,8 @@
|
||||
#include <string>
|
||||
|
||||
// Old constructor
|
||||
CScriptTemplate::CScriptTemplate(CMasterTemplate *pMaster)
|
||||
: mpMaster(pMaster)
|
||||
CScriptTemplate::CScriptTemplate(CGameTemplate *pGame)
|
||||
: mpGame(pGame)
|
||||
, mpProperties(nullptr)
|
||||
, mVisible(true)
|
||||
, mpNameProperty(nullptr)
|
||||
@@ -26,7 +26,7 @@ CScriptTemplate::CScriptTemplate(CMasterTemplate *pMaster)
|
||||
}
|
||||
|
||||
// New constructor
|
||||
CScriptTemplate::CScriptTemplate(CMasterTemplate* pInMaster, u32 InObjectID, const TString& kInFilePath)
|
||||
CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, u32 InObjectID, const TString& kInFilePath)
|
||||
: mRotationType(eRotationEnabled)
|
||||
, mScaleType(eScaleEnabled)
|
||||
, mPreviewScale(1.f)
|
||||
@@ -34,7 +34,7 @@ CScriptTemplate::CScriptTemplate(CMasterTemplate* pInMaster, u32 InObjectID, con
|
||||
, mVolumeScale(1.f)
|
||||
, mSourceFile(kInFilePath)
|
||||
, mObjectID(InObjectID)
|
||||
, mpMaster(pInMaster)
|
||||
, mpGame(pInGame)
|
||||
, mpNameProperty(nullptr)
|
||||
, mpPositionProperty(nullptr)
|
||||
, mpRotationProperty(nullptr)
|
||||
@@ -91,7 +91,7 @@ void CScriptTemplate::PostLoad()
|
||||
|
||||
EGame CScriptTemplate::Game() const
|
||||
{
|
||||
return mpMaster->Game();
|
||||
return mpGame->Game();
|
||||
}
|
||||
|
||||
// ************ PROPERTY FETCHING ************
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
class CMasterTemplate;
|
||||
class CGameTemplate;
|
||||
class CScriptObject;
|
||||
typedef TString TIDString;
|
||||
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
};
|
||||
|
||||
std::vector<TString> mModules;
|
||||
std::unique_ptr<CStructPropertyNew> mpProperties;
|
||||
std::unique_ptr<CStructProperty> mpProperties;
|
||||
std::vector<SEditorAsset> mAssets;
|
||||
std::vector<SAttachment> mAttachments;
|
||||
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
TIDString mActiveIDString;
|
||||
TIDString mLightParametersIDString;
|
||||
|
||||
CMasterTemplate* mpMaster;
|
||||
CGameTemplate* mpGame;
|
||||
std::list<CScriptObject*> mObjectList;
|
||||
|
||||
CStringProperty* mpNameProperty;
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
CVectorProperty* mpRotationProperty;
|
||||
CVectorProperty* mpScaleProperty;
|
||||
CBoolProperty* mpActiveProperty;
|
||||
CStructPropertyNew* mpLightParametersProperty;
|
||||
CStructProperty* mpLightParametersProperty;
|
||||
|
||||
struct SVolumeCondition {
|
||||
u32 Value;
|
||||
@@ -132,9 +132,9 @@ public:
|
||||
// Default constructor. Don't use. This is only here so the serializer doesn't complain
|
||||
CScriptTemplate() { ASSERT(false); }
|
||||
// Old constructor
|
||||
CScriptTemplate(CMasterTemplate *pMaster);
|
||||
CScriptTemplate(CGameTemplate *pGame);
|
||||
// New constructor
|
||||
CScriptTemplate(CMasterTemplate* pMaster, u32 ObjectID, const TString& kFilePath);
|
||||
CScriptTemplate(CGameTemplate* pGame, u32 ObjectID, const TString& kFilePath);
|
||||
~CScriptTemplate();
|
||||
void Serialize(IArchive& rArc);
|
||||
void PostLoad();
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
CCollisionMeshGroup* FindCollision(void* pPropertyData);
|
||||
|
||||
// Accessors
|
||||
inline CMasterTemplate* MasterTemplate() const { return mpMaster; }
|
||||
inline CGameTemplate* GameTemplate() const { return mpGame; }
|
||||
inline TString Name() const { return mpProperties->Name(); }
|
||||
inline ERotationType RotationType() const { return mRotationType; }
|
||||
inline EScaleType ScaleType() const { return mScaleType; }
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
inline u32 ObjectID() const { return mObjectID; }
|
||||
inline bool IsVisible() const { return mVisible; }
|
||||
inline TString SourceFile() const { return mSourceFile; }
|
||||
inline CStructPropertyNew* Properties() const { return mpProperties.get(); }
|
||||
inline CStructProperty* Properties() const { return mpProperties.get(); }
|
||||
inline u32 NumAttachments() const { return mAttachments.size(); }
|
||||
const SAttachment& Attachment(u32 Index) const { return mAttachments[Index]; }
|
||||
const std::vector<TString>& RequiredModules() const { return mModules; }
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
inline CVectorProperty* RotationProperty() const { return mpRotationProperty; }
|
||||
inline CVectorProperty* ScaleProperty() const { return mpScaleProperty; }
|
||||
inline CBoolProperty* ActiveProperty() const { return mpActiveProperty; }
|
||||
inline CStructPropertyNew* LightParametersProperty() const { return mpLightParametersProperty; }
|
||||
inline CStructProperty* LightParametersProperty() const { return mpLightParametersProperty; }
|
||||
|
||||
inline void SetVisible(bool Visible) { mVisible = Visible; }
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CByteProperty : public TNumericalPropertyNew< s8, EPropertyTypeNew::Byte >
|
||||
class CByteProperty : public TNumericalProperty< s8, EPropertyType::Byte >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CByteProperty(EGame Game)
|
||||
: TNumericalPropertyNew(Game)
|
||||
: TNumericalProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#include "IProperty.h"
|
||||
#include "CFloatProperty.h"
|
||||
|
||||
class CColorProperty : public TSerializeableTypedProperty< CColor, EPropertyTypeNew::Color >
|
||||
class CColorProperty : public TSerializeableTypedProperty< CColor, EPropertyType::Color >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CColorProperty(EGame Game)
|
||||
@@ -16,10 +16,10 @@ protected:
|
||||
public:
|
||||
virtual void PostInitialize()
|
||||
{
|
||||
CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 0, "R");
|
||||
CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 4, "G");
|
||||
CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 8, "B");
|
||||
CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 12, "A");
|
||||
CreateIntrinsic(EPropertyType::Float, this, mOffset + 0, "R");
|
||||
CreateIntrinsic(EPropertyType::Float, this, mOffset + 4, "G");
|
||||
CreateIntrinsic(EPropertyType::Float, this, mOffset + 8, "B");
|
||||
CreateIntrinsic(EPropertyType::Float, this, mOffset + 12, "A");
|
||||
TPropCast<CFloatProperty>( mChildren.back() )->SetDefaultValue(1.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
*
|
||||
* In PWE, however, they are both implemented the same way under the hood.
|
||||
*/
|
||||
template<EPropertyTypeNew TypeEnum>
|
||||
template<EPropertyType TypeEnum>
|
||||
class TEnumPropertyBase : public TSerializeableTypedProperty<s32, TypeEnum>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
struct SEnumValue
|
||||
{
|
||||
@@ -54,7 +54,7 @@ protected:
|
||||
public:
|
||||
virtual const char* GetHashableTypeName() const
|
||||
{
|
||||
if (TypeEnum == EPropertyTypeNew::Enum)
|
||||
if (TypeEnum == EPropertyType::Enum)
|
||||
return "enum";
|
||||
else
|
||||
return "choice";
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
virtual void Serialize(IArchive& rArc)
|
||||
{
|
||||
// Skip TSerializeableTypedProperty, serialize default value ourselves so we can set SH_HexDisplay
|
||||
TTypedPropertyNew::Serialize(rArc);
|
||||
TTypedProperty::Serialize(rArc);
|
||||
|
||||
TEnumPropertyBase* pArchetype = static_cast<TEnumPropertyBase*>(mpArchetype);
|
||||
u32 DefaultValueFlags = SH_HexDisplay | (pArchetype || Game() <= ePrime ? SH_Optional : 0);
|
||||
@@ -80,9 +80,9 @@ public:
|
||||
Arc.SerializePrimitive( (u32&) ValueRef(pData), 0 );
|
||||
}
|
||||
|
||||
virtual void InitFromArchetype(IPropertyNew* pOther)
|
||||
virtual void InitFromArchetype(IProperty* pOther)
|
||||
{
|
||||
TTypedPropertyNew::InitFromArchetype(pOther);
|
||||
TTypedProperty::InitFromArchetype(pOther);
|
||||
TEnumPropertyBase* pOtherEnum = static_cast<TEnumPropertyBase*>(pOther);
|
||||
mValues = pOtherEnum->mValues;
|
||||
}
|
||||
@@ -132,18 +132,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
typedef TEnumPropertyBase<EPropertyTypeNew::Choice> CChoiceProperty;
|
||||
typedef TEnumPropertyBase<EPropertyTypeNew::Enum> CEnumProperty;
|
||||
typedef TEnumPropertyBase<EPropertyType::Choice> CChoiceProperty;
|
||||
typedef TEnumPropertyBase<EPropertyType::Enum> CEnumProperty;
|
||||
|
||||
// Specialization of TPropCast to allow interchangeable casting, as both types are the same thing
|
||||
template<>
|
||||
inline CEnumProperty* TPropCast(IPropertyNew* pProperty)
|
||||
inline CEnumProperty* TPropCast(IProperty* pProperty)
|
||||
{
|
||||
if (pProperty)
|
||||
{
|
||||
EPropertyTypeNew InType = pProperty->Type();
|
||||
EPropertyType InType = pProperty->Type();
|
||||
|
||||
if (InType == EPropertyTypeNew::Enum || InType == EPropertyTypeNew::Choice)
|
||||
if (InType == EPropertyType::Enum || InType == EPropertyType::Choice)
|
||||
{
|
||||
return static_cast<CEnumProperty*>(pProperty);
|
||||
}
|
||||
@@ -153,13 +153,13 @@ inline CEnumProperty* TPropCast(IPropertyNew* pProperty)
|
||||
}
|
||||
|
||||
template<>
|
||||
inline CChoiceProperty* TPropCast(IPropertyNew* pProperty)
|
||||
inline CChoiceProperty* TPropCast(IProperty* pProperty)
|
||||
{
|
||||
if (pProperty)
|
||||
{
|
||||
EPropertyTypeNew InType = pProperty->Type();
|
||||
EPropertyType InType = pProperty->Type();
|
||||
|
||||
if (InType == EPropertyTypeNew::Enum || InType == EPropertyTypeNew::Choice)
|
||||
if (InType == EPropertyType::Enum || InType == EPropertyType::Choice)
|
||||
{
|
||||
return static_cast<CChoiceProperty*>(pProperty);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "CFlagsProperty.h"
|
||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||
#include "Core/Resource/Script/CGameTemplate.h"
|
||||
|
||||
void CFlagsProperty::Serialize(IArchive& rArc)
|
||||
{
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CFlagsProperty : public TSerializeableTypedProperty<u32, EPropertyTypeNew::Flags>
|
||||
class CFlagsProperty : public TSerializeableTypedProperty<u32, EPropertyType::Flags>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
struct SBitFlag
|
||||
{
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
virtual void PostInitialize();
|
||||
virtual void SerializeValue(void* pData, IArchive& rArc) const;
|
||||
virtual void InitFromArchetype(IPropertyNew* pOther);
|
||||
virtual void InitFromArchetype(IProperty* pOther);
|
||||
virtual TString GetTemplateFileName();
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CFloatProperty : public TNumericalPropertyNew< float, EPropertyTypeNew::Float >
|
||||
class CFloatProperty : public TNumericalProperty< float, EPropertyType::Float >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CFloatProperty(EGame Game)
|
||||
: TNumericalPropertyNew(Game)
|
||||
: TNumericalProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CGuidProperty : public TTypedPropertyNew< std::vector<char>, EPropertyTypeNew::Guid >
|
||||
class CGuidProperty : public TTypedProperty< std::vector<char>, EPropertyType::Guid >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CGuidProperty(EGame Game)
|
||||
: TTypedPropertyNew(Game)
|
||||
: TTypedProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CIntProperty : public TNumericalPropertyNew< s32, EPropertyTypeNew::Int >
|
||||
class CIntProperty : public TNumericalProperty< s32, EPropertyType::Int >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CIntProperty(EGame Game)
|
||||
: TNumericalPropertyNew(Game)
|
||||
: TNumericalProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CPointerProperty : public TTypedPropertyNew<void*, EPropertyTypeNew::Pointer>
|
||||
class CPointerProperty : public TTypedProperty<void*, EPropertyType::Pointer>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
CPointerProperty(EGame Game)
|
||||
: TTypedPropertyNew(Game)
|
||||
: TTypedProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "CPropertyNameGenerator.h"
|
||||
#include "IUIRelay.h"
|
||||
#include "Core/Resource/Factory/CTemplateLoader.h"
|
||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||
#include "Core/Resource/Script/CGameTemplate.h"
|
||||
#include <Common/Hash/CCRC32.h>
|
||||
|
||||
/** Default constructor */
|
||||
@@ -151,7 +151,7 @@ void CPropertyNameGenerator::Generate(const SPropertyNameGenerationParameters& r
|
||||
|
||||
// Check if this hash is a property ID - it's valid if there are any XMLs using this ID
|
||||
SGeneratedPropertyName PropertyName;
|
||||
CMasterTemplate::XMLsUsingID(PropertyID, PropertyName.XmlList);
|
||||
CGameTemplate::XMLsUsingID(PropertyID, PropertyName.XmlList);
|
||||
|
||||
if (PropertyName.XmlList.size() > 0)
|
||||
{
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CSequenceProperty : public TTypedPropertyNew< s32, EPropertyTypeNew::Sequence >
|
||||
class CSequenceProperty : public TTypedProperty< s32, EPropertyType::Sequence >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CSequenceProperty(EGame Game)
|
||||
: TTypedPropertyNew(Game)
|
||||
: TTypedProperty(Game)
|
||||
{}
|
||||
|
||||
virtual void SerializeValue(void* pData, IArchive& rArc) const
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CShortProperty : public TNumericalPropertyNew< s16, EPropertyTypeNew::Short >
|
||||
class CShortProperty : public TNumericalProperty< s16, EPropertyType::Short >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CShortProperty(EGame Game)
|
||||
: TNumericalPropertyNew(Game)
|
||||
: TNumericalProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CSoundProperty : public TSerializeableTypedProperty< s32, EPropertyTypeNew::Sound >
|
||||
class CSoundProperty : public TSerializeableTypedProperty< s32, EPropertyType::Sound >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CSoundProperty(EGame Game)
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CSplineProperty : public TTypedPropertyNew< std::vector<char>, EPropertyTypeNew::Spline >
|
||||
class CSplineProperty : public TTypedProperty< std::vector<char>, EPropertyType::Spline >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CSplineProperty(EGame Game)
|
||||
: TTypedPropertyNew(Game)
|
||||
: TTypedProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CStringProperty : public TSerializeableTypedProperty< TString, EPropertyTypeNew::String >
|
||||
class CStringProperty : public TSerializeableTypedProperty< TString, EPropertyType::String >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CStringProperty(EGame Game)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "CStructProperty.h"
|
||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||
#include "Core/Resource/Script/CGameTemplate.h"
|
||||
|
||||
EPropertyType CStructProperty::Type() const
|
||||
{
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CStructPropertyNew : public IPropertyNew
|
||||
class CStructProperty : public IProperty
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
public:
|
||||
// Must be a valid type for TPropertyRef
|
||||
@@ -16,12 +16,12 @@ protected:
|
||||
/** For archetypes, the filename of the template XML file. */
|
||||
TString mTemplateFileName;
|
||||
|
||||
CStructPropertyNew(EGame Game)
|
||||
: IPropertyNew(Game)
|
||||
CStructProperty(EGame Game)
|
||||
: IProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
virtual EPropertyTypeNew Type() const;
|
||||
virtual EPropertyType Type() const;
|
||||
virtual u32 DataSize() const;
|
||||
virtual u32 DataAlignment() const;
|
||||
virtual void Construct(void* pData) const;
|
||||
@@ -31,11 +31,11 @@ public:
|
||||
virtual const char* HashableTypeName() const;
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
virtual void SerializeValue(void* pData, IArchive& Arc) const;
|
||||
virtual void InitFromArchetype(IPropertyNew* pOther);
|
||||
virtual void InitFromArchetype(IProperty* pOther);
|
||||
virtual bool ShouldSerialize() const;
|
||||
virtual TString GetTemplateFileName();
|
||||
|
||||
inline static EPropertyTypeNew StaticType() { return EPropertyTypeNew::Struct; }
|
||||
inline static EPropertyType StaticType() { return EPropertyType::Struct; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "IProperty.h"
|
||||
|
||||
class CVectorProperty : public TSerializeableTypedProperty< CVector3f, EPropertyTypeNew::Vector >
|
||||
class CVectorProperty : public TSerializeableTypedProperty< CVector3f, EPropertyType::Vector >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CVectorProperty(EGame Game)
|
||||
@@ -15,9 +15,9 @@ protected:
|
||||
public:
|
||||
virtual void PostInitialize() override
|
||||
{
|
||||
CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 0, "X");
|
||||
CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 4, "Y");
|
||||
CreateIntrinsic(EPropertyTypeNew::Float, this, mOffset + 8, "Z");
|
||||
CreateIntrinsic(EPropertyType::Float, this, mOffset + 0, "X");
|
||||
CreateIntrinsic(EPropertyType::Float, this, mOffset + 4, "Y");
|
||||
CreateIntrinsic(EPropertyType::Float, this, mOffset + 8, "Z");
|
||||
}
|
||||
|
||||
virtual void SerializeValue(void* pData, IArchive& Arc) const
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include "CFlagsProperty.h"
|
||||
#include "CPointerProperty.h"
|
||||
|
||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||
#include "Core/Resource/Script/CGameTemplate.h"
|
||||
#include "Core/Resource/Script/CScriptTemplate.h"
|
||||
|
||||
/** IPropertyNew */
|
||||
IPropertyNew::IPropertyNew(EGame Game)
|
||||
/** IProperty */
|
||||
IProperty::IProperty(EGame Game)
|
||||
: mpParent( nullptr )
|
||||
, mpPointerParent( nullptr )
|
||||
, mpArchetype( nullptr )
|
||||
@@ -17,12 +17,12 @@ IPropertyNew::IPropertyNew(EGame Game)
|
||||
, mpScriptTemplate( nullptr )
|
||||
, mOffset( -1 )
|
||||
, mID( -1 )
|
||||
, mCookPreference( ECookPreferenceNew::Default )
|
||||
, mCookPreference( ECookPreference::Default )
|
||||
, mMinVersion( 0.0f )
|
||||
, mMaxVersion( FLT_MAX )
|
||||
{}
|
||||
|
||||
void IPropertyNew::_ClearChildren()
|
||||
void IProperty::_ClearChildren()
|
||||
{
|
||||
for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
delete mChildren[ChildIdx];
|
||||
@@ -30,7 +30,7 @@ void IPropertyNew::_ClearChildren()
|
||||
mChildren.clear();
|
||||
}
|
||||
|
||||
IPropertyNew::~IPropertyNew()
|
||||
IProperty::~IProperty()
|
||||
{
|
||||
// Remove from archetype
|
||||
if( mpArchetype != nullptr )
|
||||
@@ -48,17 +48,17 @@ IPropertyNew::~IPropertyNew()
|
||||
_ClearChildren();
|
||||
}
|
||||
|
||||
const char* IPropertyNew::HashableTypeName() const
|
||||
const char* IProperty::HashableTypeName() const
|
||||
{
|
||||
return PropEnumToHashableTypeName( Type() );
|
||||
}
|
||||
|
||||
void* IPropertyNew::GetChildDataPointer(void* pPropertyData) const
|
||||
void* IProperty::GetChildDataPointer(void* pPropertyData) const
|
||||
{
|
||||
return pPropertyData;
|
||||
}
|
||||
|
||||
void IPropertyNew::Serialize(IArchive& rArc)
|
||||
void IProperty::Serialize(IArchive& rArc)
|
||||
{
|
||||
// Always serialize ID first! ID is always required (except for root properties, which have an ID of 0xFFFFFFFF)
|
||||
// because they are needed to look up the correct property to apply parameter overrides to.
|
||||
@@ -72,8 +72,8 @@ void IPropertyNew::Serialize(IArchive& rArc)
|
||||
|
||||
if (rArc.IsReader() && !ArchetypeName.IsEmpty())
|
||||
{
|
||||
CMasterTemplate* pMaster = CMasterTemplate::MasterForGame( Game() );
|
||||
IPropertyNew* pArchetype = pMaster->FindPropertyArchetype(ArchetypeName);
|
||||
CGameTemplate* pGame = CGameTemplate::GetGameTemplate( Game() );
|
||||
IProperty* pArchetype = pGame->FindPropertyArchetype(ArchetypeName);
|
||||
|
||||
// The archetype must exist, or else the template file is malformed.
|
||||
ASSERT(pArchetype != nullptr);
|
||||
@@ -95,7 +95,7 @@ void IPropertyNew::Serialize(IArchive& rArc)
|
||||
}
|
||||
|
||||
rArc << SerialParameter("Description", mDescription, SH_Optional, mpArchetype ? mpArchetype->mDescription : "")
|
||||
<< SerialParameter("CookPreference", mCookPreference, SH_Optional, mpArchetype ? mpArchetype->mCookPreference : ECookPreferenceNew::Default)
|
||||
<< SerialParameter("CookPreference", mCookPreference, SH_Optional, mpArchetype ? mpArchetype->mCookPreference : ECookPreference::Default)
|
||||
<< SerialParameter("MinVersion", mMinVersion, SH_Optional, mpArchetype ? mpArchetype->mMinVersion : 0.f)
|
||||
<< SerialParameter("MaxVersion", mMaxVersion, SH_Optional, mpArchetype ? mpArchetype->mMaxVersion : FLT_MAX)
|
||||
<< SerialParameter("Suffix", mSuffix, SH_Optional, mpArchetype ? mpArchetype->mSuffix : "");
|
||||
@@ -103,7 +103,7 @@ void IPropertyNew::Serialize(IArchive& rArc)
|
||||
// Children don't get serialized for most property types
|
||||
}
|
||||
|
||||
void IPropertyNew::InitFromArchetype(IPropertyNew* pOther)
|
||||
void IProperty::InitFromArchetype(IProperty* pOther)
|
||||
{
|
||||
//@todo maybe somehow use Serialize for this instead?
|
||||
mpArchetype = pOther;
|
||||
@@ -122,7 +122,7 @@ void IPropertyNew::InitFromArchetype(IPropertyNew* pOther)
|
||||
}
|
||||
}
|
||||
|
||||
bool IPropertyNew::ShouldSerialize() const
|
||||
bool IProperty::ShouldSerialize() const
|
||||
{
|
||||
return mpArchetype == nullptr ||
|
||||
mName != mpArchetype->mName ||
|
||||
@@ -133,7 +133,7 @@ bool IPropertyNew::ShouldSerialize() const
|
||||
mMaxVersion != mpArchetype->mMaxVersion;
|
||||
}
|
||||
|
||||
TString IPropertyNew::GetTemplateFileName()
|
||||
TString IProperty::GetTemplateFileName()
|
||||
{
|
||||
if (mpScriptTemplate)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ TString IPropertyNew::GetTemplateFileName()
|
||||
}
|
||||
else if (IsArchetype())
|
||||
{
|
||||
IPropertyNew* pRootParent = RootParent();
|
||||
IProperty* pRootParent = RootParent();
|
||||
ASSERT(pRootParent != this);
|
||||
return pRootParent->GetTemplateFileName();
|
||||
}
|
||||
@@ -151,7 +151,7 @@ TString IPropertyNew::GetTemplateFileName()
|
||||
}
|
||||
}
|
||||
|
||||
void IPropertyNew::Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTemplate, u32 InOffset)
|
||||
void IProperty::Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, u32 InOffset)
|
||||
{
|
||||
// Make sure we only get initialized once.
|
||||
ASSERT( (mFlags & EPropertyFlag::IsInitialized) == 0 );
|
||||
@@ -164,7 +164,7 @@ void IPropertyNew::Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTempl
|
||||
// Look up property name if needed.
|
||||
if (Game() >= eEchoesDemo && !IsRootParent() && !IsIntrinsic() && !mpParent->IsAtomic() && !IsArrayArchetype())
|
||||
{
|
||||
mName = CMasterTemplate::PropertyName(mID);
|
||||
mName = CGameTemplate::PropertyName(mID);
|
||||
}
|
||||
|
||||
// Set any fields dependent on the parent...
|
||||
@@ -190,7 +190,7 @@ void IPropertyNew::Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTempl
|
||||
|
||||
for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
IPropertyNew* pChild = mChildren[ChildIdx];
|
||||
IProperty* pChild = mChildren[ChildIdx];
|
||||
|
||||
// update offset and round up to the child's alignment
|
||||
if (ChildIdx > 0)
|
||||
@@ -207,7 +207,7 @@ void IPropertyNew::Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTempl
|
||||
}
|
||||
}
|
||||
|
||||
void* IPropertyNew::RawValuePtr(void* pData) const
|
||||
void* IProperty::RawValuePtr(void* pData) const
|
||||
{
|
||||
// For array archetypes, the caller needs to provide the pointer to the correct array item
|
||||
// Array archetypes can't store their index in the array so it's impossible to determine the correct pointer.
|
||||
@@ -216,7 +216,7 @@ void* IPropertyNew::RawValuePtr(void* pData) const
|
||||
return pValuePtr;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::ChildByID(u32 ID) const
|
||||
IProperty* IProperty::ChildByID(u32 ID) const
|
||||
{
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
@@ -227,7 +227,7 @@ IPropertyNew* IPropertyNew::ChildByID(u32 ID) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::ChildByIDString(const TIDString& rkIdString)
|
||||
IProperty* IProperty::ChildByIDString(const TIDString& rkIdString)
|
||||
{
|
||||
// String must contain at least one ID!
|
||||
// some ID strings are formatted with 8 characters and some with 2 (plus the beginning "0x")
|
||||
@@ -246,7 +246,7 @@ IPropertyNew* IPropertyNew::ChildByIDString(const TIDString& rkIdString)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IPropertyNew* pNextChild = ChildByID(NextChildID);
|
||||
IProperty* pNextChild = ChildByID(NextChildID);
|
||||
|
||||
// Check if we need to recurse
|
||||
if (IDEndPos != -1)
|
||||
@@ -259,14 +259,14 @@ IPropertyNew* IPropertyNew::ChildByIDString(const TIDString& rkIdString)
|
||||
}
|
||||
}
|
||||
|
||||
bool IPropertyNew::ShouldCook(void*pPropertyData) const
|
||||
bool IProperty::ShouldCook(void*pPropertyData) const
|
||||
{
|
||||
switch (mCookPreference)
|
||||
{
|
||||
case ECookPreferenceNew::Always:
|
||||
case ECookPreference::Always:
|
||||
return true;
|
||||
|
||||
case ECookPreferenceNew::Never:
|
||||
case ECookPreference::Never:
|
||||
return false;
|
||||
|
||||
default:
|
||||
@@ -274,28 +274,28 @@ bool IPropertyNew::ShouldCook(void*pPropertyData) const
|
||||
}
|
||||
}
|
||||
|
||||
void IPropertyNew::SetName(const TString& rkNewName)
|
||||
void IProperty::SetName(const TString& rkNewName)
|
||||
{
|
||||
mName = rkNewName;
|
||||
mFlags.ClearFlag(EPropertyFlag::HasCachedNameCheck);
|
||||
}
|
||||
|
||||
void IPropertyNew::SetDescription(const TString& rkNewDescription)
|
||||
void IProperty::SetDescription(const TString& rkNewDescription)
|
||||
{
|
||||
mDescription = rkNewDescription;
|
||||
}
|
||||
|
||||
void IPropertyNew::SetSuffix(const TString& rkNewSuffix)
|
||||
void IProperty::SetSuffix(const TString& rkNewSuffix)
|
||||
{
|
||||
mSuffix = rkNewSuffix;
|
||||
}
|
||||
|
||||
void IPropertyNew::SetPropertyFlags(FPropertyFlags FlagsToSet)
|
||||
void IProperty::SetPropertyFlags(FPropertyFlags FlagsToSet)
|
||||
{
|
||||
mFlags |= FlagsToSet;
|
||||
}
|
||||
|
||||
bool IPropertyNew::HasAccurateName()
|
||||
bool IProperty::HasAccurateName()
|
||||
{
|
||||
// Exceptions for the three hardcoded 4CC property IDs
|
||||
if (mID == FOURCC('XFRM') || mID == FOURCC('INAM') || mID == FOURCC('ACTV'))
|
||||
@@ -330,39 +330,39 @@ bool IPropertyNew::HasAccurateName()
|
||||
}
|
||||
|
||||
/** IPropertyNew Accessors */
|
||||
EGame IPropertyNew::Game() const
|
||||
EGame IProperty::Game() const
|
||||
{
|
||||
return mGame;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::Create(EPropertyTypeNew Type,
|
||||
IProperty* IProperty::Create(EPropertyType Type,
|
||||
EGame Game)
|
||||
{
|
||||
IPropertyNew* pOut = nullptr;
|
||||
IProperty* pOut = nullptr;
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case EPropertyTypeNew::Bool: pOut = new CBoolProperty(Game); break;
|
||||
case EPropertyTypeNew::Byte: pOut = new CByteProperty(Game); break;
|
||||
case EPropertyTypeNew::Short: pOut = new CShortProperty(Game); break;
|
||||
case EPropertyTypeNew::Int: pOut = new CIntProperty(Game); break;
|
||||
case EPropertyTypeNew::Float: pOut = new CFloatProperty(Game); break;
|
||||
case EPropertyTypeNew::Choice: pOut = new CChoiceProperty(Game); break;
|
||||
case EPropertyTypeNew::Enum: pOut = new CEnumProperty(Game); break;
|
||||
case EPropertyTypeNew::Flags: pOut = new CFlagsProperty(Game); break;
|
||||
case EPropertyTypeNew::String: pOut = new CStringProperty(Game); break;
|
||||
case EPropertyTypeNew::Vector: pOut = new CVectorProperty(Game); break;
|
||||
case EPropertyTypeNew::Color: pOut = new CColorProperty(Game); break;
|
||||
case EPropertyTypeNew::Asset: pOut = new CAssetProperty(Game); break;
|
||||
case EPropertyTypeNew::Sound: pOut = new CSoundProperty(Game); break;
|
||||
case EPropertyTypeNew::Animation: pOut = new CAnimationProperty(Game); break;
|
||||
case EPropertyTypeNew::AnimationSet: pOut = new CAnimationSetProperty(Game); break;
|
||||
case EPropertyTypeNew::Sequence: pOut = new CSequenceProperty(Game); break;
|
||||
case EPropertyTypeNew::Spline: pOut = new CSplineProperty(Game); break;
|
||||
case EPropertyTypeNew::Guid: pOut = new CGuidProperty(Game); break;
|
||||
case EPropertyTypeNew::Pointer: pOut = new CPointerProperty(Game); break;
|
||||
case EPropertyTypeNew::Struct: pOut = new CStructPropertyNew(Game); break;
|
||||
case EPropertyTypeNew::Array: pOut = new CArrayProperty(Game); break;
|
||||
case EPropertyType::Bool: pOut = new CBoolProperty(Game); break;
|
||||
case EPropertyType::Byte: pOut = new CByteProperty(Game); break;
|
||||
case EPropertyType::Short: pOut = new CShortProperty(Game); break;
|
||||
case EPropertyType::Int: pOut = new CIntProperty(Game); break;
|
||||
case EPropertyType::Float: pOut = new CFloatProperty(Game); break;
|
||||
case EPropertyType::Choice: pOut = new CChoiceProperty(Game); break;
|
||||
case EPropertyType::Enum: pOut = new CEnumProperty(Game); break;
|
||||
case EPropertyType::Flags: pOut = new CFlagsProperty(Game); break;
|
||||
case EPropertyType::String: pOut = new CStringProperty(Game); break;
|
||||
case EPropertyType::Vector: pOut = new CVectorProperty(Game); break;
|
||||
case EPropertyType::Color: pOut = new CColorProperty(Game); break;
|
||||
case EPropertyType::Asset: pOut = new CAssetProperty(Game); break;
|
||||
case EPropertyType::Sound: pOut = new CSoundProperty(Game); break;
|
||||
case EPropertyType::Animation: pOut = new CAnimationProperty(Game); break;
|
||||
case EPropertyType::AnimationSet: pOut = new CAnimationSetProperty(Game); break;
|
||||
case EPropertyType::Sequence: pOut = new CSequenceProperty(Game); break;
|
||||
case EPropertyType::Spline: pOut = new CSplineProperty(Game); break;
|
||||
case EPropertyType::Guid: pOut = new CGuidProperty(Game); break;
|
||||
case EPropertyType::Pointer: pOut = new CPointerProperty(Game); break;
|
||||
case EPropertyType::Struct: pOut = new CStructProperty(Game); break;
|
||||
case EPropertyType::Array: pOut = new CArrayProperty(Game); break;
|
||||
}
|
||||
|
||||
// If this assertion fails, then there is an unhandled type!
|
||||
@@ -370,28 +370,28 @@ IPropertyNew* IPropertyNew::Create(EPropertyTypeNew Type,
|
||||
return pOut;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::CreateCopy(IPropertyNew* pArchetype)
|
||||
IProperty* IProperty::CreateCopy(IProperty* pArchetype)
|
||||
{
|
||||
IPropertyNew* pOut = Create(pArchetype->Type(), pArchetype->mGame);
|
||||
IProperty* pOut = Create(pArchetype->Type(), pArchetype->mGame);
|
||||
pOut->InitFromArchetype(pArchetype);
|
||||
pArchetype->mSubInstances.push_back(pOut);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type,
|
||||
IProperty* IProperty::CreateIntrinsic(EPropertyType Type,
|
||||
EGame Game,
|
||||
u32 Offset,
|
||||
const TString& rkName)
|
||||
{
|
||||
IPropertyNew* pOut = Create(Type, Game);
|
||||
IProperty* pOut = Create(Type, Game);
|
||||
pOut->mFlags |= EPropertyFlag::IsIntrinsic;
|
||||
pOut->SetName(rkName);
|
||||
pOut->Initialize(nullptr, nullptr, Offset);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type,
|
||||
IPropertyNew* pParent,
|
||||
IProperty* IProperty::CreateIntrinsic(EPropertyType Type,
|
||||
IProperty* pParent,
|
||||
u32 Offset,
|
||||
const TString& rkName)
|
||||
{
|
||||
@@ -399,7 +399,7 @@ IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type,
|
||||
// If you are creating a root property, call the other overload takes an EGame instead of a parent.
|
||||
ASSERT(pParent != nullptr);
|
||||
|
||||
IPropertyNew* pOut = Create(Type, pParent->mGame);
|
||||
IProperty* pOut = Create(Type, pParent->mGame);
|
||||
pOut->mFlags |= EPropertyFlag::IsIntrinsic;
|
||||
pOut->SetName(rkName);
|
||||
pOut->Initialize(pParent, nullptr, Offset);
|
||||
@@ -407,7 +407,7 @@ IPropertyNew* IPropertyNew::CreateIntrinsic(EPropertyTypeNew Type,
|
||||
return pOut;
|
||||
}
|
||||
|
||||
IPropertyNew* IPropertyNew::ArchiveConstructor(EPropertyTypeNew Type,
|
||||
IProperty* IProperty::ArchiveConstructor(EPropertyType Type,
|
||||
const IArchive& Arc)
|
||||
{
|
||||
return Create(Type, Arc.Game());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef IPROPERTYNEW_H
|
||||
#define IPROPERTYNEW_H
|
||||
#ifndef IPROPERTY_H
|
||||
#define IPROPERTY_H
|
||||
|
||||
#include "Core/Resource/Animation/CAnimationParameters.h"
|
||||
#include <Common/Common.h>
|
||||
@@ -9,9 +9,9 @@
|
||||
#include <memory>
|
||||
|
||||
/** Forward declares */
|
||||
class CMasterTemplate;
|
||||
class CGameTemplate;
|
||||
class CScriptTemplate;
|
||||
class CStructPropertyNew;
|
||||
class CStructProperty;
|
||||
|
||||
/** Typedefs */
|
||||
typedef TString TIDString;
|
||||
@@ -42,7 +42,7 @@ enum class EPropertyFlag : u32
|
||||
DECLARE_FLAGS_ENUMCLASS(EPropertyFlag, FPropertyFlags)
|
||||
|
||||
/** Property type */
|
||||
enum class EPropertyTypeNew
|
||||
enum class EPropertyType
|
||||
{
|
||||
Bool = FOURCC('BOOL'),
|
||||
Byte = FOURCC('BYTE'),
|
||||
@@ -68,38 +68,38 @@ enum class EPropertyTypeNew
|
||||
Invalid = FOURCC('INVD')
|
||||
};
|
||||
|
||||
inline const char* PropEnumToHashableTypeName(EPropertyTypeNew Type)
|
||||
inline const char* PropEnumToHashableTypeName(EPropertyType Type)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
// these names are required to generate accurate property ID hashes
|
||||
case EPropertyTypeNew::Bool: return "bool";
|
||||
case EPropertyTypeNew::Int: return "int";
|
||||
case EPropertyTypeNew::Float: return "float";
|
||||
case EPropertyTypeNew::Choice: return "choice";
|
||||
case EPropertyTypeNew::Enum: return "enum";
|
||||
case EPropertyTypeNew::Flags: return "Flags";
|
||||
case EPropertyTypeNew::String: return "string";
|
||||
case EPropertyTypeNew::Vector: return "Vector";
|
||||
case EPropertyTypeNew::Color: return "Color";
|
||||
case EPropertyTypeNew::Asset: return "asset";
|
||||
case EPropertyTypeNew::Sound: return "sound";
|
||||
case EPropertyTypeNew::Spline: return "spline";
|
||||
case EPropertyTypeNew::Guid: return "guid";
|
||||
case EPropertyType::Bool: return "bool";
|
||||
case EPropertyType::Int: return "int";
|
||||
case EPropertyType::Float: return "float";
|
||||
case EPropertyType::Choice: return "choice";
|
||||
case EPropertyType::Enum: return "enum";
|
||||
case EPropertyType::Flags: return "Flags";
|
||||
case EPropertyType::String: return "string";
|
||||
case EPropertyType::Vector: return "Vector";
|
||||
case EPropertyType::Color: return "Color";
|
||||
case EPropertyType::Asset: return "asset";
|
||||
case EPropertyType::Sound: return "sound";
|
||||
case EPropertyType::Spline: return "spline";
|
||||
case EPropertyType::Guid: return "guid";
|
||||
// unknown hashable types - used in hashes but these names are inaccurate
|
||||
case EPropertyTypeNew::Animation: return "animation";
|
||||
case EPropertyTypeNew::Sequence: return "sequence";
|
||||
case EPropertyType::Animation: return "animation";
|
||||
case EPropertyType::Sequence: return "sequence";
|
||||
// non hashable types - not used in ID hashes but still displayed on the UI
|
||||
case EPropertyTypeNew::Byte: return "byte";
|
||||
case EPropertyTypeNew::Short: return "short";
|
||||
case EPropertyTypeNew::Array: return "array";
|
||||
case EPropertyType::Byte: return "byte";
|
||||
case EPropertyType::Short: return "short";
|
||||
case EPropertyType::Array: return "array";
|
||||
// fallback
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
/** Enum that describes when/how properties should be cooked out */
|
||||
enum class ECookPreferenceNew
|
||||
enum class ECookPreference
|
||||
{
|
||||
Default,
|
||||
Always,
|
||||
@@ -107,7 +107,7 @@ enum class ECookPreferenceNew
|
||||
};
|
||||
|
||||
/** New property class */
|
||||
class IPropertyNew
|
||||
class IProperty
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CPropertyFactory;
|
||||
@@ -117,21 +117,21 @@ protected:
|
||||
FPropertyFlags mFlags;
|
||||
|
||||
/** Parent property */
|
||||
IPropertyNew* mpParent;
|
||||
IProperty* mpParent;
|
||||
|
||||
/** Pointer parent; if non-null, this parent needs to be dereferenced to access the correct
|
||||
* memory region that our property data is stored in */
|
||||
IPropertyNew* mpPointerParent;
|
||||
IProperty* mpPointerParent;
|
||||
|
||||
/** Archetype property; source property that we copied metadata from */
|
||||
IPropertyNew* mpArchetype;
|
||||
IProperty* mpArchetype;
|
||||
|
||||
/** Sub-instances of archetype properties. For non-archetypes, will be empty.
|
||||
* @todo this really oughta be a linked list */
|
||||
std::vector<IPropertyNew*> mSubInstances;
|
||||
std::vector<IProperty*> mSubInstances;
|
||||
|
||||
/** Child properties; these appear underneath this property on the UI */
|
||||
std::vector<IPropertyNew*> mChildren;
|
||||
std::vector<IProperty*> mChildren;
|
||||
|
||||
/** Game this property belongs to */
|
||||
EGame mGame;
|
||||
@@ -149,7 +149,7 @@ protected:
|
||||
TString mName;
|
||||
TString mDescription;
|
||||
TString mSuffix;
|
||||
ECookPreferenceNew mCookPreference;
|
||||
ECookPreference mCookPreference;
|
||||
|
||||
/** Min/max allowed version number. These numbers correspond to the game's internal build number.
|
||||
* This is not used yet but in the future it can be used to configure certain properties to only
|
||||
@@ -159,14 +159,14 @@ protected:
|
||||
float mMaxVersion;
|
||||
|
||||
/** Private constructor - use static methods to instantiate */
|
||||
IPropertyNew(EGame Game);
|
||||
IProperty(EGame Game);
|
||||
void _ClearChildren();
|
||||
|
||||
public:
|
||||
virtual ~IPropertyNew();
|
||||
virtual ~IProperty();
|
||||
|
||||
/** Interface */
|
||||
virtual EPropertyTypeNew Type() const = 0;
|
||||
virtual EPropertyType Type() const = 0;
|
||||
virtual u32 DataSize() const = 0;
|
||||
virtual u32 DataAlignment() const = 0;
|
||||
virtual void Construct(void* pData) const = 0;
|
||||
@@ -183,15 +183,15 @@ public:
|
||||
virtual const char* HashableTypeName() const;
|
||||
virtual void* GetChildDataPointer(void* pPropertyData) const;
|
||||
virtual void Serialize(IArchive& rArc);
|
||||
virtual void InitFromArchetype(IPropertyNew* pOther);
|
||||
virtual void InitFromArchetype(IProperty* pOther);
|
||||
virtual bool ShouldSerialize() const;
|
||||
virtual TString GetTemplateFileName();
|
||||
|
||||
/** Utility methods */
|
||||
void Initialize(IPropertyNew* pInParent, CScriptTemplate* pInTemplate, u32 InOffset);
|
||||
void Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, u32 InOffset);
|
||||
void* RawValuePtr(void* pData) const;
|
||||
IPropertyNew* ChildByID(u32 ID) const;
|
||||
IPropertyNew* ChildByIDString(const TIDString& rkIdString);
|
||||
IProperty* ChildByID(u32 ID) const;
|
||||
IProperty* ChildByIDString(const TIDString& rkIdString);
|
||||
bool ShouldCook(void* pPropertyData) const;
|
||||
void SetName(const TString& rkNewName);
|
||||
void SetDescription(const TString& rkNewDescription);
|
||||
@@ -201,12 +201,12 @@ public:
|
||||
|
||||
/** Accessors */
|
||||
EGame Game() const;
|
||||
inline ECookPreferenceNew CookPreference() const;
|
||||
inline ECookPreference CookPreference() const;
|
||||
inline u32 NumChildren() const;
|
||||
inline IPropertyNew* ChildByIndex(u32 ChildIndex) const;
|
||||
inline IPropertyNew* Parent() const;
|
||||
inline IPropertyNew* RootParent();
|
||||
inline IPropertyNew* Archetype() const;
|
||||
inline IProperty* ChildByIndex(u32 ChildIndex) const;
|
||||
inline IProperty* Parent() const;
|
||||
inline IProperty* RootParent();
|
||||
inline IProperty* Archetype() const;
|
||||
inline CScriptTemplate* ScriptTemplate() const;
|
||||
inline TString Name() const;
|
||||
inline TString Description() const;
|
||||
@@ -222,50 +222,50 @@ public:
|
||||
inline bool IsRootParent() const { return mpParent == nullptr; }
|
||||
|
||||
/** Create */
|
||||
static IPropertyNew* Create(EPropertyTypeNew Type,
|
||||
static IProperty* Create(EPropertyType Type,
|
||||
EGame Game);
|
||||
|
||||
static IPropertyNew* CreateCopy(IPropertyNew* pArchetype);
|
||||
static IProperty* CreateCopy(IProperty* pArchetype);
|
||||
|
||||
static IPropertyNew* CreateIntrinsic(EPropertyTypeNew Type,
|
||||
static IProperty* CreateIntrinsic(EPropertyType Type,
|
||||
EGame Game,
|
||||
u32 Offset,
|
||||
const TString& rkName);
|
||||
|
||||
static IPropertyNew* CreateIntrinsic(EPropertyTypeNew Type,
|
||||
IPropertyNew* pParent,
|
||||
static IProperty* CreateIntrinsic(EPropertyType Type,
|
||||
IProperty* pParent,
|
||||
u32 Offset,
|
||||
const TString& rkName);
|
||||
|
||||
static IPropertyNew* ArchiveConstructor(EPropertyTypeNew Type,
|
||||
static IProperty* ArchiveConstructor(EPropertyType Type,
|
||||
const IArchive& Arc);
|
||||
};
|
||||
|
||||
inline ECookPreferenceNew IPropertyNew::CookPreference() const
|
||||
inline ECookPreference IProperty::CookPreference() const
|
||||
{
|
||||
return mCookPreference;
|
||||
}
|
||||
|
||||
inline u32 IPropertyNew::NumChildren() const
|
||||
inline u32 IProperty::NumChildren() const
|
||||
{
|
||||
return mChildren.size();
|
||||
}
|
||||
|
||||
inline IPropertyNew* IPropertyNew::ChildByIndex(u32 ChildIndex) const
|
||||
inline IProperty* IProperty::ChildByIndex(u32 ChildIndex) const
|
||||
{
|
||||
ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size());
|
||||
return mChildren[ChildIndex];
|
||||
}
|
||||
|
||||
inline IPropertyNew* IPropertyNew::Parent() const
|
||||
inline IProperty* IProperty::Parent() const
|
||||
{
|
||||
return mpParent;
|
||||
}
|
||||
|
||||
inline IPropertyNew* IPropertyNew::RootParent()
|
||||
inline IProperty* IProperty::RootParent()
|
||||
{
|
||||
IPropertyNew* pParent = Parent();
|
||||
IPropertyNew* pOut = this;
|
||||
IProperty* pParent = Parent();
|
||||
IProperty* pOut = this;
|
||||
|
||||
while (pParent)
|
||||
{
|
||||
@@ -276,32 +276,32 @@ inline IPropertyNew* IPropertyNew::RootParent()
|
||||
return pOut;
|
||||
}
|
||||
|
||||
inline IPropertyNew* IPropertyNew::Archetype() const
|
||||
inline IProperty* IProperty::Archetype() const
|
||||
{
|
||||
return mpArchetype;
|
||||
}
|
||||
|
||||
inline CScriptTemplate* IPropertyNew::ScriptTemplate() const
|
||||
inline CScriptTemplate* IProperty::ScriptTemplate() const
|
||||
{
|
||||
return mpScriptTemplate;
|
||||
}
|
||||
|
||||
inline TString IPropertyNew::Name() const
|
||||
inline TString IProperty::Name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
inline TString IPropertyNew::Description() const
|
||||
inline TString IProperty::Description() const
|
||||
{
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
inline TString IPropertyNew::Suffix() const
|
||||
inline TString IProperty::Suffix() const
|
||||
{
|
||||
return mSuffix;
|
||||
}
|
||||
|
||||
inline TString IPropertyNew::IDString(bool FullyQualified) const
|
||||
inline TString IProperty::IDString(bool FullyQualified) const
|
||||
{
|
||||
if (FullyQualified && mpParent != nullptr && mpParent->Parent() != nullptr)
|
||||
return mpParent->IDString(FullyQualified) + ":" + TString::HexString(mID);
|
||||
@@ -309,20 +309,20 @@ inline TString IPropertyNew::IDString(bool FullyQualified) const
|
||||
return TString::HexString(mID);
|
||||
}
|
||||
|
||||
inline u32 IPropertyNew::Offset() const
|
||||
inline u32 IProperty::Offset() const
|
||||
{
|
||||
return mOffset;
|
||||
}
|
||||
|
||||
inline u32 IPropertyNew::ID() const
|
||||
inline u32 IProperty::ID() const
|
||||
{
|
||||
return mID;
|
||||
}
|
||||
|
||||
template<typename PropType, EPropertyTypeNew PropEnum>
|
||||
class TTypedPropertyNew : public IPropertyNew
|
||||
template<typename PropType, EPropertyType PropEnum>
|
||||
class TTypedProperty : public IProperty
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
friend class CTemplateLoader;
|
||||
public:
|
||||
typedef PropType ValueType;
|
||||
@@ -330,14 +330,14 @@ public:
|
||||
protected:
|
||||
PropType mDefaultValue;
|
||||
|
||||
TTypedPropertyNew(EGame Game)
|
||||
: IPropertyNew(Game)
|
||||
TTypedProperty(EGame Game)
|
||||
: IProperty(Game)
|
||||
{
|
||||
memset(&mDefaultValue, 0, sizeof(PropType));
|
||||
}
|
||||
|
||||
public:
|
||||
virtual EPropertyTypeNew Type() const { return PropEnum; }
|
||||
virtual EPropertyType Type() const { return PropEnum; }
|
||||
virtual u32 DataSize() const { return sizeof(PropType); }
|
||||
virtual u32 DataAlignment() const { return alignof(PropType); }
|
||||
virtual void Construct(void* pData) const { new(ValuePtr(pData)) PropType(mDefaultValue); }
|
||||
@@ -347,10 +347,10 @@ public:
|
||||
|
||||
virtual bool CanHaveDefault() const { return true; }
|
||||
|
||||
virtual void InitFromArchetype(IPropertyNew* pOther)
|
||||
virtual void InitFromArchetype(IProperty* pOther)
|
||||
{
|
||||
IPropertyNew::InitFromArchetype(pOther);
|
||||
mDefaultValue = static_cast<TTypedPropertyNew*>(pOther)->mDefaultValue;
|
||||
IProperty::InitFromArchetype(pOther);
|
||||
mDefaultValue = static_cast<TTypedProperty*>(pOther)->mDefaultValue;
|
||||
}
|
||||
|
||||
inline PropType* ValuePtr(void* pData) const
|
||||
@@ -378,21 +378,21 @@ public:
|
||||
mDefaultValue = kInDefaultValue;
|
||||
}
|
||||
|
||||
inline static EPropertyTypeNew StaticType() { return PropEnum; }
|
||||
inline static EPropertyType StaticType() { return PropEnum; }
|
||||
};
|
||||
|
||||
template<typename PropType, EPropertyTypeNew PropEnum>
|
||||
class TSerializeableTypedProperty : public TTypedPropertyNew<PropType, PropEnum>
|
||||
template<typename PropType, EPropertyType PropEnum>
|
||||
class TSerializeableTypedProperty : public TTypedProperty<PropType, PropEnum>
|
||||
{
|
||||
protected:
|
||||
TSerializeableTypedProperty(EGame Game)
|
||||
: TTypedPropertyNew(Game)
|
||||
: TTypedProperty(Game)
|
||||
{}
|
||||
|
||||
public:
|
||||
virtual void Serialize(IArchive& rArc)
|
||||
{
|
||||
TTypedPropertyNew::Serialize(rArc);
|
||||
TTypedProperty::Serialize(rArc);
|
||||
TSerializeableTypedProperty* pArchetype = static_cast<TSerializeableTypedProperty*>(mpArchetype);
|
||||
|
||||
// Determine if default value should be serialized as optional.
|
||||
@@ -408,13 +408,13 @@ public:
|
||||
{
|
||||
switch (Type())
|
||||
{
|
||||
case EPropertyTypeNew::String:
|
||||
case EPropertyTypeNew::Asset:
|
||||
case EPropertyTypeNew::Animation:
|
||||
case EPropertyTypeNew::AnimationSet:
|
||||
case EPropertyTypeNew::Sequence:
|
||||
case EPropertyTypeNew::Spline:
|
||||
case EPropertyTypeNew::Guid:
|
||||
case EPropertyType::String:
|
||||
case EPropertyType::Asset:
|
||||
case EPropertyType::Animation:
|
||||
case EPropertyType::AnimationSet:
|
||||
case EPropertyType::Sequence:
|
||||
case EPropertyType::Spline:
|
||||
case EPropertyType::Guid:
|
||||
MakeOptional = true;
|
||||
break;
|
||||
}
|
||||
@@ -429,9 +429,9 @@ public:
|
||||
|
||||
virtual bool ShouldSerialize() const
|
||||
{
|
||||
TTypedPropertyNew* pArchetype = static_cast<TTypedPropertyNew*>(mpArchetype);
|
||||
TTypedProperty* pArchetype = static_cast<TTypedProperty*>(mpArchetype);
|
||||
|
||||
return TTypedPropertyNew::ShouldSerialize() ||
|
||||
return TTypedProperty::ShouldSerialize() ||
|
||||
!(mDefaultValue == pArchetype->DefaultValue());
|
||||
}
|
||||
|
||||
@@ -442,17 +442,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template<typename PropType, EPropertyTypeNew PropEnum>
|
||||
class TNumericalPropertyNew : public TSerializeableTypedProperty<PropType, PropEnum>
|
||||
template<typename PropType, EPropertyType PropEnum>
|
||||
class TNumericalProperty : public TSerializeableTypedProperty<PropType, PropEnum>
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
friend class CTemplateLoader;
|
||||
|
||||
protected:
|
||||
PropType mMinValue;
|
||||
PropType mMaxValue;
|
||||
|
||||
TNumericalPropertyNew(EGame Game)
|
||||
TNumericalProperty(EGame Game)
|
||||
: TSerializeableTypedProperty(Game)
|
||||
, mMinValue( -1 )
|
||||
, mMaxValue( -1 )
|
||||
@@ -462,7 +462,7 @@ public:
|
||||
virtual void Serialize(IArchive& rArc)
|
||||
{
|
||||
TSerializeableTypedProperty::Serialize(rArc);
|
||||
TNumericalPropertyNew* pArchetype = static_cast<TNumericalPropertyNew*>(mpArchetype);
|
||||
TNumericalProperty* pArchetype = static_cast<TNumericalProperty*>(mpArchetype);
|
||||
|
||||
rArc << SerialParameter("Min", mMinValue, SH_Optional, pArchetype ? pArchetype->mMinValue : (PropType) -1)
|
||||
<< SerialParameter("Max", mMaxValue, SH_Optional, pArchetype ? pArchetype->mMaxValue : (PropType) -1);
|
||||
@@ -470,16 +470,16 @@ public:
|
||||
|
||||
virtual bool ShouldSerialize() const
|
||||
{
|
||||
TNumericalPropertyNew* pArchetype = static_cast<TNumericalPropertyNew*>(mpArchetype);
|
||||
TNumericalProperty* pArchetype = static_cast<TNumericalProperty*>(mpArchetype);
|
||||
return TSerializeableTypedProperty::ShouldSerialize() ||
|
||||
mMinValue != pArchetype->mMinValue ||
|
||||
mMaxValue != pArchetype->mMaxValue;
|
||||
}
|
||||
|
||||
virtual void InitFromArchetype(IPropertyNew* pOther)
|
||||
virtual void InitFromArchetype(IProperty* pOther)
|
||||
{
|
||||
TSerializeableTypedProperty::InitFromArchetype(pOther);
|
||||
TNumericalPropertyNew* pCastOther = static_cast<TNumericalPropertyNew*>(pOther);
|
||||
TNumericalProperty* pCastOther = static_cast<TNumericalProperty*>(pOther);
|
||||
mMinValue = pCastOther->mMinValue;
|
||||
mMaxValue = pCastOther->mMaxValue;
|
||||
}
|
||||
@@ -498,7 +498,7 @@ public:
|
||||
|
||||
/** Property casting with dynamic type checking */
|
||||
template<class PropertyClass>
|
||||
inline PropertyClass* TPropCast(IPropertyNew* pProperty)
|
||||
inline PropertyClass* TPropCast(IProperty* pProperty)
|
||||
{
|
||||
if (pProperty && pProperty->Type() == PropertyClass::StaticType())
|
||||
{
|
||||
@@ -510,4 +510,4 @@ inline PropertyClass* TPropCast(IPropertyNew* pProperty)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // IPROPERTYNEW_H
|
||||
#endif // IPROPERTY_H
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
: mpPropertyData(nullptr), mpProperty(nullptr)
|
||||
{}
|
||||
|
||||
explicit TPropertyRef(void* pInData, IPropertyNew* pInProperty)
|
||||
explicit TPropertyRef(void* pInData, IProperty* pInProperty)
|
||||
: mpPropertyData(pInData), mpProperty( TPropCast<PropertyClass>(pInProperty) )
|
||||
{
|
||||
}
|
||||
@@ -60,12 +60,12 @@ public:
|
||||
return Get();
|
||||
}
|
||||
|
||||
inline bool operator==(IPropertyNew* pProperty) const
|
||||
inline bool operator==(IProperty* pProperty) const
|
||||
{
|
||||
return mpProperty == pProperty;
|
||||
}
|
||||
|
||||
friend bool operator==(IPropertyNew* pLeft, const TPropertyRef& kRight)
|
||||
friend bool operator==(IProperty* pLeft, const TPropertyRef& kRight)
|
||||
{
|
||||
return pLeft == kRight.Property();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ typedef TPropertyRef<CSequenceProperty> CSequenceRef;
|
||||
typedef TPropertyRef<CSplineProperty> CSplineRef;
|
||||
typedef TPropertyRef<CGuidProperty> CGuidRef;
|
||||
typedef TPropertyRef<CPointerProperty> CPointerRef;
|
||||
typedef TPropertyRef<CStructPropertyNew> CStructRef;
|
||||
typedef TPropertyRef<CStructProperty> CStructRef;
|
||||
typedef TPropertyRef<CArrayProperty> CArrayRef;
|
||||
|
||||
/** Special version for enums */
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
: TPropertyRef()
|
||||
{}
|
||||
|
||||
TEnumRef(void* pInData, IPropertyNew* pInProperty)
|
||||
TEnumRef(void* pInData, IProperty* pInProperty)
|
||||
: TPropertyRef(pInData, pInProperty)
|
||||
{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user