Property cleanup
This commit is contained in:
parent
e68b961a8c
commit
31dac74a64
|
@ -14,7 +14,7 @@ CAreaAttributes::~CAreaAttributes()
|
|||
void CAreaAttributes::SetObject(CScriptObject *pObj)
|
||||
{
|
||||
CScriptTemplate* pTemplate = pObj->Template();
|
||||
CStructPropertyNew* pProperties = pTemplate->Properties();
|
||||
CStructProperty* pProperties = pTemplate->Properties();
|
||||
|
||||
mpObject = pObj;
|
||||
mGame = pTemplate->MasterTemplate()->Game();
|
||||
|
|
|
@ -91,7 +91,6 @@ HEADERS += \
|
|||
Resource/Cooker/CMaterialCooker.h \
|
||||
Resource/Cooker/CModelCooker.h \
|
||||
Resource/Cooker/CSectionMgrOut.h \
|
||||
Resource/Cooker/CTemplateWriter.h \
|
||||
Resource/Cooker/CTextureEncoder.h \
|
||||
Resource/Cooker/CWorldCooker.h \
|
||||
Resource/Factory/CAnimSetLoader.h \
|
||||
|
@ -115,7 +114,6 @@ HEADERS += \
|
|||
Resource/Script/CScriptLayer.h \
|
||||
Resource/Script/CScriptObject.h \
|
||||
Resource/Script/CScriptTemplate.h \
|
||||
Resource/Script/EPropertyType.h \
|
||||
Resource/Script/EVolumeShape.h \
|
||||
Resource/CCollisionMesh.h \
|
||||
Resource/CCollisionMeshGroup.h \
|
||||
|
@ -163,9 +161,6 @@ HEADERS += \
|
|||
OpenGL/GLCommon.h \
|
||||
ScriptExtra/CRadiusSphereExtra.h \
|
||||
Resource/Cooker/CAreaCooker.h \
|
||||
Resource/Script/IPropertyValue.h \
|
||||
Resource/Script/IPropertyTemplate.h \
|
||||
Resource/Script/IProperty.h \
|
||||
Resource/Model/EVertexAttribute.h \
|
||||
Render/FRenderOptions.h \
|
||||
Scene/FShowFlags.h \
|
||||
|
@ -231,9 +226,8 @@ HEADERS += \
|
|||
IUIRelay.h \
|
||||
Resource/CResTypeFilter.h \
|
||||
GameProject/COpeningBanner.h \
|
||||
Resource/Script/CPropertyNameGenerator.h \
|
||||
Resource/Script/IPropertyNew.h \
|
||||
Resource/Script/TPropertyProxy.h \
|
||||
Resource/Script/Property/CPropertyNameGenerator.h \
|
||||
Resource/Script/Property/IProperty.h \
|
||||
Resource/Script/Property/CEnumProperty.h \
|
||||
Resource/Script/Property/CFlagsProperty.h \
|
||||
Resource/Script/Property/CAssetProperty.h \
|
||||
|
@ -267,7 +261,6 @@ SOURCES += \
|
|||
Resource/Area/CGameArea.cpp \
|
||||
Resource/Cooker/CMaterialCooker.cpp \
|
||||
Resource/Cooker/CModelCooker.cpp \
|
||||
Resource/Cooker/CTemplateWriter.cpp \
|
||||
Resource/Cooker/CTextureEncoder.cpp \
|
||||
Resource/Cooker/CWorldCooker.cpp \
|
||||
Resource/Factory/CAnimSetLoader.cpp \
|
||||
|
@ -320,8 +313,6 @@ SOURCES += \
|
|||
OpenGL/GLCommon.cpp \
|
||||
ScriptExtra/CRadiusSphereExtra.cpp \
|
||||
Resource/Cooker/CAreaCooker.cpp \
|
||||
Resource/Script/IPropertyTemplate.cpp \
|
||||
Resource/Script/IProperty.cpp \
|
||||
Scene/FShowFlags.cpp \
|
||||
Scene/CScene.cpp \
|
||||
Scene/CSceneIterator.cpp \
|
||||
|
@ -365,8 +356,8 @@ SOURCES += \
|
|||
IUIRelay.cpp \
|
||||
GameProject\COpeningBanner.cpp \
|
||||
IProgressNotifier.cpp \
|
||||
Resource/Script/CPropertyNameGenerator.cpp \
|
||||
Resource/Script/IPropertyNew.cpp \
|
||||
Resource/Script/Property/CPropertyNameGenerator.cpp \
|
||||
Resource/Script/Property/IProperty.cpp \
|
||||
Resource/Script/Property/CStructProperty.cpp \
|
||||
Resource/Script/Property/CFlagsProperty.cpp
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||
for (u32 iInst = 0; iInst < pLayer->NumInstances(); iInst++)
|
||||
{
|
||||
CScriptObject* pInst = pLayer->InstanceByIndex(iInst);
|
||||
CStructPropertyNew* pProperties = pInst->Template()->Properties();
|
||||
CStructProperty* pProperties = pInst->Template()->Properties();
|
||||
|
||||
if (pInst->ObjectTypeID() == 0x42 || pInst->ObjectTypeID() == FOURCC('POIN'))
|
||||
{
|
||||
|
|
|
@ -152,22 +152,22 @@ CScriptInstanceDependency* CScriptInstanceDependency::BuildTree(CScriptObject *p
|
|||
return pInst;
|
||||
}
|
||||
|
||||
void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependency* pInst, CScriptObject* pInstance, CStructPropertyNew *pStruct)
|
||||
void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependency* pInst, CScriptObject* pInstance, CStructProperty *pStruct)
|
||||
{
|
||||
// Recursive function for parsing script dependencies and loading them into the script instance dependency
|
||||
void* pPropertyData = pInstance->PropertyData();
|
||||
|
||||
for (u32 PropertyIdx = 0; PropertyIdx < pStruct->NumChildren(); PropertyIdx++)
|
||||
{
|
||||
IPropertyNew *pProp = pStruct->ChildByIndex(PropertyIdx);
|
||||
EPropertyTypeNew Type = pProp->Type();
|
||||
IProperty *pProp = pStruct->ChildByIndex(PropertyIdx);
|
||||
EPropertyType Type = pProp->Type();
|
||||
|
||||
// Technically we aren't parsing array children, but it's not really worth refactoring this function
|
||||
// to support it when there aren't any array properties that contain any asset references anyway...
|
||||
if (Type == EPropertyTypeNew::Struct)
|
||||
ParseStructDependencies(pInst, pInstance, TPropCast<CStructPropertyNew>(pProp));
|
||||
if (Type == EPropertyType::Struct)
|
||||
ParseStructDependencies(pInst, pInstance, TPropCast<CStructProperty>(pProp));
|
||||
|
||||
else if (Type == EPropertyTypeNew::Sound)
|
||||
else if (Type == EPropertyType::Sound)
|
||||
{
|
||||
u32 SoundID = TPropCast<CSoundProperty>(pProp)->Value(pPropertyData);
|
||||
|
||||
|
@ -184,7 +184,7 @@ void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependenc
|
|||
}
|
||||
}
|
||||
|
||||
else if (Type == EPropertyTypeNew::Asset)
|
||||
else if (Type == EPropertyType::Asset)
|
||||
{
|
||||
CAssetID ID = TPropCast<CAssetProperty>(pProp)->Value(pPropertyData);
|
||||
|
||||
|
@ -195,7 +195,7 @@ void CScriptInstanceDependency::ParseStructDependencies(CScriptInstanceDependenc
|
|||
}
|
||||
}
|
||||
|
||||
else if (Type == EPropertyTypeNew::AnimationSet)
|
||||
else if (Type == EPropertyType::AnimationSet)
|
||||
{
|
||||
CAnimationParameters Params = TPropCast<CAnimationSetProperty>(pProp)->Value(pPropertyData);
|
||||
CAssetID ID = Params.ID();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
class CScriptLayer;
|
||||
class CScriptObject;
|
||||
class CStructPropertyNew;
|
||||
class CStructProperty;
|
||||
class CAnimSet;
|
||||
class CAnimationParameters;
|
||||
struct SSetCharacter;
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
// Static
|
||||
static CScriptInstanceDependency* BuildTree(CScriptObject *pInstance);
|
||||
protected:
|
||||
static void ParseStructDependencies(CScriptInstanceDependency *pTree, CScriptObject* pInstance, CStructPropertyNew *pStruct);
|
||||
static void ParseStructDependencies(CScriptInstanceDependency *pTree, CScriptObject* pInstance, CStructProperty *pStruct);
|
||||
};
|
||||
|
||||
// Node representing an animset character. Indicates what index the character is within the animset.
|
||||
|
|
|
@ -128,20 +128,20 @@ void CLight::SetAngleAtten(float AngleCoefA, float AngleCoefB, float AngleCoefC)
|
|||
mAngleAttenCoefficients.Z = AngleCoefC;
|
||||
}
|
||||
|
||||
CStructPropertyNew* CLight::GetProperties() const
|
||||
CStructProperty* CLight::GetProperties() const
|
||||
{
|
||||
//@todo MP1 properties only
|
||||
//@todo we cannot display full properties because a lot of them are discarded on load
|
||||
static CStructPropertyNew* pProperties = nullptr;
|
||||
static CStructProperty* pProperties = nullptr;
|
||||
|
||||
if (!pProperties)
|
||||
{
|
||||
pProperties = (CStructPropertyNew*) IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Struct,
|
||||
pProperties = (CStructProperty*) IProperty::CreateIntrinsic(EPropertyType::Struct,
|
||||
ePrime,
|
||||
0,
|
||||
"Light");
|
||||
|
||||
CChoiceProperty* pLightType = (CChoiceProperty*) IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Choice,
|
||||
CChoiceProperty* pLightType = (CChoiceProperty*) IProperty::CreateIntrinsic(EPropertyType::Choice,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mType),
|
||||
"LightType");
|
||||
|
@ -150,22 +150,22 @@ CStructPropertyNew* CLight::GetProperties() const
|
|||
pLightType->AddValue("Spot", eSpot);
|
||||
pLightType->AddValue("Custom", eCustom);
|
||||
|
||||
IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Color,
|
||||
IProperty::CreateIntrinsic(EPropertyType::Color,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mColor),
|
||||
"Color");
|
||||
|
||||
IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Vector,
|
||||
IProperty::CreateIntrinsic(EPropertyType::Vector,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mPosition),
|
||||
"Position");
|
||||
|
||||
IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Vector,
|
||||
IProperty::CreateIntrinsic(EPropertyType::Vector,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mDirection),
|
||||
"Direction");
|
||||
|
||||
IPropertyNew::CreateIntrinsic(EPropertyTypeNew::Float,
|
||||
IProperty::CreateIntrinsic(EPropertyType::Float,
|
||||
pProperties,
|
||||
MEMBER_OFFSET(CLight, mSpotCutoff),
|
||||
"SpotCutoff");
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
void SetDistAtten(float DistCoefA, float DistCoefB, float DistCoefC);
|
||||
void SetAngleAtten(float AngleCoefA, float AngleCoefB, float AngleCoefC);
|
||||
|
||||
CStructPropertyNew* GetProperties() const;
|
||||
CStructProperty* GetProperties() const;
|
||||
|
||||
// Other
|
||||
void Load() const;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <Core/Resource/Script/Property/CEnumProperty.h>
|
||||
#include <Core/Resource/Script/Property/CFlagsProperty.h>
|
||||
|
||||
void CScriptCooker::WriteProperty(IOutputStream& rOut, IPropertyNew* pProperty, bool InAtomicStruct)
|
||||
void CScriptCooker::WriteProperty(IOutputStream& rOut, IProperty* pProperty, bool InAtomicStruct)
|
||||
{
|
||||
u32 SizeOffset = 0, PropStart = 0;
|
||||
void* pData = (mpArrayItemData ? mpArrayItemData : mpObject->PropertyData());
|
||||
|
@ -21,118 +21,118 @@ void CScriptCooker::WriteProperty(IOutputStream& rOut, IPropertyNew* pProperty,
|
|||
switch (pProperty->Type())
|
||||
{
|
||||
|
||||
case EPropertyTypeNew::Bool:
|
||||
case EPropertyType::Bool:
|
||||
{
|
||||
CBoolProperty* pBool = TPropCast<CBoolProperty>(pProperty);
|
||||
rOut.WriteBool( pBool->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Byte:
|
||||
case EPropertyType::Byte:
|
||||
{
|
||||
CByteProperty* pByte = TPropCast<CByteProperty>(pProperty);
|
||||
rOut.WriteByte( pByte->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Short:
|
||||
case EPropertyType::Short:
|
||||
{
|
||||
CShortProperty* pShort = TPropCast<CShortProperty>(pProperty);
|
||||
rOut.WriteShort( pShort->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Int:
|
||||
case EPropertyType::Int:
|
||||
{
|
||||
CIntProperty* pInt = TPropCast<CIntProperty>(pProperty);
|
||||
rOut.WriteLong( pInt->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Float:
|
||||
case EPropertyType::Float:
|
||||
{
|
||||
CFloatProperty* pFloat = TPropCast<CFloatProperty>(pProperty);
|
||||
rOut.WriteFloat( pFloat->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Choice:
|
||||
case EPropertyType::Choice:
|
||||
{
|
||||
CChoiceProperty* pChoice = TPropCast<CChoiceProperty>(pProperty);
|
||||
rOut.WriteLong( pChoice->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Enum:
|
||||
case EPropertyType::Enum:
|
||||
{
|
||||
CEnumProperty* pEnum = TPropCast<CEnumProperty>(pProperty);
|
||||
rOut.WriteLong( pEnum->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Flags:
|
||||
case EPropertyType::Flags:
|
||||
{
|
||||
CFlagsProperty* pFlags = TPropCast<CFlagsProperty>(pProperty);
|
||||
rOut.WriteLong( pFlags->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::String:
|
||||
case EPropertyType::String:
|
||||
{
|
||||
CStringProperty* pString = TPropCast<CStringProperty>(pProperty);
|
||||
rOut.WriteString( pString->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Vector:
|
||||
case EPropertyType::Vector:
|
||||
{
|
||||
CVectorProperty* pVector = TPropCast<CVectorProperty>(pProperty);
|
||||
pVector->ValueRef(pData).Write(rOut);
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Color:
|
||||
case EPropertyType::Color:
|
||||
{
|
||||
CColorProperty* pColor = TPropCast<CColorProperty>(pProperty);
|
||||
pColor->ValueRef(pData).Write(rOut);
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Asset:
|
||||
case EPropertyType::Asset:
|
||||
{
|
||||
CAssetProperty* pAsset = TPropCast<CAssetProperty>(pProperty);
|
||||
pAsset->ValueRef(pData).Write(rOut);
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Sound:
|
||||
case EPropertyType::Sound:
|
||||
{
|
||||
CSoundProperty* pSound = TPropCast<CSoundProperty>(pProperty);
|
||||
rOut.WriteLong( pSound->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Animation:
|
||||
case EPropertyType::Animation:
|
||||
{
|
||||
CAnimationProperty* pAnim = TPropCast<CAnimationProperty>(pProperty);
|
||||
rOut.WriteLong( pAnim->Value(pData) );
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::AnimationSet:
|
||||
case EPropertyType::AnimationSet:
|
||||
{
|
||||
CAnimationSetProperty* pAnimSet = TPropCast<CAnimationSetProperty>(pProperty);
|
||||
pAnimSet->ValueRef(pData).Write(rOut);
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Sequence:
|
||||
case EPropertyType::Sequence:
|
||||
{
|
||||
// TODO
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Spline:
|
||||
case EPropertyType::Spline:
|
||||
{
|
||||
CSplineProperty* pSpline = TPropCast<CSplineProperty>(pProperty);
|
||||
std::vector<char>& rBuffer = pSpline->ValueRef(pData);
|
||||
|
@ -163,7 +163,7 @@ void CScriptCooker::WriteProperty(IOutputStream& rOut, IPropertyNew* pProperty,
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Guid:
|
||||
case EPropertyType::Guid:
|
||||
{
|
||||
CGuidProperty* pGuid = TPropCast<CGuidProperty>(pProperty);
|
||||
std::vector<char>& rBuffer = pGuid->ValueRef(pData);
|
||||
|
@ -175,14 +175,14 @@ void CScriptCooker::WriteProperty(IOutputStream& rOut, IPropertyNew* pProperty,
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Struct:
|
||||
case EPropertyType::Struct:
|
||||
{
|
||||
CStructPropertyNew* pStruct = TPropCast<CStructPropertyNew>(pProperty);
|
||||
std::vector<IPropertyNew*> PropertiesToWrite;
|
||||
CStructProperty* pStruct = TPropCast<CStructProperty>(pProperty);
|
||||
std::vector<IProperty*> PropertiesToWrite;
|
||||
|
||||
for (u32 ChildIdx = 0; ChildIdx < pStruct->NumChildren(); ChildIdx++)
|
||||
{
|
||||
IPropertyNew *pChild = pStruct->ChildByIndex(ChildIdx);
|
||||
IProperty *pChild = pStruct->ChildByIndex(ChildIdx);
|
||||
|
||||
if (pStruct->IsAtomic() || pChild->ShouldCook(pData))
|
||||
PropertiesToWrite.push_back(pChild);
|
||||
|
@ -202,7 +202,7 @@ void CScriptCooker::WriteProperty(IOutputStream& rOut, IPropertyNew* pProperty,
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Array:
|
||||
case EPropertyType::Array:
|
||||
{
|
||||
CArrayProperty* pArray = TPropCast<CArrayProperty>(pProperty);
|
||||
u32 Count = pArray->ArrayCount(pData);
|
||||
|
|
|
@ -15,7 +15,7 @@ class CScriptCooker
|
|||
std::vector<CScriptObject*> mGeneratedObjects;
|
||||
bool mWriteGeneratedSeparately;
|
||||
|
||||
void WriteProperty(IOutputStream& rOut, IPropertyNew* pProperty, bool InAtomicStruct);
|
||||
void WriteProperty(IOutputStream& rOut, IProperty* pProperty, bool InAtomicStruct);
|
||||
|
||||
public:
|
||||
CScriptCooker(EGame Game, bool WriteGeneratedObjectsSeparately = true)
|
||||
|
|
|
@ -1,844 +0,0 @@
|
|||
#include "CTemplateWriter.h"
|
||||
#include "CAreaCooker.h"
|
||||
#include <Common/FileUtil.h>
|
||||
#include <Core/Resource/Script/IPropertyTemplate.h>
|
||||
|
||||
#include <tinyxml2.h>
|
||||
|
||||
#if 0
|
||||
using namespace tinyxml2;
|
||||
TString CTemplateWriter::smTemplatesDir = "../templates/";
|
||||
|
||||
CTemplateWriter::CTemplateWriter()
|
||||
{
|
||||
}
|
||||
|
||||
void CTemplateWriter::SavePropertyTemplate(IPropertyTemplate *pTemp)
|
||||
{
|
||||
// Check for a source file in the template's hierarchy; that indicates it's part of a struct template, not a script template
|
||||
TString SourceFile = pTemp->FindStructSource();
|
||||
|
||||
// Struct
|
||||
if (!SourceFile.IsEmpty())
|
||||
{
|
||||
CMasterTemplate *pMaster = pTemp->MasterTemplate();
|
||||
auto StructIt = pMaster->mStructTemplates.find(SourceFile);
|
||||
|
||||
if (StructIt != pMaster->mStructTemplates.end())
|
||||
{
|
||||
CStructTemplate *pStruct = StructIt->second;
|
||||
CTemplateWriter::SaveStructTemplate(pStruct);
|
||||
}
|
||||
}
|
||||
|
||||
// Script
|
||||
else if (pTemp->ScriptTemplate())
|
||||
CTemplateWriter::SaveScriptTemplate(pTemp->ScriptTemplate());
|
||||
|
||||
// Error
|
||||
else
|
||||
Log::Error("Couldn't save property template " + pTemp->IDString(true) + "; no struct template source path or script template found");
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveAllTemplates()
|
||||
{
|
||||
// Create directory
|
||||
std::list<CMasterTemplate*> MasterList = CMasterTemplate::MasterList();
|
||||
FileUtil::MakeDirectory(smTemplatesDir);
|
||||
|
||||
// Resave property list
|
||||
SavePropertyList();
|
||||
|
||||
// Resave master templates
|
||||
for (auto it = MasterList.begin(); it != MasterList.end(); it++)
|
||||
SaveGameTemplates(*it);
|
||||
|
||||
// Resave game list
|
||||
XMLDocument GameList;
|
||||
|
||||
XMLDeclaration *pDecl = GameList.NewDeclaration();
|
||||
GameList.LinkEndChild(pDecl);
|
||||
|
||||
XMLElement *pBase = GameList.NewElement("GameList");
|
||||
pBase->SetAttribute("version", 4);
|
||||
GameList.LinkEndChild(pBase);
|
||||
|
||||
XMLElement *pProperties = GameList.NewElement("properties");
|
||||
pProperties->SetText("Properties.xml");
|
||||
pBase->LinkEndChild(pProperties);
|
||||
|
||||
for (auto it = MasterList.begin(); it != MasterList.end(); it++)
|
||||
{
|
||||
CMasterTemplate *pMaster = *it;
|
||||
|
||||
XMLElement *pGame = GameList.NewElement("game");
|
||||
pBase->LinkEndChild(pGame);
|
||||
|
||||
XMLElement *pGameName = GameList.NewElement("name");
|
||||
pGameName->SetText(*pMaster->mGameName);
|
||||
pGame->LinkEndChild(pGameName);
|
||||
|
||||
XMLElement *pAreaVersion = GameList.NewElement("mrea");
|
||||
u32 VersionNumber = CAreaCooker::GetMREAVersion(pMaster->Game());
|
||||
pAreaVersion->SetText(*TString::HexString(VersionNumber, 2));
|
||||
pGame->LinkEndChild(pAreaVersion);
|
||||
|
||||
XMLElement *pTempPath = GameList.NewElement("master");
|
||||
pTempPath->SetText(*pMaster->mSourceFile);
|
||||
pGame->LinkEndChild(pTempPath);
|
||||
}
|
||||
|
||||
TString GameListName = smTemplatesDir + "GameList.xml";
|
||||
GameList.SaveFile(*GameListName);
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveGameTemplates(CMasterTemplate *pMaster)
|
||||
{
|
||||
// Create directory
|
||||
TString OutFile = smTemplatesDir + pMaster->mSourceFile;
|
||||
TString OutDir = OutFile.GetFileDirectory();
|
||||
FileUtil::MakeDirectory(OutDir);
|
||||
|
||||
// Resave script templates
|
||||
for (auto it = pMaster->mTemplates.begin(); it != pMaster->mTemplates.end(); it++)
|
||||
SaveScriptTemplate(it->second);
|
||||
|
||||
// Resave struct templates
|
||||
for (auto it = pMaster->mStructTemplates.begin(); it != pMaster->mStructTemplates.end(); it++)
|
||||
SaveStructTemplate(it->second);
|
||||
|
||||
// Resave master template
|
||||
XMLDocument Master;
|
||||
|
||||
XMLDeclaration *pDecl = Master.NewDeclaration();
|
||||
Master.LinkEndChild(pDecl);
|
||||
|
||||
XMLElement *pBase = Master.NewElement("MasterTemplate");
|
||||
pBase->SetAttribute("version", 4);
|
||||
Master.LinkEndChild(pBase);
|
||||
|
||||
// Write versions
|
||||
if (!pMaster->mGameVersions.empty())
|
||||
{
|
||||
XMLElement *pVersionsBlock = Master.NewElement("versions");
|
||||
pBase->LinkEndChild(pVersionsBlock);
|
||||
|
||||
for (auto it = pMaster->mGameVersions.begin(); it != pMaster->mGameVersions.end(); it++)
|
||||
{
|
||||
XMLElement *pVersion = Master.NewElement("version");
|
||||
pVersion->SetText(*(*it));
|
||||
pVersionsBlock->LinkEndChild(pVersion);
|
||||
}
|
||||
}
|
||||
|
||||
// Write script objects
|
||||
XMLElement *pObjects = Master.NewElement("objects");
|
||||
pBase->LinkEndChild(pObjects);
|
||||
|
||||
for (auto it = pMaster->mTemplates.begin(); it != pMaster->mTemplates.end(); it++)
|
||||
{
|
||||
u32 ObjID = (it->second)->ObjectID();
|
||||
|
||||
TString StrID;
|
||||
if (ObjID <= 0xFF)
|
||||
StrID = TString::HexString(ObjID, 2);
|
||||
else
|
||||
StrID = CFourCC(ObjID).ToString();
|
||||
|
||||
XMLElement *pObj = Master.NewElement("object");
|
||||
pObj->SetAttribute("ID", *StrID);
|
||||
pObj->SetAttribute("template", *(it->second)->mSourceFile);
|
||||
pObjects->LinkEndChild(pObj);
|
||||
}
|
||||
|
||||
// Write script states/messages
|
||||
for (u32 iType = 0; iType < 2; iType++)
|
||||
{
|
||||
TString Type = (iType == 0 ? "state" : "message");
|
||||
XMLElement *pElem = Master.NewElement(*(Type + "s"));
|
||||
pBase->LinkEndChild(pElem);
|
||||
|
||||
u32 Num = (iType == 0 ? pMaster->NumStates() : pMaster->NumMessages());
|
||||
|
||||
for (u32 iScr = 0; iScr < Num; iScr++)
|
||||
{
|
||||
u32 ID;
|
||||
TString Name;
|
||||
|
||||
if (iType == 0)
|
||||
{
|
||||
SState State = pMaster->StateByIndex(iScr);
|
||||
ID = State.ID;
|
||||
Name = State.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
SMessage Message = pMaster->MessageByIndex(iScr);
|
||||
ID = Message.ID;
|
||||
Name = Message.Name;
|
||||
}
|
||||
|
||||
TString StrID;
|
||||
if (ID <= 0xFF) StrID = TString::HexString(ID, 2);
|
||||
else StrID = CFourCC(ID).ToString();
|
||||
|
||||
XMLElement *pSubElem = Master.NewElement(*Type);
|
||||
pSubElem->SetAttribute("ID", *StrID);
|
||||
pSubElem->SetAttribute("name", *Name);
|
||||
pElem->LinkEndChild(pSubElem);
|
||||
}
|
||||
}
|
||||
|
||||
// Save file
|
||||
Master.SaveFile(*OutFile);
|
||||
}
|
||||
|
||||
void CTemplateWriter::SavePropertyList()
|
||||
{
|
||||
// Create XML
|
||||
XMLDocument List;
|
||||
|
||||
XMLDeclaration *pDecl = List.NewDeclaration();
|
||||
List.LinkEndChild(pDecl);
|
||||
|
||||
XMLElement *pBase = List.NewElement("Properties");
|
||||
pBase->SetAttribute("version", 4);
|
||||
List.LinkEndChild(pBase);
|
||||
|
||||
// Write properties
|
||||
for (auto it = CMasterTemplate::smPropertyNames.begin(); it != CMasterTemplate::smPropertyNames.end(); it++)
|
||||
{
|
||||
u32 ID = it->first;
|
||||
TString Name = it->second;
|
||||
|
||||
XMLElement *pElem = List.NewElement("property");
|
||||
pElem->SetAttribute("ID", *TString::HexString(ID));
|
||||
pElem->SetAttribute("name", *Name);
|
||||
pBase->LinkEndChild(pElem);
|
||||
}
|
||||
|
||||
TString OutFile = smTemplatesDir + "Properties.xml";
|
||||
List.SaveFile(*OutFile);
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp)
|
||||
{
|
||||
CMasterTemplate *pMaster = pTemp->MasterTemplate();
|
||||
|
||||
// Create directory
|
||||
TString OutFile = smTemplatesDir + pMaster->GetDirectory() + pTemp->mSourceFile;
|
||||
TString OutDir = OutFile.GetFileDirectory();
|
||||
FileUtil::MakeDirectory(*OutDir);
|
||||
|
||||
// Create new document
|
||||
XMLDocument ScriptXML;
|
||||
|
||||
XMLDeclaration *pDecl = ScriptXML.NewDeclaration();
|
||||
ScriptXML.LinkEndChild(pDecl);
|
||||
|
||||
// Base element
|
||||
XMLElement *pRoot = ScriptXML.NewElement("ScriptTemplate");
|
||||
pRoot->SetAttribute("version", 4);
|
||||
ScriptXML.LinkEndChild(pRoot);
|
||||
|
||||
// Write object name
|
||||
XMLElement *pName = ScriptXML.NewElement("name");
|
||||
pName->SetText(*pTemp->Name());
|
||||
pRoot->LinkEndChild(pName);
|
||||
|
||||
// Write modules
|
||||
if (!pTemp->mModules.empty())
|
||||
{
|
||||
XMLElement *pModules = ScriptXML.NewElement("modules");
|
||||
pRoot->LinkEndChild(pModules);
|
||||
|
||||
for (u32 iMod = 0; iMod < pTemp->mModules.size(); iMod++)
|
||||
{
|
||||
XMLElement *pModule = ScriptXML.NewElement("module");
|
||||
pModule->SetText(*pTemp->mModules[iMod]);
|
||||
pModules->LinkEndChild(pModule);
|
||||
}
|
||||
}
|
||||
|
||||
// Write properties
|
||||
SaveProperties(&ScriptXML, pRoot, pTemp->mpBaseStruct);
|
||||
|
||||
// States/Messages [todo]
|
||||
XMLElement *pStates = ScriptXML.NewElement("states");
|
||||
pRoot->LinkEndChild(pStates);
|
||||
|
||||
XMLElement *pMessages = ScriptXML.NewElement("messages");
|
||||
pRoot->LinkEndChild(pMessages);
|
||||
|
||||
// Write editor properties
|
||||
XMLElement *pEditor = ScriptXML.NewElement("editor");
|
||||
pRoot->LinkEndChild(pEditor);
|
||||
|
||||
// Editor Properties
|
||||
XMLElement *pEditorProperties = ScriptXML.NewElement("properties");
|
||||
pEditor->LinkEndChild(pEditorProperties);
|
||||
|
||||
TString PropNames[6] = {
|
||||
"InstanceName", "Position", "Rotation",
|
||||
"Scale", "Active", "LightParameters"
|
||||
};
|
||||
|
||||
TIDString *pPropStrings[6] = {
|
||||
&pTemp->mNameIDString, &pTemp->mPositionIDString, &pTemp->mRotationIDString,
|
||||
&pTemp->mScaleIDString, &pTemp->mActiveIDString, &pTemp->mLightParametersIDString
|
||||
};
|
||||
|
||||
for (u32 iProp = 0; iProp < 6; iProp++)
|
||||
{
|
||||
if (!pPropStrings[iProp]->IsEmpty())
|
||||
{
|
||||
XMLElement *pProperty = ScriptXML.NewElement("property");
|
||||
pProperty->SetAttribute("name", *PropNames[iProp]);
|
||||
pProperty->SetAttribute("ID", **pPropStrings[iProp]);
|
||||
pEditorProperties->LinkEndChild(pProperty);
|
||||
}
|
||||
}
|
||||
|
||||
// Editor Assets
|
||||
XMLElement *pAssets = ScriptXML.NewElement("assets");
|
||||
pEditor->LinkEndChild(pAssets);
|
||||
|
||||
for (auto it = pTemp->mAssets.begin(); it != pTemp->mAssets.end(); it++)
|
||||
{
|
||||
TString Source = (it->AssetSource == CScriptTemplate::SEditorAsset::eFile ? "file" : "property");
|
||||
TString Type;
|
||||
|
||||
switch (it->AssetType)
|
||||
{
|
||||
case CScriptTemplate::SEditorAsset::eModel: Type = "model"; break;
|
||||
case CScriptTemplate::SEditorAsset::eAnimParams: Type = "animparams"; break;
|
||||
case CScriptTemplate::SEditorAsset::eBillboard: Type = "billboard"; break;
|
||||
case CScriptTemplate::SEditorAsset::eCollision: Type = "collision"; break;
|
||||
}
|
||||
|
||||
s32 Force = -1;
|
||||
if (it->AssetType == CScriptTemplate::SEditorAsset::eAnimParams)
|
||||
Force = it->ForceNodeIndex;
|
||||
|
||||
XMLElement *pAsset = ScriptXML.NewElement(*Type);
|
||||
pAsset->SetAttribute("source", *Source);
|
||||
if (Force >= 0) pAsset->SetAttribute("force", *TString::FromInt32(Force, 0, 10));
|
||||
pAsset->SetText(*it->AssetLocation);
|
||||
pAssets->LinkEndChild(pAsset);
|
||||
}
|
||||
|
||||
// Attachments
|
||||
if (!pTemp->mAttachments.empty())
|
||||
{
|
||||
XMLElement *pAttachments = ScriptXML.NewElement("attachments");
|
||||
pEditor->LinkEndChild(pAttachments);
|
||||
|
||||
for (auto it = pTemp->mAttachments.begin(); it != pTemp->mAttachments.end(); it++)
|
||||
{
|
||||
XMLElement *pAttachment = ScriptXML.NewElement("attachment");
|
||||
pAttachment->SetAttribute("propertyID", *it->AttachProperty);
|
||||
pAttachment->SetAttribute("locator", *it->LocatorName);
|
||||
pAttachments->LinkEndChild(pAttachment);
|
||||
|
||||
// Sub-properties
|
||||
if (it->AttachType != eAttach)
|
||||
{
|
||||
XMLElement *pAttachType = ScriptXML.NewElement("attach_type");
|
||||
pAttachType->SetText("follow");
|
||||
pAttachment->LinkEndChild(pAttachType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Preview Scale
|
||||
if (pTemp->mPreviewScale != 1.f)
|
||||
{
|
||||
XMLElement *pPreviewScale = ScriptXML.NewElement("preview_scale");
|
||||
pPreviewScale->SetText(*TString::FromFloat(pTemp->mPreviewScale));
|
||||
pEditor->LinkEndChild(pPreviewScale);
|
||||
}
|
||||
|
||||
// Rot/Scale Type
|
||||
XMLElement *pRotType = ScriptXML.NewElement("rotation_type");
|
||||
pEditor->LinkEndChild(pRotType);
|
||||
pRotType->SetText(pTemp->mRotationType == CScriptTemplate::eRotationEnabled ? "enabled" : "disabled");
|
||||
|
||||
XMLElement *pScaleType = ScriptXML.NewElement("scale_type");
|
||||
pEditor->LinkEndChild(pScaleType);
|
||||
|
||||
if (pTemp->mScaleType != CScriptTemplate::eScaleVolume)
|
||||
pScaleType->SetText(pTemp->mScaleType == CScriptTemplate::eScaleEnabled ? "enabled" : "disabled");
|
||||
|
||||
else
|
||||
{
|
||||
pScaleType->SetText("volume");
|
||||
|
||||
// Volume Preview
|
||||
XMLElement *pVolume = ScriptXML.NewElement("preview_volume");
|
||||
pEditor->LinkEndChild(pVolume);
|
||||
|
||||
// Enum -> String conversion lambda to avoid redundant code
|
||||
auto GetVolumeString = [](EVolumeShape shape) -> TString
|
||||
{
|
||||
switch (shape)
|
||||
{
|
||||
case eBoxShape: return "Box";
|
||||
case eAxisAlignedBoxShape: return "AxisAlignedBox";
|
||||
case eEllipsoidShape: return "Ellipsoid";
|
||||
case eCylinderShape: return "Cylinder";
|
||||
case eConditionalShape: return "Conditional";
|
||||
default: return "INVALID";
|
||||
}
|
||||
};
|
||||
|
||||
pVolume->SetAttribute("shape", *GetVolumeString(pTemp->mVolumeShape));
|
||||
|
||||
if (pTemp->mVolumeScale != 1.f)
|
||||
pVolume->SetAttribute("scale", pTemp->mVolumeScale);
|
||||
|
||||
if (pTemp->mVolumeShape == eConditionalShape)
|
||||
{
|
||||
pVolume->SetAttribute("propertyID", *pTemp->mVolumeConditionIDString);
|
||||
|
||||
// Find conditional test property
|
||||
IPropertyTemplate *pProp = pTemp->mpBaseStruct->PropertyByIDString(pTemp->mVolumeConditionIDString);
|
||||
|
||||
// Write conditions
|
||||
for (auto it = pTemp->mVolumeConditions.begin(); it != pTemp->mVolumeConditions.end(); it++)
|
||||
{
|
||||
// Value should be an integer, or a boolean condition
|
||||
TString StrVal;
|
||||
|
||||
if (pProp->Type() == eBoolProperty)
|
||||
StrVal = (it->Value == 1 ? "true" : "false");
|
||||
else
|
||||
StrVal = TString::HexString((u32) it->Value, (it->Value > 0xFF ? 8 : 2));
|
||||
|
||||
XMLElement *pCondition = ScriptXML.NewElement("condition");
|
||||
pCondition->SetAttribute("value", *StrVal);
|
||||
pCondition->SetAttribute("shape", *GetVolumeString(it->Shape));
|
||||
if (it->Scale != 1.f) pCondition->SetAttribute("scale", it->Scale);
|
||||
pVolume->LinkEndChild(pCondition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write to file
|
||||
ScriptXML.SaveFile(*OutFile);
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveStructTemplate(CStructTemplate *pTemp)
|
||||
{
|
||||
// Create directory
|
||||
CMasterTemplate *pMaster = pTemp->MasterTemplate();
|
||||
TString OutFile = smTemplatesDir + pMaster->GetDirectory() + pTemp->mSourceFile;
|
||||
TString OutDir = OutFile.GetFileDirectory();
|
||||
TString Name = OutFile.GetFileName(false);
|
||||
FileUtil::MakeDirectory(OutDir);
|
||||
|
||||
// Create new document and write struct properties to it
|
||||
XMLDocument StructXML;
|
||||
|
||||
XMLDeclaration *pDecl = StructXML.NewDeclaration();
|
||||
StructXML.LinkEndChild(pDecl);
|
||||
|
||||
XMLElement *pRoot = StructXML.NewElement("struct");
|
||||
pRoot->SetAttribute("name", *Name);
|
||||
pRoot->SetAttribute("type", (pTemp->IsSingleProperty() ? "single" : "multi"));
|
||||
StructXML.LinkEndChild(pRoot);
|
||||
|
||||
SaveProperties(&StructXML, pRoot, pTemp);
|
||||
StructXML.SaveFile(*OutFile);
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveEnumTemplate(CEnumTemplate *pTemp)
|
||||
{
|
||||
// Create directory
|
||||
CMasterTemplate *pMaster = pTemp->MasterTemplate();
|
||||
TString OutFile = smTemplatesDir + pMaster->GetDirectory() + pTemp->mSourceFile;
|
||||
TString OutDir = OutFile.GetFileDirectory();
|
||||
TString Name = OutFile.GetFileName(false);
|
||||
FileUtil::MakeDirectory(OutDir);
|
||||
|
||||
// Create new document and write enumerators to it
|
||||
XMLDocument EnumXML;
|
||||
|
||||
XMLDeclaration *pDecl = EnumXML.NewDeclaration();
|
||||
EnumXML.LinkEndChild(pDecl);
|
||||
|
||||
XMLElement *pRoot = EnumXML.NewElement("enum");
|
||||
pRoot->SetAttribute("name", *Name);
|
||||
EnumXML.LinkEndChild(pRoot);
|
||||
|
||||
SaveEnumerators(&EnumXML, pRoot, pTemp);
|
||||
EnumXML.SaveFile(*OutFile);
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveBitfieldTemplate(CBitfieldTemplate *pTemp)
|
||||
{
|
||||
// Create directory
|
||||
CMasterTemplate *pMaster = pTemp->MasterTemplate();
|
||||
TString OutFile = smTemplatesDir + pMaster->GetDirectory() + pTemp->mSourceFile;
|
||||
TString OutDir = OutFile.GetFileDirectory();
|
||||
TString Name = pTemp->mSourceFile.GetFileName(false);
|
||||
FileUtil::MakeDirectory(OutDir);
|
||||
|
||||
// Create new document and write enumerators to it
|
||||
XMLDocument BitfieldXML;
|
||||
|
||||
XMLDeclaration *pDecl = BitfieldXML.NewDeclaration();
|
||||
BitfieldXML.LinkEndChild(pDecl);
|
||||
|
||||
XMLElement *pRoot = BitfieldXML.NewElement("bitfield");
|
||||
pRoot->SetAttribute("name", *Name);
|
||||
BitfieldXML.LinkEndChild(pRoot);
|
||||
|
||||
SaveBitFlags(&BitfieldXML, pRoot, pTemp);
|
||||
BitfieldXML.SaveFile(*OutFile);
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CStructTemplate *pTemp)
|
||||
{
|
||||
// Create base element
|
||||
XMLElement *pPropsBlock = pDoc->NewElement("properties");
|
||||
pParent->LinkEndChild(pPropsBlock);
|
||||
|
||||
for (u32 iProp = 0; iProp < pTemp->Count(); iProp++)
|
||||
{
|
||||
// Get ID
|
||||
IPropertyTemplate *pProp = pTemp->PropertyByIndex(iProp);
|
||||
u32 ID = pProp->PropertyID();
|
||||
TString StrID = TString::HexString(ID, (ID > 0xFF ? 8 : 2));
|
||||
|
||||
// Create element
|
||||
XMLElement *pElem;
|
||||
|
||||
if (pProp->Type() == eStructProperty)
|
||||
pElem = pDoc->NewElement("struct");
|
||||
else if (pProp->Type() == eEnumProperty)
|
||||
pElem = pDoc->NewElement("enum");
|
||||
else if (pProp->Type() == eBitfieldProperty)
|
||||
pElem = pDoc->NewElement("bitfield");
|
||||
else if (pProp->Type() == eArrayProperty)
|
||||
pElem = pDoc->NewElement("array");
|
||||
else
|
||||
pElem = pDoc->NewElement("property");
|
||||
|
||||
pPropsBlock->LinkEndChild(pElem);
|
||||
|
||||
// Set common property parameters, starting with ID
|
||||
pElem->SetAttribute("ID", *StrID);
|
||||
|
||||
// Name
|
||||
TString Name = pProp->Name();
|
||||
|
||||
if (pProp->Game() >= eEchoesDemo && ID > 0xFF)
|
||||
{
|
||||
TString MasterName = CMasterTemplate::PropertyName(ID);
|
||||
|
||||
if (Name != MasterName)
|
||||
pElem->SetAttribute("name", *Name);
|
||||
}
|
||||
|
||||
else
|
||||
pElem->SetAttribute("name", *Name);
|
||||
|
||||
// Type
|
||||
if (pProp->Type() == eStructProperty)
|
||||
{
|
||||
CStructTemplate *pStruct = static_cast<CStructTemplate*>(pProp);
|
||||
|
||||
if (pStruct->mSourceFile.IsEmpty())
|
||||
pElem->SetAttribute("type", (pStruct->mIsSingleProperty ? "single" : "multi"));
|
||||
}
|
||||
|
||||
else if (TString(pElem->Name()) == "property")
|
||||
pElem->SetAttribute("type", *PropEnumToPropString(pProp->Type()));
|
||||
|
||||
// Versions
|
||||
CMasterTemplate *pMaster = pProp->MasterTemplate();
|
||||
u32 NumVersions = pProp->mAllowedVersions.size();
|
||||
|
||||
if (NumVersions > 0 && NumVersions != pMaster->mGameVersions.size())
|
||||
{
|
||||
XMLElement *pVersions = pDoc->NewElement("versions");
|
||||
pElem->LinkEndChild(pVersions);
|
||||
|
||||
for (u32 iVer = 0; iVer < pMaster->mGameVersions.size(); iVer++)
|
||||
{
|
||||
if (pProp->IsInVersion(iVer))
|
||||
{
|
||||
XMLElement *pVersion = pDoc->NewElement("version");
|
||||
pVersion->SetText(*pMaster->mGameVersions[iVer]);
|
||||
pVersions->LinkEndChild(pVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default
|
||||
if (pProp->CanHaveDefault() && pProp->Game() >= eEchoesDemo)
|
||||
{
|
||||
XMLElement *pDefault = pDoc->NewElement("default");
|
||||
pDefault->SetText(*pProp->DefaultToString());
|
||||
pElem->LinkEndChild(pDefault);
|
||||
}
|
||||
|
||||
// Description
|
||||
if (!pProp->Description().IsEmpty())
|
||||
{
|
||||
XMLElement *pDesc = pDoc->NewElement("description");
|
||||
pDesc->SetText(*pProp->Description());
|
||||
pElem->LinkEndChild(pDesc);
|
||||
}
|
||||
|
||||
// Range
|
||||
if (pProp->IsNumerical() && pProp->HasValidRange())
|
||||
{
|
||||
XMLElement *pRange = pDoc->NewElement("range");
|
||||
pRange->SetText(*pProp->RangeToString());
|
||||
pElem->LinkEndChild(pRange);
|
||||
}
|
||||
|
||||
// Suffix
|
||||
if (pProp->IsNumerical())
|
||||
{
|
||||
TString Suffix = pProp->Suffix();
|
||||
|
||||
if (!Suffix.IsEmpty())
|
||||
{
|
||||
XMLElement *pSuffix = pDoc->NewElement("suffix");
|
||||
pSuffix->SetText(*Suffix);
|
||||
pElem->LinkEndChild(pSuffix);
|
||||
}
|
||||
}
|
||||
|
||||
// Cook Pref
|
||||
ECookPreference CookPref = pProp->CookPreference();
|
||||
|
||||
if (CookPref != eNoCookPreference)
|
||||
{
|
||||
XMLElement *pCookPref = pDoc->NewElement("cook_pref");
|
||||
pCookPref->SetText(CookPref == eAlwaysCook ? "always" : "never");
|
||||
pElem->LinkEndChild(pCookPref);
|
||||
}
|
||||
|
||||
// Asset-specific parameters
|
||||
if (pProp->Type() == eAssetProperty)
|
||||
{
|
||||
CAssetTemplate *pAsset = static_cast<CAssetTemplate*>(pProp);
|
||||
const CResTypeFilter& rkFilter = pAsset->TypeFilter();
|
||||
TString ExtensionsString = rkFilter.ToString();
|
||||
if (ExtensionsString.IsEmpty()) ExtensionsString = "UNKN";
|
||||
pElem->SetAttribute("extensions", *ExtensionsString);
|
||||
}
|
||||
|
||||
// Enum-specific parameters
|
||||
else if (pProp->Type() == eEnumProperty)
|
||||
{
|
||||
CEnumTemplate *pEnum = static_cast<CEnumTemplate*>(pProp);
|
||||
|
||||
if (pEnum->mSourceFile.IsEmpty())
|
||||
SaveEnumerators(pDoc, pElem, pEnum);
|
||||
|
||||
else
|
||||
{
|
||||
SaveEnumTemplate(pEnum);
|
||||
pElem->SetAttribute("template", *pEnum->mSourceFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Bitfield-specific parameters
|
||||
else if (pProp->Type() == eBitfieldProperty)
|
||||
{
|
||||
CBitfieldTemplate *pBitfield = static_cast<CBitfieldTemplate*>(pProp);
|
||||
|
||||
if (pBitfield->mSourceFile.IsEmpty())
|
||||
SaveBitFlags(pDoc, pElem, pBitfield);
|
||||
|
||||
else
|
||||
{
|
||||
SaveBitfieldTemplate(pBitfield);
|
||||
pElem->SetAttribute("template", *pBitfield->mSourceFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Struct/array-specific parameters
|
||||
else if (pProp->Type() == eStructProperty || pProp->Type() == eArrayProperty)
|
||||
{
|
||||
// Element Name
|
||||
if (pProp->Type() == eArrayProperty)
|
||||
{
|
||||
CArrayTemplate *pArray = static_cast<CArrayTemplate*>(pProp);
|
||||
|
||||
if (!pArray->ElementName().IsEmpty())
|
||||
{
|
||||
XMLElement *pElement = pDoc->NewElement("element_name");
|
||||
pElement->SetText(*static_cast<CArrayTemplate*>(pProp)->ElementName());
|
||||
pElem->LinkEndChild(pElement);
|
||||
}
|
||||
}
|
||||
|
||||
// Sub-properties
|
||||
CStructTemplate *pStruct = static_cast<CStructTemplate*>(pProp);
|
||||
|
||||
if (pStruct->mSourceFile.IsEmpty())
|
||||
SaveProperties(pDoc, pElem, pStruct);
|
||||
|
||||
else
|
||||
{
|
||||
CStructTemplate *pOriginal = pMaster->StructAtSource(pStruct->mSourceFile);
|
||||
|
||||
if (pOriginal)
|
||||
SavePropertyOverrides(pDoc, pElem, pStruct, pOriginal);
|
||||
|
||||
pElem->SetAttribute("template", *pStruct->mSourceFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CTemplateWriter::SavePropertyOverrides(XMLDocument *pDoc, XMLElement *pParent, CStructTemplate *pStruct, CStructTemplate *pOriginal)
|
||||
{
|
||||
if (!pStruct->StructDataMatches(pOriginal))
|
||||
{
|
||||
// Create base element
|
||||
XMLElement *pPropsBlock = pDoc->NewElement("properties");
|
||||
pParent->LinkEndChild(pPropsBlock);
|
||||
|
||||
for (u32 iProp = 0; iProp < pStruct->Count(); iProp++)
|
||||
{
|
||||
IPropertyTemplate *pProp = pStruct->PropertyByIndex(iProp);
|
||||
IPropertyTemplate *pSource = pOriginal->PropertyByIndex(iProp);
|
||||
|
||||
if (!pProp->Matches(pSource))
|
||||
{
|
||||
// Create element
|
||||
XMLElement *pElem;
|
||||
|
||||
if (pProp->Type() == eStructProperty)
|
||||
pElem = pDoc->NewElement("struct");
|
||||
else if (pProp->Type() == eEnumProperty)
|
||||
pElem = pDoc->NewElement("enum");
|
||||
else if (pProp->Type() == eBitfieldProperty)
|
||||
pElem = pDoc->NewElement("bitfield");
|
||||
else if (pProp->Type() == eArrayProperty)
|
||||
pElem = pDoc->NewElement("array");
|
||||
else
|
||||
pElem = pDoc->NewElement("property");
|
||||
|
||||
pPropsBlock->LinkEndChild(pElem);
|
||||
|
||||
// ID
|
||||
u32 ID = pProp->PropertyID();
|
||||
pElem->SetAttribute("ID", *TString::HexString(pProp->PropertyID(), (ID > 0xFF ? 8 : 2)));
|
||||
|
||||
// Name
|
||||
if (pProp->Name() != pSource->Name())
|
||||
pElem->SetAttribute("name", *pProp->Name());
|
||||
|
||||
// Default
|
||||
if (pProp->CanHaveDefault() && !pProp->RawDefaultValue()->Matches(pSource->RawDefaultValue()))
|
||||
{
|
||||
XMLElement *pDefault = pDoc->NewElement("default");
|
||||
pDefault->SetText(*pProp->DefaultToString());
|
||||
pElem->LinkEndChild(pDefault);
|
||||
}
|
||||
|
||||
// Description
|
||||
if (pProp->Description() != pSource->Description())
|
||||
{
|
||||
XMLElement *pDesc = pDoc->NewElement("description");
|
||||
pDesc->SetText(*pProp->Description());
|
||||
pElem->LinkEndChild(pDesc);
|
||||
}
|
||||
|
||||
// Range
|
||||
if (pProp->IsNumerical())
|
||||
{
|
||||
TString Range = pProp->RangeToString();
|
||||
|
||||
if (Range != pSource->RangeToString())
|
||||
{
|
||||
XMLElement *pRange = pDoc->NewElement("range");
|
||||
pRange->SetText(*Range);
|
||||
pElem->LinkEndChild(pRange);
|
||||
}
|
||||
}
|
||||
|
||||
// Suffix
|
||||
if (pProp->Suffix() != pSource->Suffix())
|
||||
{
|
||||
XMLElement *pSuffix = pDoc->NewElement("suffix");
|
||||
pSuffix->SetText(*pProp->Suffix());
|
||||
pElem->LinkEndChild(pSuffix);
|
||||
}
|
||||
|
||||
// Cook Pref
|
||||
if (pProp->CookPreference() != pSource->CookPreference())
|
||||
{
|
||||
XMLElement *pCookPref = pDoc->NewElement("cook_pref");
|
||||
|
||||
TString PrefStr;
|
||||
if (pProp->CookPreference() == eAlwaysCook) PrefStr = "always";
|
||||
else if (pProp->CookPreference() == eNeverCook) PrefStr = "never";
|
||||
else PrefStr = "none";
|
||||
|
||||
pCookPref->SetText(*PrefStr);
|
||||
pElem->LinkEndChild(pCookPref);
|
||||
}
|
||||
|
||||
// Asset-specific parameters
|
||||
if (pProp->Type() == eAssetProperty)
|
||||
{
|
||||
CAssetTemplate *pAsset = static_cast<CAssetTemplate*>(pProp);
|
||||
CAssetTemplate *pSourceAsset = static_cast<CAssetTemplate*>(pSource);
|
||||
|
||||
if (pAsset->TypeFilter() != pSourceAsset->TypeFilter())
|
||||
{
|
||||
TString ExtensionsString = pAsset->TypeFilter().ToString();
|
||||
if (ExtensionsString.IsEmpty()) ExtensionsString = "UNKN";
|
||||
pElem->SetAttribute("extensions", *ExtensionsString);
|
||||
}
|
||||
}
|
||||
|
||||
// Struct/array-specific parameters
|
||||
else if (pProp->Type() == eStructProperty || pProp->Type() == eArrayProperty)
|
||||
{
|
||||
CStructTemplate *pChildStruct = static_cast<CStructTemplate*>(pProp);
|
||||
CStructTemplate *pSourceStruct = static_cast<CStructTemplate*>(pSource);
|
||||
SavePropertyOverrides(pDoc, pElem, pChildStruct, pSourceStruct);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveEnumerators(XMLDocument *pDoc, XMLElement *pParent, CEnumTemplate *pTemp)
|
||||
{
|
||||
XMLElement *pEnumerators = pDoc->NewElement("enumerators");
|
||||
pParent->LinkEndChild(pEnumerators);
|
||||
|
||||
for (u32 iEnum = 0; iEnum < pTemp->NumEnumerators(); iEnum++)
|
||||
{
|
||||
XMLElement *pElem = pDoc->NewElement("enumerator");
|
||||
u32 EnumerID = pTemp->EnumeratorID(iEnum);
|
||||
pElem->SetAttribute("ID", *TString::HexString(EnumerID, (EnumerID > 0xFF ? 8 : 2)));
|
||||
pElem->SetAttribute("name", *pTemp->EnumeratorName(iEnum));
|
||||
pEnumerators->LinkEndChild(pElem);
|
||||
}
|
||||
}
|
||||
|
||||
void CTemplateWriter::SaveBitFlags(XMLDocument *pDoc, XMLElement *pParent, CBitfieldTemplate *pTemp)
|
||||
{
|
||||
XMLElement *pFlags = pDoc->NewElement("flags");
|
||||
pParent->LinkEndChild(pFlags);
|
||||
|
||||
for (u32 iFlag = 0; iFlag < pTemp->NumFlags(); iFlag++)
|
||||
{
|
||||
XMLElement *pElem = pDoc->NewElement("flag");
|
||||
pElem->SetAttribute("mask", *TString::HexString(pTemp->FlagMask(iFlag)));
|
||||
pElem->SetAttribute("name", *pTemp->FlagName(iFlag));
|
||||
pFlags->LinkEndChild(pElem);
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,30 +0,0 @@
|
|||
#ifndef CTEMPLATEWRITER_H
|
||||
#define CTEMPLATEWRITER_H
|
||||
|
||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||
#include "Core/Resource/Script/CScriptTemplate.h"
|
||||
#include <tinyxml2.h>
|
||||
|
||||
#if 0
|
||||
class CTemplateWriter
|
||||
{
|
||||
CTemplateWriter();
|
||||
static TString smTemplatesDir;
|
||||
|
||||
public:
|
||||
static void SavePropertyTemplate(IPropertyTemplate *pTemp);
|
||||
static void SaveAllTemplates();
|
||||
static void SaveGameTemplates(CMasterTemplate *pMaster);
|
||||
static void SavePropertyList();
|
||||
static void SaveScriptTemplate(CScriptTemplate *pTemp);
|
||||
static void SaveStructTemplate(CStructTemplate *pTemp);
|
||||
static void SaveEnumTemplate(CEnumTemplate *pTemp);
|
||||
static void SaveBitfieldTemplate(CBitfieldTemplate *pTemp);
|
||||
static void SaveProperties(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CStructTemplate *pTemp);
|
||||
static void SavePropertyOverrides(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CStructTemplate *pStruct, CStructTemplate *pOriginal);
|
||||
static void SaveEnumerators(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CEnumTemplate *pTemp);
|
||||
static void SaveBitFlags(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CBitfieldTemplate *pTemp);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // CTEMPLATEWRITER_H
|
|
@ -19,49 +19,49 @@ CScriptLoader::CScriptLoader()
|
|||
{
|
||||
}
|
||||
|
||||
void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rSCLY)
|
||||
void CScriptLoader::ReadProperty(IProperty *pProp, u32 Size, IInputStream& rSCLY)
|
||||
{
|
||||
void* pData = (mpArrayItemData ? mpArrayItemData : mpObj->mPropertyData.data());
|
||||
|
||||
switch (pProp->Type())
|
||||
{
|
||||
|
||||
case EPropertyTypeNew::Bool:
|
||||
case EPropertyType::Bool:
|
||||
{
|
||||
CBoolProperty* pBool = TPropCast<CBoolProperty>(pProp);
|
||||
pBool->ValueRef(pData) = rSCLY.ReadBool();
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Byte:
|
||||
case EPropertyType::Byte:
|
||||
{
|
||||
CByteProperty* pByte = TPropCast<CByteProperty>(pProp);
|
||||
pByte->ValueRef(pData) = rSCLY.ReadByte();
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Short:
|
||||
case EPropertyType::Short:
|
||||
{
|
||||
CShortProperty* pShort = TPropCast<CShortProperty>(pProp);
|
||||
pShort->ValueRef(pData) = rSCLY.ReadShort();
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Int:
|
||||
case EPropertyType::Int:
|
||||
{
|
||||
CIntProperty* pInt = TPropCast<CIntProperty>(pProp);
|
||||
pInt->ValueRef(pData) = rSCLY.ReadLong();
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Float:
|
||||
case EPropertyType::Float:
|
||||
{
|
||||
CFloatProperty* pFloat = TPropCast<CFloatProperty>(pProp);
|
||||
pFloat->ValueRef(pData) = rSCLY.ReadFloat();
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Choice:
|
||||
case EPropertyType::Choice:
|
||||
{
|
||||
CChoiceProperty* pChoice = TPropCast<CChoiceProperty>(pProp);
|
||||
pChoice->ValueRef(pData) = rSCLY.ReadLong();
|
||||
|
@ -76,7 +76,7 @@ void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rS
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Enum:
|
||||
case EPropertyType::Enum:
|
||||
{
|
||||
CEnumProperty* pEnum = TPropCast<CEnumProperty>(pProp);
|
||||
pEnum->ValueRef(pData) = rSCLY.ReadLong();
|
||||
|
@ -91,7 +91,7 @@ void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rS
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Flags:
|
||||
case EPropertyType::Flags:
|
||||
{
|
||||
CFlagsProperty* pFlags = TPropCast<CFlagsProperty>(pProp);
|
||||
pFlags->ValueRef(pData) = rSCLY.ReadLong();
|
||||
|
@ -107,28 +107,28 @@ void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rS
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::String:
|
||||
case EPropertyType::String:
|
||||
{
|
||||
CStringProperty* pString = TPropCast<CStringProperty>(pProp);
|
||||
pString->ValueRef(pData) = rSCLY.ReadString();
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Vector:
|
||||
case EPropertyType::Vector:
|
||||
{
|
||||
CVectorProperty* pVector = TPropCast<CVectorProperty>(pProp);
|
||||
pVector->ValueRef(pData) = CVector3f(rSCLY);
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Color:
|
||||
case EPropertyType::Color:
|
||||
{
|
||||
CColorProperty* pColor = TPropCast<CColorProperty>(pProp);
|
||||
pColor->ValueRef(pData) = CColor(rSCLY);
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Asset:
|
||||
case EPropertyType::Asset:
|
||||
{
|
||||
CAssetProperty* pAsset = TPropCast<CAssetProperty>(pProp);
|
||||
pAsset->ValueRef(pData) = CAssetID(rSCLY, mpMaster->Game());
|
||||
|
@ -153,34 +153,34 @@ void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rS
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Sound:
|
||||
case EPropertyType::Sound:
|
||||
{
|
||||
CSoundProperty* pSound = TPropCast<CSoundProperty>(pProp);
|
||||
pSound->ValueRef(pData) = rSCLY.ReadLong();
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Animation:
|
||||
case EPropertyType::Animation:
|
||||
{
|
||||
CAnimationProperty* pAnim = TPropCast<CAnimationProperty>(pProp);
|
||||
pAnim->ValueRef(pData) = rSCLY.ReadLong();
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::AnimationSet:
|
||||
case EPropertyType::AnimationSet:
|
||||
{
|
||||
CAnimationSetProperty* pAnimSet = TPropCast<CAnimationSetProperty>(pProp);
|
||||
pAnimSet->ValueRef(pData) = CAnimationParameters(rSCLY, mpMaster->Game());
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Sequence:
|
||||
case EPropertyType::Sequence:
|
||||
{
|
||||
// TODO
|
||||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Spline:
|
||||
case EPropertyType::Spline:
|
||||
{
|
||||
CSplineProperty* pSpline = TPropCast<CSplineProperty>(pProp);
|
||||
std::vector<char>& Buffer = pSpline->ValueRef(pData);
|
||||
|
@ -189,7 +189,7 @@ void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rS
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Guid:
|
||||
case EPropertyType::Guid:
|
||||
{
|
||||
ASSERT(Size == 16);
|
||||
CGuidProperty* pGuid = TPropCast<CGuidProperty>(pProp);
|
||||
|
@ -198,9 +198,9 @@ void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rS
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Struct:
|
||||
case EPropertyType::Struct:
|
||||
{
|
||||
CStructPropertyNew* pStruct = TPropCast<CStructPropertyNew>(pProp);
|
||||
CStructProperty* pStruct = TPropCast<CStructProperty>(pProp);
|
||||
|
||||
if (mVersion < eEchoesDemo)
|
||||
LoadStructMP1(rSCLY, pStruct);
|
||||
|
@ -209,7 +209,7 @@ void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rS
|
|||
break;
|
||||
}
|
||||
|
||||
case EPropertyTypeNew::Array:
|
||||
case EPropertyType::Array:
|
||||
{
|
||||
CArrayProperty *pArray = TPropCast<CArrayProperty>(pProp);
|
||||
int Count = rSCLY.ReadLong();
|
||||
|
@ -246,7 +246,7 @@ void CScriptLoader::ReadProperty(IPropertyNew *pProp, u32 Size, IInputStream& rS
|
|||
}
|
||||
}
|
||||
|
||||
void CScriptLoader::LoadStructMP1(IInputStream& rSCLY, CStructPropertyNew* pStruct)
|
||||
void CScriptLoader::LoadStructMP1(IInputStream& rSCLY, CStructProperty* pStruct)
|
||||
{
|
||||
u32 StructStart = rSCLY.Tell();
|
||||
|
||||
|
@ -263,10 +263,10 @@ void CScriptLoader::LoadStructMP1(IInputStream& rSCLY, CStructPropertyNew* pStru
|
|||
// Parse properties
|
||||
for (u32 ChildIndex = 0; ChildIndex < PropertyCount; ChildIndex++)
|
||||
{
|
||||
IPropertyNew *pProperty = pStruct->ChildByIndex(ChildIndex);
|
||||
IProperty *pProperty = pStruct->ChildByIndex(ChildIndex);
|
||||
|
||||
//@todo version check
|
||||
if (pProperty->CookPreference() != ECookPreferenceNew::Never)
|
||||
if (pProperty->CookPreference() != ECookPreference::Never)
|
||||
ReadProperty(pProperty, 0, rSCLY);
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ CScriptObject* CScriptLoader::LoadObjectMP1(IInputStream& rSCLY)
|
|||
}
|
||||
|
||||
// Load object...
|
||||
CStructPropertyNew* pProperties = pTemplate->Properties();
|
||||
CStructProperty* pProperties = pTemplate->Properties();
|
||||
LoadStructMP1(rSCLY, pProperties);
|
||||
|
||||
// Cleanup and return
|
||||
|
@ -339,7 +339,7 @@ CScriptLayer* CScriptLoader::LoadLayerMP1(IInputStream& rSCLY)
|
|||
return mpLayer;
|
||||
}
|
||||
|
||||
void CScriptLoader::LoadStructMP2(IInputStream& rSCLY, CStructPropertyNew* pStruct)
|
||||
void CScriptLoader::LoadStructMP2(IInputStream& rSCLY, CStructProperty* pStruct)
|
||||
{
|
||||
// Verify property count
|
||||
u32 ChildCount = pStruct->NumChildren();
|
||||
|
@ -350,7 +350,7 @@ void CScriptLoader::LoadStructMP2(IInputStream& rSCLY, CStructPropertyNew* pStru
|
|||
// Parse properties
|
||||
for (u32 ChildIdx = 0; ChildIdx < ChildCount; ChildIdx++)
|
||||
{
|
||||
IPropertyNew* pProperty = nullptr;
|
||||
IProperty* pProperty = nullptr;
|
||||
u32 PropertyStart = rSCLY.Tell();
|
||||
u32 PropertyID = -1;
|
||||
u16 PropertySize = 0;
|
||||
|
|
|
@ -19,13 +19,13 @@ class CScriptLoader
|
|||
void* mpArrayItemData;
|
||||
|
||||
CScriptLoader();
|
||||
void ReadProperty(IPropertyNew* pProp, u32 Size, IInputStream& rSCLY);
|
||||
void ReadProperty(IProperty* pProp, u32 Size, IInputStream& rSCLY);
|
||||
|
||||
void LoadStructMP1(IInputStream& rSCLY, CStructPropertyNew* pStruct);
|
||||
void LoadStructMP1(IInputStream& rSCLY, CStructProperty* pStruct);
|
||||
CScriptObject* LoadObjectMP1(IInputStream& rSCLY);
|
||||
CScriptLayer* LoadLayerMP1(IInputStream& rSCLY);
|
||||
|
||||
void LoadStructMP2(IInputStream& rSCLY, CStructPropertyNew* pStruct);
|
||||
void LoadStructMP2(IInputStream& rSCLY, CStructProperty* pStruct);
|
||||
CScriptObject* LoadObjectMP2(IInputStream& rSCLY);
|
||||
CScriptLayer* LoadLayerMP2(IInputStream& rSCLY);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "CTemplateLoader.h"
|
||||
#include "CAreaLoader.h"
|
||||
#include "Core/Resource/Script/IPropertyTemplate.h"
|
||||
#include "Core/Resource/Script/Property/Properties.h"
|
||||
#include <Common/FileUtil.h>
|
||||
#include <Common/Log.h>
|
||||
|
@ -108,6 +107,28 @@ using namespace tinyxml2;
|
|||
break;\
|
||||
}\
|
||||
|
||||
EPropertyTypeNew PropStringToPropEnum(TString Prop)
|
||||
{
|
||||
Prop = Prop.ToLower();
|
||||
if (Prop == "bool") return EPropertyTypeNew::Bool;
|
||||
if (Prop == "byte") return EPropertyTypeNew::Byte;
|
||||
if (Prop == "short") return EPropertyTypeNew::Short;
|
||||
if (Prop == "long") return EPropertyTypeNew::Int;
|
||||
if (Prop == "enum") return EPropertyTypeNew::Enum;
|
||||
if (Prop == "bitfield") return EPropertyTypeNew::Flags;
|
||||
if (Prop == "float") return EPropertyTypeNew::Float;
|
||||
if (Prop == "string") return EPropertyTypeNew::String;
|
||||
if (Prop == "color") return EPropertyTypeNew::Color;
|
||||
if (Prop == "vector3f") return EPropertyTypeNew::Vector;
|
||||
if (Prop == "sound") return EPropertyTypeNew::Sound;
|
||||
if (Prop == "asset") return EPropertyTypeNew::Asset;
|
||||
if (Prop == "struct") return EPropertyTypeNew::Struct;
|
||||
if (Prop == "array") return EPropertyTypeNew::Array;
|
||||
if (Prop == "character") return EPropertyTypeNew::AnimationSet;
|
||||
if (Prop == "mayaspline") return EPropertyTypeNew::Spline;
|
||||
return EPropertyTypeNew::Invalid;
|
||||
}
|
||||
|
||||
IPropertyNew* CTemplateLoader::LoadProperty(XMLElement* pElem, CScriptTemplate* pScript, CStructPropertyNew* pParent, const TString& rkTemplateName)
|
||||
{
|
||||
TString NodeType = TString(pElem->Name()).ToLower();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||
#include "Core/Resource/Script/CScriptTemplate.h"
|
||||
#include "Core/Resource/Script/IPropertyNew.h"
|
||||
#include "Core/Resource/Script/Property/IProperty.h"
|
||||
#include "Core/Resource/Script/Property/CEnumProperty.h"
|
||||
#include "Core/Resource/Script/Property/CFlagsProperty.h"
|
||||
#include <tinyxml2.h>
|
||||
|
|
|
@ -150,7 +150,7 @@ SMessage CMasterTemplate::MessageByIndex(u32 Index)
|
|||
return SMessage(Iter->first, Iter->second);
|
||||
}
|
||||
|
||||
IPropertyNew* CMasterTemplate::FindPropertyArchetype(const TString& kTypeName)
|
||||
IProperty* CMasterTemplate::FindPropertyArchetype(const TString& kTypeName)
|
||||
{
|
||||
auto Iter = mPropertyTemplates.find(kTypeName);
|
||||
|
||||
|
@ -232,7 +232,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(IPropertyNew* pProp)
|
||||
u32 CMasterTemplate::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 +250,7 @@ u32 CMasterTemplate::CreatePropertyID(IPropertyNew* pProp)
|
|||
return Hash.Digest();
|
||||
}
|
||||
|
||||
void CMasterTemplate::AddProperty(IPropertyNew* pProp, const TString& rkTemplateName /*= ""*/)
|
||||
void CMasterTemplate::AddProperty(IProperty* pProp, const TString& rkTemplateName /*= ""*/)
|
||||
{
|
||||
u32 ID;
|
||||
|
||||
|
@ -261,11 +261,11 @@ void CMasterTemplate::AddProperty(IPropertyNew* pProp, const TString& rkTemplate
|
|||
else
|
||||
{
|
||||
// For MP1 we only really need to track properties that come from struct templates.
|
||||
IPropertyNew* pArchetype = pProp->Archetype();
|
||||
IProperty* pArchetype = pProp->Archetype();
|
||||
|
||||
if (!pArchetype ||
|
||||
pArchetype->ScriptTemplate() != nullptr ||
|
||||
pArchetype->RootParent()->Type() != EPropertyTypeNew::Struct)
|
||||
pArchetype->RootParent()->Type() != EPropertyType::Struct)
|
||||
return;
|
||||
|
||||
ID = CreatePropertyID(pProp);
|
||||
|
@ -307,7 +307,7 @@ void CMasterTemplate::AddProperty(IPropertyNew* pProp, const TString& rkTemplate
|
|||
}
|
||||
}
|
||||
|
||||
void CMasterTemplate::RenameProperty(IPropertyNew* pProp, const TString& rkNewName)
|
||||
void CMasterTemplate::RenameProperty(IProperty* pProp, const TString& rkNewName)
|
||||
{
|
||||
u32 ID = pProp->ID();
|
||||
if (ID <= 0xFF) ID = CreatePropertyID(pProp);
|
||||
|
@ -352,7 +352,7 @@ void CMasterTemplate::XMLsUsingID(u32 ID, std::vector<TString>& rOutList)
|
|||
}
|
||||
}
|
||||
|
||||
const std::vector<IPropertyNew*>* CMasterTemplate::TemplatesWithMatchingID(IPropertyNew* pProp)
|
||||
const std::vector<IProperty*>* CMasterTemplate::TemplatesWithMatchingID(IProperty* pProp)
|
||||
{
|
||||
u32 ID = pProp->ID();
|
||||
if (ID <= 0xFF) ID = CreatePropertyID(pProp);
|
||||
|
|
|
@ -84,15 +84,15 @@ class CMasterTemplate
|
|||
TString Path;
|
||||
|
||||
/** Template in memory */
|
||||
std::shared_ptr<IPropertyNew> pTemplate;
|
||||
std::shared_ptr<IProperty> pTemplate;
|
||||
|
||||
/** Constructor */
|
||||
SPropertyTemplatePath()
|
||||
{}
|
||||
|
||||
SPropertyTemplatePath(const TString& kInPath, IPropertyNew* pInTemplate)
|
||||
SPropertyTemplatePath(const TString& kInPath, IProperty* pInTemplate)
|
||||
: Path(kInPath)
|
||||
, pTemplate( std::shared_ptr<IPropertyNew>(pInTemplate) )
|
||||
, pTemplate( std::shared_ptr<IProperty>(pInTemplate) )
|
||||
{}
|
||||
|
||||
/** Serializer */
|
||||
|
@ -117,7 +117,7 @@ class CMasterTemplate
|
|||
struct SPropIDInfo
|
||||
{
|
||||
std::vector<TString> XMLList; // List of script/struct templates that use this ID
|
||||
std::vector<IPropertyNew*> PropertyList; // List of all properties that use this ID
|
||||
std::vector<IProperty*> PropertyList; // List of all properties that use this ID
|
||||
};
|
||||
static std::map<u32, SPropIDInfo> smIDMap;
|
||||
static std::map<EGame, CMasterTemplate*> smMasterMap;
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
SMessage MessageByID(u32 MessageID);
|
||||
SMessage MessageByID(const CFourCC& MessageID);
|
||||
SMessage MessageByIndex(u32 Index);
|
||||
IPropertyNew* FindPropertyArchetype(const TString& kTypeName);
|
||||
IProperty* FindPropertyArchetype(const TString& kTypeName);
|
||||
TString GetGameDirectory(bool Absolute = false) const;
|
||||
|
||||
// Inline Accessors
|
||||
|
@ -159,12 +159,12 @@ public:
|
|||
static TString FindGameName(EGame Game);
|
||||
static EGame FindGameForName(const TString& rkName);
|
||||
static TString PropertyName(u32 PropertyID);
|
||||
static u32 CreatePropertyID(IPropertyNew *pTemp);
|
||||
static void AddProperty(IPropertyNew *pTemp, const TString& rkTemplateName = "");
|
||||
static void RenameProperty(IPropertyNew *pTemp, const TString& rkNewName);
|
||||
static u32 CreatePropertyID(IProperty *pTemp);
|
||||
static void AddProperty(IProperty *pTemp, const TString& rkTemplateName = "");
|
||||
static void RenameProperty(IProperty *pTemp, const TString& rkNewName);
|
||||
static void RenameProperty(u32 ID, const TString& rkNewName);
|
||||
static void XMLsUsingID(u32 ID, std::vector<TString>& rOutList);
|
||||
static const std::vector<IPropertyNew*>* TemplatesWithMatchingID(IPropertyNew *pTemp);
|
||||
static const std::vector<IProperty*>* TemplatesWithMatchingID(IProperty *pTemp);
|
||||
};
|
||||
|
||||
#endif // CMASTERTEMPLATE_H
|
||||
|
|
|
@ -15,7 +15,7 @@ CScriptObject::CScriptObject(u32 InstanceID, CGameArea *pArea, CScriptLayer *pLa
|
|||
mpTemplate->AddObject(this);
|
||||
|
||||
// Init properties
|
||||
CStructPropertyNew* pProperties = pTemplate->Properties();
|
||||
CStructProperty* pProperties = pTemplate->Properties();
|
||||
u32 PropertiesSize = pProperties->DataSize();
|
||||
|
||||
mPropertyData.resize( PropertiesSize );
|
||||
|
@ -82,7 +82,7 @@ void CScriptObject::EvaluateVolume()
|
|||
mVolumeScale = mpTemplate->VolumeScale(this);
|
||||
}
|
||||
|
||||
bool CScriptObject::IsEditorProperty(IPropertyNew *pProp)
|
||||
bool CScriptObject::IsEditorProperty(IProperty *pProp)
|
||||
{
|
||||
return ( (pProp == mInstanceName.Property()) ||
|
||||
(pProp == mPosition.Property()) ||
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
void EvaluateDisplayAsset();
|
||||
void EvaluateCollisionModel();
|
||||
void EvaluateVolume();
|
||||
bool IsEditorProperty(IPropertyNew *pProp);
|
||||
bool IsEditorProperty(IProperty *pProp);
|
||||
void SetLayer(CScriptLayer *pLayer, u32 NewLayerIndex = -1);
|
||||
u32 LayerIndex() const;
|
||||
bool HasNearVisibleActivation() const;
|
||||
|
|
|
@ -86,7 +86,7 @@ void CScriptTemplate::PostLoad()
|
|||
if (!mRotationIDString.IsEmpty()) mpRotationProperty = TPropCast<CVectorProperty>( mpProperties->ChildByIDString(mRotationIDString) );
|
||||
if (!mScaleIDString.IsEmpty()) mpScaleProperty = TPropCast<CVectorProperty>( mpProperties->ChildByIDString(mScaleIDString) );
|
||||
if (!mActiveIDString.IsEmpty()) mpActiveProperty = TPropCast<CBoolProperty>( mpProperties->ChildByIDString(mActiveIDString) );
|
||||
if (!mLightParametersIDString.IsEmpty()) mpLightParametersProperty = TPropCast<CStructPropertyNew>( mpProperties->ChildByIDString(mLightParametersIDString) );
|
||||
if (!mLightParametersIDString.IsEmpty()) mpLightParametersProperty = TPropCast<CStructProperty>( mpProperties->ChildByIDString(mLightParametersIDString) );
|
||||
}
|
||||
|
||||
EGame CScriptTemplate::Game() const
|
||||
|
@ -96,10 +96,10 @@ EGame CScriptTemplate::Game() const
|
|||
|
||||
// ************ PROPERTY FETCHING ************
|
||||
template<class PropType>
|
||||
PropType* TFetchProperty(CStructPropertyNew* pProperties, const TIDString& rkID)
|
||||
PropType* TFetchProperty(CStructProperty* pProperties, const TIDString& rkID)
|
||||
{
|
||||
if (rkID.IsEmpty()) return nullptr;
|
||||
IPropertyNew *pProp = pProperties->ChildByIDString(rkID);
|
||||
IProperty *pProp = pProperties->ChildByIDString(rkID);
|
||||
|
||||
if (pProp && (pProp->Type() == PropEnum))
|
||||
return static_cast<PropType*>(pProp)->ValuePtr();
|
||||
|
@ -147,7 +147,7 @@ s32 CScriptTemplate::CheckVolumeConditions(CScriptObject *pObj, bool LogErrors)
|
|||
if (mVolumeShape == eConditionalShape)
|
||||
{
|
||||
TIDString PropID = mVolumeConditionIDString;
|
||||
IPropertyNew* pProp = pObj->Template()->Properties()->ChildByIDString( PropID );
|
||||
IProperty* pProp = pObj->Template()->Properties()->ChildByIDString( PropID );
|
||||
|
||||
// Get value of the condition test property (only boolean, integral, and enum types supported)
|
||||
void* pData = pObj->PropertyData();
|
||||
|
@ -155,24 +155,24 @@ s32 CScriptTemplate::CheckVolumeConditions(CScriptObject *pObj, bool LogErrors)
|
|||
|
||||
switch (pProp->Type())
|
||||
{
|
||||
case EPropertyTypeNew::Bool:
|
||||
case EPropertyType::Bool:
|
||||
Val = TPropCast<CBoolProperty>(pProp)->Value(pData) ? 1 : 0;
|
||||
break;
|
||||
|
||||
case EPropertyTypeNew::Byte:
|
||||
case EPropertyType::Byte:
|
||||
Val = (int) TPropCast<CByteProperty>(pProp)->Value(pData);
|
||||
break;
|
||||
|
||||
case EPropertyTypeNew::Short:
|
||||
case EPropertyType::Short:
|
||||
Val = (int) TPropCast<CShortProperty>(pProp)->Value(pData);
|
||||
break;
|
||||
|
||||
case EPropertyTypeNew::Int:
|
||||
case EPropertyType::Int:
|
||||
Val = TPropCast<CIntProperty>(pProp)->Value(pData);
|
||||
break;
|
||||
|
||||
case EPropertyTypeNew::Enum:
|
||||
case EPropertyTypeNew::Choice:
|
||||
case EPropertyType::Enum:
|
||||
case EPropertyType::Choice:
|
||||
Val = TPropCast<CEnumProperty>(pProp)->Value(pData);
|
||||
break;
|
||||
}
|
||||
|
@ -209,9 +209,9 @@ CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, u32& rOutCharI
|
|||
// Property
|
||||
else
|
||||
{
|
||||
IPropertyNew* pProp = mpProperties->ChildByIDString(it->AssetLocation);
|
||||
IProperty* pProp = mpProperties->ChildByIDString(it->AssetLocation);
|
||||
|
||||
if (it->AssetType == SEditorAsset::eAnimParams && pProp->Type() == EPropertyTypeNew::AnimationSet)
|
||||
if (it->AssetType == SEditorAsset::eAnimParams && pProp->Type() == EPropertyType::AnimationSet)
|
||||
{
|
||||
CAnimationSetProperty* pAnimSet = TPropCast<CAnimationSetProperty>(pProp);
|
||||
CAnimationParameters Params = pAnimSet->Value(pPropertyData);
|
||||
|
@ -227,7 +227,7 @@ CResource* CScriptTemplate::FindDisplayAsset(void* pPropertyData, u32& rOutCharI
|
|||
|
||||
else
|
||||
{
|
||||
ASSERT(pProp->Type() == EPropertyTypeNew::Asset);
|
||||
ASSERT(pProp->Type() == EPropertyType::Asset);
|
||||
CAssetProperty* pAsset = TPropCast<CAssetProperty>(pProp);
|
||||
CAssetID ID = pAsset->Value(pPropertyData);
|
||||
CResourceEntry *pEntry = gpResourceStore->FindEntry( ID );
|
||||
|
@ -261,9 +261,9 @@ CCollisionMeshGroup* CScriptTemplate::FindCollision(void* pPropertyData)
|
|||
// Property
|
||||
else
|
||||
{
|
||||
IPropertyNew* pProp = mpProperties->ChildByIDString(it->AssetLocation);
|
||||
IProperty* pProp = mpProperties->ChildByIDString(it->AssetLocation);
|
||||
|
||||
if (pProp->Type() == EPropertyTypeNew::Asset)
|
||||
if (pProp->Type() == EPropertyType::Asset)
|
||||
{
|
||||
CAssetProperty* pAsset = TPropCast<CAssetProperty>(pProp);
|
||||
pRes = gpResourceStore->LoadResource( pAsset->Value(pPropertyData), eDynamicCollision );
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define CSCRIPTTEMPLATE_H
|
||||
|
||||
#include "Core/Resource/Script/Property/Properties.h"
|
||||
#include "EPropertyType.h"
|
||||
#include "EVolumeShape.h"
|
||||
#include "Core/Resource/Model/CModel.h"
|
||||
#include "Core/Resource/CCollisionMeshGroup.h"
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
#ifndef EPROPERTYTYPE
|
||||
#define EPROPERTYTYPE
|
||||
|
||||
#include "IPropertyNew.h"
|
||||
|
||||
#if 0
|
||||
#include <Common/TString.h>
|
||||
|
||||
enum EPropertyType
|
||||
{
|
||||
eBoolProperty,
|
||||
eByteProperty,
|
||||
eShortProperty,
|
||||
eLongProperty,
|
||||
eEnumProperty,
|
||||
eBitfieldProperty,
|
||||
eFloatProperty,
|
||||
eStringProperty,
|
||||
eVector3Property,
|
||||
eColorProperty,
|
||||
eSoundProperty,
|
||||
eAssetProperty,
|
||||
eStructProperty,
|
||||
eArrayProperty,
|
||||
eCharacterProperty,
|
||||
eMayaSplineProperty,
|
||||
eUnknownProperty,
|
||||
eInvalidProperty
|
||||
};
|
||||
#endif
|
||||
|
||||
// functions defined in IPropertyTemplate.cpp
|
||||
EPropertyTypeNew PropStringToPropEnum(TString Prop);
|
||||
TString PropEnumToPropString(EPropertyTypeNew Prop);
|
||||
const char* HashablePropTypeName(EPropertyTypeNew Prop);
|
||||
|
||||
#endif // EPROPERTYTYPE
|
||||
|
|
@ -1,245 +0,0 @@
|
|||
#include "IProperty.h"
|
||||
#include "IPropertyTemplate.h"
|
||||
|
||||
#if 0
|
||||
// ************ IProperty ************
|
||||
bool IProperty::IsInArray() const
|
||||
{
|
||||
CPropertyStruct *pParent = mpParent;
|
||||
|
||||
while (pParent)
|
||||
{
|
||||
if (pParent->Type() == eArrayProperty) return true;
|
||||
pParent = pParent->Parent();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CPropertyStruct* IProperty::RootStruct()
|
||||
{
|
||||
return (mpParent ? mpParent->RootStruct() : Type() == eStructProperty ? static_cast<CPropertyStruct*>(this) : nullptr);
|
||||
}
|
||||
|
||||
IPropertyTemplate* IProperty::Template() const
|
||||
{
|
||||
return mpTemplate;
|
||||
}
|
||||
|
||||
TString IProperty::Name() const
|
||||
{
|
||||
return mpTemplate->Name();
|
||||
}
|
||||
|
||||
u32 IProperty::ID() const
|
||||
{
|
||||
if (mpParent && mpParent->Type() == eArrayProperty)
|
||||
return ArrayIndex();
|
||||
else
|
||||
return mpTemplate->PropertyID();
|
||||
}
|
||||
|
||||
TIDString IProperty::IDString(bool FullPath) const
|
||||
{
|
||||
TIDString Out;
|
||||
|
||||
if (ID() != 0xFFFFFFFF)
|
||||
{
|
||||
if (mpParent && FullPath)
|
||||
{
|
||||
Out = mpParent->IDString(true);
|
||||
if (!Out.IsEmpty()) Out += ":";
|
||||
}
|
||||
|
||||
Out += TString::HexString(ID());
|
||||
}
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
u32 IProperty::ArrayIndex() const
|
||||
{
|
||||
CArrayProperty *pArray = TPropCast<CArrayProperty>(mpParent);
|
||||
|
||||
if (pArray)
|
||||
{
|
||||
for (u32 iSub = 0; iSub < pArray->Count(); iSub++)
|
||||
{
|
||||
if (pArray->PropertyByIndex(iSub) == this)
|
||||
return iSub;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool IProperty::ShouldCook()
|
||||
{
|
||||
if (mpTemplate->CookPreference() == eNeverCook) return false;
|
||||
else if (mpTemplate->CookPreference() == eAlwaysCook) return true;
|
||||
|
||||
else
|
||||
{
|
||||
if (mpTemplate->Game() == eReturns)
|
||||
return !MatchesDefault();
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool IProperty::MatchesDefault()
|
||||
{
|
||||
const IPropertyValue *pkValue = RawValue();
|
||||
const IPropertyValue *pkDefault = mpTemplate->RawDefaultValue();
|
||||
if (!pkValue || !pkDefault) return false;
|
||||
else return pkValue->Matches(pkDefault);
|
||||
}
|
||||
|
||||
// ************ TAssetProperty ************
|
||||
TAssetProperty::TAssetProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
: TTypedProperty(pTemp, pInstance, pParent, CAssetID::InvalidID( pTemp->Game() ))
|
||||
{
|
||||
}
|
||||
|
||||
// ************ CPropertyStruct ************
|
||||
void CPropertyStruct::Copy(const IProperty *pkProp)
|
||||
{
|
||||
const CPropertyStruct *pkSource = static_cast<const CPropertyStruct*>(pkProp);
|
||||
|
||||
for (u32 iSub = 0; iSub < mProperties.size(); iSub++)
|
||||
mProperties[iSub]->Copy(pkSource->mProperties[iSub]);
|
||||
}
|
||||
|
||||
bool CPropertyStruct::ShouldCook()
|
||||
{
|
||||
if (mpTemplate->CookPreference() == eNeverCook) return false;
|
||||
|
||||
for (u32 iProp = 0; iProp < mProperties.size(); iProp++)
|
||||
{
|
||||
if (mProperties[iProp]->ShouldCook())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
IProperty* CPropertyStruct::PropertyByIndex(u32 index) const
|
||||
{
|
||||
return mProperties[index];
|
||||
}
|
||||
|
||||
IProperty* CPropertyStruct::PropertyByID(u32 ID) const
|
||||
{
|
||||
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
|
||||
{
|
||||
if ((*it)->ID() == ID)
|
||||
return *it;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IProperty* CPropertyStruct::PropertyByIDString(const TIDString& rkStr) const
|
||||
{
|
||||
// Resolve namespace
|
||||
u32 NSStart = rkStr.IndexOf(":");
|
||||
|
||||
// String has namespace; the requested property is within a struct
|
||||
if (NSStart != -1)
|
||||
{
|
||||
TString StrStructID = rkStr.Truncate(NSStart);
|
||||
if (!StrStructID.IsHexString()) return nullptr;
|
||||
|
||||
u32 StructID = StrStructID.ToInt32();
|
||||
TString PropName = rkStr.ChopFront(NSStart + 1);
|
||||
|
||||
CPropertyStruct *pStruct = StructByID(StructID);
|
||||
if (!pStruct) return nullptr;
|
||||
else return pStruct->PropertyByIDString(PropName);
|
||||
}
|
||||
|
||||
// No namespace; fetch the property from this struct
|
||||
else
|
||||
{
|
||||
if (rkStr.IsHexString())
|
||||
return PropertyByID(rkStr.ToInt32());
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
CPropertyStruct* CPropertyStruct::StructByIndex(u32 index) const
|
||||
{
|
||||
IProperty *pProp = PropertyByIndex(index);
|
||||
|
||||
if (pProp->Type() == eStructProperty || pProp->Type() == eArrayProperty)
|
||||
return static_cast<CPropertyStruct*>(pProp);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CPropertyStruct* CPropertyStruct::StructByID(u32 ID) const
|
||||
{
|
||||
IProperty *pProp = PropertyByID(ID);
|
||||
|
||||
if (pProp->Type() == eStructProperty || pProp->Type() == eArrayProperty)
|
||||
return static_cast<CPropertyStruct*>(pProp);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CPropertyStruct* CPropertyStruct::StructByIDString(const TIDString& rkStr) const
|
||||
{
|
||||
IProperty *pProp = PropertyByIDString(rkStr);
|
||||
|
||||
if (pProp->Type() == eStructProperty || pProp->Type() == eArrayProperty)
|
||||
return static_cast<CPropertyStruct*>(pProp);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ************ CArrayProperty ************
|
||||
void CArrayProperty::Copy(const IProperty *pkProp)
|
||||
{
|
||||
const CArrayProperty *pkSource = static_cast<const CArrayProperty*>(pkProp);
|
||||
Resize(pkSource->Count());
|
||||
|
||||
for (u32 iSub = 0; iSub < mProperties.size(); iSub++)
|
||||
mProperties[iSub]->Copy(pkSource->mProperties[iSub]);
|
||||
}
|
||||
|
||||
bool CArrayProperty::ShouldCook()
|
||||
{
|
||||
return (mpTemplate->CookPreference() == eNeverCook ? false : true);
|
||||
}
|
||||
|
||||
void CArrayProperty::Resize(int Size)
|
||||
{
|
||||
int OldSize = mProperties.size();
|
||||
if (OldSize == Size) return;
|
||||
|
||||
if (Size < OldSize)
|
||||
{
|
||||
for (int iProp = mProperties.size() - 1; iProp >= Size; iProp--)
|
||||
delete mProperties[iProp];
|
||||
}
|
||||
|
||||
mProperties.resize(Size);
|
||||
|
||||
if (Size > OldSize)
|
||||
{
|
||||
for (int iProp = OldSize; iProp < Size; iProp++)
|
||||
mProperties[iProp] = static_cast<CArrayTemplate*>(mpTemplate)->CreateSubStruct(Instance(), this);
|
||||
}
|
||||
}
|
||||
|
||||
CStructTemplate* CArrayProperty::SubStructTemplate() const
|
||||
{
|
||||
// CArrayTemplate inherits from CStructTemplate. The template defines the substruct structure.
|
||||
return static_cast<CStructTemplate*>(Template());
|
||||
}
|
||||
|
||||
TString CArrayProperty::ElementName() const
|
||||
{
|
||||
return static_cast<CArrayTemplate*>(Template())->ElementName();
|
||||
}
|
||||
#endif
|
|
@ -1,303 +0,0 @@
|
|||
#ifndef IPROPERTY
|
||||
#define IPROPERTY
|
||||
|
||||
#if 0
|
||||
#include "EPropertyType.h"
|
||||
#include "IPropertyValue.h"
|
||||
#include "Core/Resource/CResource.h"
|
||||
#include "Core/Resource/TResPtr.h"
|
||||
#include "Core/Resource/Animation/CAnimationParameters.h"
|
||||
#include <Common/CColor.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <list>
|
||||
|
||||
class CScriptObject;
|
||||
class CScriptTemplate;
|
||||
class CStructTemplate;
|
||||
class IPropertyTemplate;
|
||||
typedef TString TIDString;
|
||||
|
||||
/*
|
||||
* IProperty is the base class, containing just some virtual function definitions
|
||||
*/
|
||||
class IProperty
|
||||
{
|
||||
protected:
|
||||
class CPropertyStruct *mpParent;
|
||||
CScriptObject *mpInstance;
|
||||
IPropertyTemplate *mpTemplate;
|
||||
|
||||
public:
|
||||
IProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
: mpParent(pParent)
|
||||
, mpInstance(pInstance)
|
||||
, mpTemplate(pTemp)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~IProperty() {}
|
||||
virtual EPropertyType Type() const = 0;
|
||||
virtual TString ToString() const { return ""; }
|
||||
virtual IPropertyValue* RawValue() { return nullptr; }
|
||||
virtual void Copy(const IProperty *pkProp) = 0;
|
||||
virtual IProperty* Clone(CScriptObject *pInstance, CPropertyStruct *pParent = 0) const = 0;
|
||||
virtual bool Matches(const IProperty *pkProp) const = 0;
|
||||
|
||||
virtual bool ShouldCook(); // Can't be const because it calls MatchesDefault()
|
||||
virtual bool MatchesDefault(); // Can't be const because RawValue() isn't const
|
||||
|
||||
inline CScriptObject* Instance() const { return mpInstance; }
|
||||
inline CPropertyStruct* Parent() const { return mpParent; }
|
||||
inline void SetParent(CPropertyStruct *pParent) { mpParent = pParent; }
|
||||
|
||||
bool IsInArray() const;
|
||||
CPropertyStruct* RootStruct();
|
||||
|
||||
// These functions can't be in the header to avoid circular includes with IPropertyTemplate.h
|
||||
IPropertyTemplate* Template() const;
|
||||
TString Name() const;
|
||||
u32 ID() const;
|
||||
TIDString IDString(bool FullPath) const;
|
||||
u32 ArrayIndex() const;
|
||||
};
|
||||
|
||||
/*
|
||||
* TTypedProperty is a template subclass for actual properties.
|
||||
*/
|
||||
#define IMPLEMENT_PROPERTY_CLONE(ClassName) \
|
||||
virtual IProperty* Clone(CScriptObject *pInstance, CPropertyStruct *pParent) const \
|
||||
{ \
|
||||
if (!pParent) pParent = mpParent; \
|
||||
ClassName *pOut = new ClassName(mpTemplate, pInstance, pParent); \
|
||||
pOut->Copy(this); \
|
||||
return pOut; \
|
||||
}
|
||||
|
||||
template <typename ValueType, EPropertyType TypeEnum, class ValueClass>
|
||||
class TTypedProperty : public IProperty
|
||||
{
|
||||
ValueClass mValue;
|
||||
public:
|
||||
TTypedProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
: IProperty(pTemp, pInstance, pParent) {}
|
||||
|
||||
TTypedProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent, ValueType v)
|
||||
: IProperty(pTemp, pInstance, pParent), mValue(v) {}
|
||||
|
||||
~TTypedProperty() {}
|
||||
virtual EPropertyType Type() const { return TypeEnum; }
|
||||
static inline EPropertyType StaticType() { return TypeEnum; }
|
||||
|
||||
virtual TString ToString() const { return mValue.ToString(); }
|
||||
virtual IPropertyValue* RawValue() { return &mValue; }
|
||||
|
||||
virtual void Copy(const IProperty *pkProp)
|
||||
{
|
||||
const TTypedProperty *pkCast = static_cast<const TTypedProperty*>(pkProp);
|
||||
mValue.Set(pkCast->mValue.Get());
|
||||
}
|
||||
|
||||
IMPLEMENT_PROPERTY_CLONE(TTypedProperty)
|
||||
|
||||
virtual bool Matches(const IProperty *pkProp) const
|
||||
{
|
||||
const TTypedProperty *pkTyped = static_cast<const TTypedProperty*>(pkProp);
|
||||
return ( (Type() == pkTyped->Type()) &&
|
||||
mValue.Matches(&pkTyped->mValue) );
|
||||
}
|
||||
|
||||
inline ValueType Get() const { return mValue.Get(); }
|
||||
inline void Set(ValueType v) { mValue.Set(v); }
|
||||
};
|
||||
typedef TTypedProperty<bool, eBoolProperty, CBoolValue> TBoolProperty;
|
||||
typedef TTypedProperty<char, eByteProperty, CByteValue> TByteProperty;
|
||||
typedef TTypedProperty<short, eShortProperty, CShortValue> TShortProperty;
|
||||
typedef TTypedProperty<long, eLongProperty, CLongValue> TLongProperty;
|
||||
typedef TTypedProperty<long, eEnumProperty, CLongValue> TEnumProperty;
|
||||
typedef TTypedProperty<long, eBitfieldProperty, CHexLongValue> TBitfieldProperty;
|
||||
typedef TTypedProperty<float, eFloatProperty, CFloatValue> TFloatProperty;
|
||||
typedef TTypedProperty<CVector3f, eVector3Property, CVector3Value> TVector3Property;
|
||||
typedef TTypedProperty<CColor, eColorProperty, CColorValue> TColorProperty;
|
||||
typedef TTypedProperty<std::vector<u8>, eUnknownProperty, CUnknownValue> TUnknownProperty;
|
||||
|
||||
/*
|
||||
* TStringProperty, TSoundProperty, TAssetProperty, and TCharacterProperty get little subclasses in order to override some virtual functions.
|
||||
*/
|
||||
#define IMPLEMENT_PROPERTY_CTORS(ClassName, ValueType) \
|
||||
ClassName(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent) \
|
||||
: TTypedProperty(pTemp, pInstance, pParent) {} \
|
||||
\
|
||||
ClassName(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent, ValueType v) \
|
||||
: TTypedProperty(pTemp, pInstance, pParent, v) {}
|
||||
|
||||
class TStringProperty : public TTypedProperty<TString, eStringProperty, CStringValue>
|
||||
{
|
||||
public:
|
||||
IMPLEMENT_PROPERTY_CTORS(TStringProperty, TString)
|
||||
IMPLEMENT_PROPERTY_CLONE(TStringProperty)
|
||||
virtual bool MatchesDefault() { return Get().IsEmpty(); }
|
||||
virtual bool ShouldCook() { return true; }
|
||||
};
|
||||
|
||||
class TSoundProperty : public TTypedProperty<u32, eSoundProperty, CSoundValue>
|
||||
{
|
||||
public:
|
||||
IMPLEMENT_PROPERTY_CTORS(TSoundProperty, u32)
|
||||
IMPLEMENT_PROPERTY_CLONE(TSoundProperty)
|
||||
virtual bool MatchesDefault() { return Get() == 0xFFFFFFFF; }
|
||||
};
|
||||
|
||||
class TAssetProperty : public TTypedProperty<CAssetID, eAssetProperty, CAssetValue>
|
||||
{
|
||||
public:
|
||||
TAssetProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent); // Can't be in the header because needs to check the template to set the correct ID length
|
||||
TAssetProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent, CAssetID v)
|
||||
: TTypedProperty(pTemp, pInstance, pParent, v) {}
|
||||
|
||||
IMPLEMENT_PROPERTY_CLONE(TAssetProperty)
|
||||
virtual bool MatchesDefault() { return !Get().IsValid(); }
|
||||
virtual bool ShouldCook() { return true; }
|
||||
};
|
||||
|
||||
class TCharacterProperty : public TTypedProperty<CAnimationParameters, eCharacterProperty, CCharacterValue>
|
||||
{
|
||||
public:
|
||||
IMPLEMENT_PROPERTY_CTORS(TCharacterProperty, CAnimationParameters)
|
||||
IMPLEMENT_PROPERTY_CLONE(TCharacterProperty)
|
||||
virtual bool MatchesDefault() { return Get().AnimSet() == nullptr; }
|
||||
virtual bool ShouldCook() { return true; }
|
||||
};
|
||||
|
||||
class TMayaSplineProperty : public TTypedProperty<std::vector<u8>, eMayaSplineProperty, CMayaSplineValue>
|
||||
{
|
||||
public:
|
||||
IMPLEMENT_PROPERTY_CTORS(TMayaSplineProperty, std::vector<u8>)
|
||||
IMPLEMENT_PROPERTY_CLONE(TMayaSplineProperty)
|
||||
virtual bool MatchesDefault() { return Get().empty(); }
|
||||
};
|
||||
|
||||
/*
|
||||
* CPropertyStruct is for defining structs of properties.
|
||||
*/
|
||||
class CPropertyStruct : public IProperty
|
||||
{
|
||||
friend class CScriptLoader;
|
||||
protected:
|
||||
std::vector<IProperty*> mProperties;
|
||||
public:
|
||||
CPropertyStruct(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
: IProperty(pTemp, pInstance, pParent) {}
|
||||
|
||||
~CPropertyStruct()
|
||||
{
|
||||
for (auto it = mProperties.begin(); it != mProperties.end(); it++)
|
||||
delete *it;
|
||||
}
|
||||
|
||||
EPropertyType Type() const { return eStructProperty; }
|
||||
static inline EPropertyType StaticType() { return eStructProperty; }
|
||||
|
||||
virtual void Copy(const IProperty *pkProp);
|
||||
|
||||
virtual IProperty* Clone(CScriptObject *pInstance, CPropertyStruct *pParent) const
|
||||
{
|
||||
if (!pParent) pParent = mpParent;
|
||||
CPropertyStruct *pOut = new CPropertyStruct(mpTemplate, pInstance, pParent);
|
||||
pOut->Copy(this);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
virtual bool Matches(const IProperty *pkProp) const
|
||||
{
|
||||
const CPropertyStruct *pkStruct = static_cast<const CPropertyStruct*>(pkProp);
|
||||
|
||||
if ( (Type() == pkStruct->Type()) &&
|
||||
(mProperties.size() == pkStruct->mProperties.size()) )
|
||||
{
|
||||
for (u32 iProp = 0; iProp < mProperties.size(); iProp++)
|
||||
{
|
||||
if (!mProperties[iProp]->Matches(pkStruct->mProperties[iProp]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool MatchesDefault()
|
||||
{
|
||||
for (u32 iProp = 0; iProp < mProperties.size(); iProp++)
|
||||
{
|
||||
if (!mProperties[iProp]->MatchesDefault())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool ShouldCook();
|
||||
|
||||
// Inline
|
||||
inline u32 Count() const { return mProperties.size(); }
|
||||
inline void AddSubProperty(IProperty *pProp) { mProperties.push_back(pProp); }
|
||||
inline IProperty* operator[](u32 index) { return mProperties[index]; }
|
||||
|
||||
// Functions
|
||||
IProperty* PropertyByIndex(u32 index) const;
|
||||
IProperty* PropertyByID(u32 ID) const;
|
||||
IProperty* PropertyByIDString(const TIDString& rkStr) const;
|
||||
CPropertyStruct* StructByIndex(u32 index) const;
|
||||
CPropertyStruct* StructByID(u32 ID) const;
|
||||
CPropertyStruct* StructByIDString(const TIDString& rkStr) const;
|
||||
};
|
||||
|
||||
/*
|
||||
* CArrayProperty stores a repeated property struct.
|
||||
*/
|
||||
class CArrayProperty : public CPropertyStruct
|
||||
{
|
||||
friend class CScriptLoader;
|
||||
|
||||
public:
|
||||
CArrayProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
: CPropertyStruct(pTemp, pInstance, pParent) {}
|
||||
|
||||
EPropertyType Type() const { return eArrayProperty; }
|
||||
static inline EPropertyType StaticType() { return eArrayProperty; }
|
||||
|
||||
virtual void Copy(const IProperty *pkProp);
|
||||
|
||||
virtual IProperty* Clone(CScriptObject *pInstance, CPropertyStruct *pParent) const
|
||||
{
|
||||
if (!pParent) pParent = mpParent;
|
||||
CArrayProperty *pOut = new CArrayProperty(mpTemplate, pInstance, pParent);
|
||||
pOut->Copy(this);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
virtual bool MatchesDefault() { return mProperties.empty(); }
|
||||
virtual bool ShouldCook();
|
||||
|
||||
// Inline
|
||||
inline void Reserve(u32 amount) { mProperties.reserve(amount); }
|
||||
|
||||
// Functions
|
||||
void Resize(int Size);
|
||||
CStructTemplate* SubStructTemplate() const;
|
||||
TString ElementName() const;
|
||||
};
|
||||
|
||||
/*
|
||||
* Function for casting properties. Returns null if the property is not actually the requested type.
|
||||
*/
|
||||
template <class PropertyClass>
|
||||
PropertyClass* TPropCast(IProperty *pProp)
|
||||
{
|
||||
return (pProp && pProp->Type() == PropertyClass::StaticType() ? static_cast<PropertyClass*>(pProp) : nullptr);
|
||||
}
|
||||
#endif
|
||||
#endif // IPROPERTY
|
||||
|
|
@ -1,346 +0,0 @@
|
|||
#include "IPropertyTemplate.h"
|
||||
#include "CMasterTemplate.h"
|
||||
#include <Common/Hash/CCRC32.h>
|
||||
#include <iostream>
|
||||
|
||||
#if 0
|
||||
// ************ IPropertyTemplate ************
|
||||
EGame IPropertyTemplate::Game() const
|
||||
{
|
||||
return (mpMasterTemplate ? mpMasterTemplate->Game() : eUnknownGame);
|
||||
}
|
||||
|
||||
bool IPropertyTemplate::IsInVersion(u32 Version) const
|
||||
{
|
||||
if (mAllowedVersions.empty())
|
||||
return true;
|
||||
|
||||
for (u32 iVer = 0; iVer < mAllowedVersions.size(); iVer++)
|
||||
if (mAllowedVersions[iVer] == Version)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
TString IPropertyTemplate::FullName() const
|
||||
{
|
||||
return mpParent ? mpParent->FullName() + "::" + Name() : Name();
|
||||
}
|
||||
|
||||
TIDString IPropertyTemplate::IDString(bool FullPath) const
|
||||
{
|
||||
if (mID != 0xFFFFFFFF)
|
||||
{
|
||||
TIDString Out;
|
||||
|
||||
if (mpParent && FullPath)
|
||||
{
|
||||
Out = mpParent->IDString(true);
|
||||
if (!Out.IsEmpty()) Out += ":";
|
||||
}
|
||||
|
||||
Out += TIDString::HexString(mID);
|
||||
return Out;
|
||||
}
|
||||
else return "";
|
||||
}
|
||||
|
||||
bool IPropertyTemplate::IsDescendantOf(const CStructTemplate *pStruct) const
|
||||
{
|
||||
CStructTemplate *pParent = mpParent;
|
||||
|
||||
while (pParent)
|
||||
{
|
||||
if (pParent == pStruct) return true;
|
||||
pParent = pParent->Parent();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IPropertyTemplate::IsFromStructTemplate() const
|
||||
{
|
||||
const CStructTemplate *pParent = Parent();
|
||||
|
||||
while (pParent)
|
||||
{
|
||||
if (!pParent->SourceFile().IsEmpty()) return true;
|
||||
pParent = pParent->Parent();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IPropertyTemplate::IsNameCorrect() const
|
||||
{
|
||||
// Check whether the property name is correct... i.e., if we hash it, does it match the property ID?
|
||||
// Only valid for Prime 2 and up, since Prime 1 doesn't have real property IDs, so we can't validate names
|
||||
if (Game() >= eEchoesDemo)
|
||||
{
|
||||
// Don't hash for single-property structs
|
||||
if ( (!Parent() || !Parent()->IsSingleProperty()) &&
|
||||
// Don't hash for the three properties in EditorProperties that have fourCC property IDs
|
||||
mID != FOURCC('INAM') &&
|
||||
mID != FOURCC('XFRM') &&
|
||||
mID != FOURCC('ACTV') )
|
||||
{
|
||||
// Only re-hash if we need to. Save the result (output won't change if function is called multiple times)
|
||||
if (!mHasCachedNameCheck)
|
||||
{
|
||||
// The property ID is just a CRC32 of the property name + the type
|
||||
CCRC32 Hash;
|
||||
Hash.Hash(*mName);
|
||||
Hash.Hash(GetTypeNameString());
|
||||
mCachedNameIsCorrect = Hash.Digest() == mID;
|
||||
mHasCachedNameCheck = true;
|
||||
}
|
||||
return mCachedNameIsCorrect;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TString IPropertyTemplate::FindStructSource() const
|
||||
{
|
||||
const CStructTemplate *pkStruct = mpParent;
|
||||
|
||||
while (pkStruct)
|
||||
{
|
||||
if (!pkStruct->SourceFile().IsEmpty()) return pkStruct->SourceFile();
|
||||
pkStruct = pkStruct->Parent();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
CStructTemplate* IPropertyTemplate::RootStruct()
|
||||
{
|
||||
if (mpParent) return mpParent->RootStruct();
|
||||
else if (Type() == eStructProperty) return static_cast<CStructTemplate*>(this);
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
// ************ CStructTemplate ************
|
||||
void CStructTemplate::CopyStructData(const CStructTemplate *pkStruct)
|
||||
{
|
||||
mVersionPropertyCounts = pkStruct->mVersionPropertyCounts;
|
||||
mIsSingleProperty = pkStruct->mIsSingleProperty;
|
||||
mSourceFile = pkStruct->mSourceFile;
|
||||
mTypeName = pkStruct->mTypeName;
|
||||
|
||||
mSubProperties.resize(pkStruct->mSubProperties.size());
|
||||
|
||||
for (u32 iSub = 0; iSub < pkStruct->mSubProperties.size(); iSub++)
|
||||
{
|
||||
mSubProperties[iSub] = pkStruct->mSubProperties[iSub]->Clone(mpScriptTemplate, this);
|
||||
CMasterTemplate::AddProperty(mSubProperties[iSub]);
|
||||
}
|
||||
}
|
||||
|
||||
u32 CStructTemplate::PropertyCountForVersion(u32 Version)
|
||||
{
|
||||
if (Version == -1) Version = 0;
|
||||
return mVersionPropertyCounts[Version];
|
||||
}
|
||||
|
||||
u32 CStructTemplate::VersionForPropertyCount(u32 PropCount)
|
||||
{
|
||||
for (u32 iVer = 0; iVer < NumVersions(); iVer++)
|
||||
if (mVersionPropertyCounts[iVer] == PropCount)
|
||||
return iVer;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
IPropertyTemplate* CStructTemplate::PropertyByIndex(u32 index)
|
||||
{
|
||||
if (mSubProperties.size() > index)
|
||||
return mSubProperties[index];
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IPropertyTemplate* CStructTemplate::PropertyByID(u32 ID)
|
||||
{
|
||||
for (auto it = mSubProperties.begin(); it != mSubProperties.end(); it++)
|
||||
{
|
||||
if ((*it)->PropertyID() == ID)
|
||||
return *it;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IPropertyTemplate* CStructTemplate::PropertyByIDString(const TIDString& str)
|
||||
{
|
||||
// Resolve namespace
|
||||
u32 nsStart = str.IndexOf(":");
|
||||
u32 propStart = nsStart + 1;
|
||||
|
||||
// String has namespace; the requested property is within a struct
|
||||
if (nsStart != -1)
|
||||
{
|
||||
TString strStructID = str.SubString(0, nsStart);
|
||||
if (!strStructID.IsHexString()) return nullptr;
|
||||
|
||||
u32 structID = strStructID.ToInt32();
|
||||
TString propName = str.SubString(propStart, str.Length() - propStart);
|
||||
|
||||
CStructTemplate *pStruct = StructByID(structID);
|
||||
if (!pStruct) return nullptr;
|
||||
else return pStruct->PropertyByIDString(propName);
|
||||
}
|
||||
|
||||
// No namespace; fetch the property from this struct
|
||||
else
|
||||
{
|
||||
// ID string lookup
|
||||
if (str.IsHexString())
|
||||
return PropertyByID(str.ToInt32());
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
CStructTemplate* CStructTemplate::StructByIndex(u32 index)
|
||||
{
|
||||
IPropertyTemplate *pProp = PropertyByIndex(index);
|
||||
|
||||
if (pProp->Type() == eStructProperty)
|
||||
return static_cast<CStructTemplate*>(pProp);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CStructTemplate* CStructTemplate::StructByID(u32 ID)
|
||||
{
|
||||
IPropertyTemplate *pProp = PropertyByID(ID);
|
||||
|
||||
if (pProp && pProp->Type() == eStructProperty)
|
||||
return static_cast<CStructTemplate*>(pProp);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CStructTemplate* CStructTemplate::StructByIDString(const TString& str)
|
||||
{
|
||||
IPropertyTemplate *pProp = PropertyByIDString(str);
|
||||
|
||||
if (pProp && pProp->Type() == eStructProperty)
|
||||
return static_cast<CStructTemplate*>(pProp);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CStructTemplate::HasProperty(const TIDString& rkIdString)
|
||||
{
|
||||
IPropertyTemplate *pProperty = PropertyByIDString(rkIdString);
|
||||
return (pProperty != nullptr);
|
||||
}
|
||||
|
||||
void CStructTemplate::DetermineVersionPropertyCounts()
|
||||
{
|
||||
for (u32 iVer = 0; iVer < mVersionPropertyCounts.size(); iVer++)
|
||||
{
|
||||
mVersionPropertyCounts[iVer] = 0;
|
||||
|
||||
for (u32 iProp = 0; iProp < mSubProperties.size(); iProp++)
|
||||
{
|
||||
if (mSubProperties[iProp]->IsInVersion(iVer) && mSubProperties[iProp]->CookPreference() != eNeverCook)
|
||||
mVersionPropertyCounts[iVer]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ************ GLOBAL FUNCTIONS ************
|
||||
TString PropEnumToPropString(EPropertyTypeNew Prop)
|
||||
{
|
||||
switch (Prop)
|
||||
{
|
||||
case EPropertyTypeNew::Bool: return "bool";
|
||||
case EPropertyTypeNew::Byte: return "byte";
|
||||
case EPropertyTypeNew::Short: return "short";
|
||||
case EPropertyTypeNew::Int: return "long";
|
||||
case EPropertyTypeNew::Enum: return "enum";
|
||||
case EPropertyTypeNew::Flags: return "bitfield";
|
||||
case EPropertyTypeNew::Float: return "float";
|
||||
case EPropertyTypeNew::String: return "string";
|
||||
case EPropertyTypeNew::Color: return "color";
|
||||
case EPropertyTypeNew::Vector: return "vector3f";
|
||||
case EPropertyTypeNew::Sound: return "sound";
|
||||
case EPropertyTypeNew::Asset: return "asset";
|
||||
case EPropertyTypeNew::Struct: return "struct";
|
||||
case EPropertyTypeNew::Array: return "array";
|
||||
case EPropertyTypeNew::AnimationSet: return "character";
|
||||
case EPropertyTypeNew::Spline: return "MayaSpline";
|
||||
|
||||
default:
|
||||
return "invalid";
|
||||
}
|
||||
}
|
||||
|
||||
EPropertyTypeNew PropStringToPropEnum(TString Prop)
|
||||
{
|
||||
Prop = Prop.ToLower();
|
||||
if (Prop == "bool") return EPropertyTypeNew::Bool;
|
||||
if (Prop == "byte") return EPropertyTypeNew::Byte;
|
||||
if (Prop == "short") return EPropertyTypeNew::Short;
|
||||
if (Prop == "long") return EPropertyTypeNew::Int;
|
||||
if (Prop == "enum") return EPropertyTypeNew::Enum;
|
||||
if (Prop == "bitfield") return EPropertyTypeNew::Flags;
|
||||
if (Prop == "float") return EPropertyTypeNew::Float;
|
||||
if (Prop == "string") return EPropertyTypeNew::String;
|
||||
if (Prop == "color") return EPropertyTypeNew::Color;
|
||||
if (Prop == "vector3f") return EPropertyTypeNew::Vector;
|
||||
if (Prop == "sound") return EPropertyTypeNew::Sound;
|
||||
if (Prop == "asset") return EPropertyTypeNew::Asset;
|
||||
if (Prop == "struct") return EPropertyTypeNew::Struct;
|
||||
if (Prop == "array") return EPropertyTypeNew::Array;
|
||||
if (Prop == "character") return EPropertyTypeNew::AnimationSet;
|
||||
if (Prop == "mayaspline") return EPropertyTypeNew::Spline;
|
||||
return EPropertyTypeNew::Invalid;
|
||||
}
|
||||
|
||||
const char* HashablePropTypeName(EPropertyTypeNew Prop)
|
||||
{
|
||||
// Variants that match Retro's internal type names for generating property IDs. case sensitive
|
||||
switch (Prop)
|
||||
{
|
||||
case EPropertyTypeNew::Bool: return "bool";
|
||||
case EPropertyTypeNew::Int: return "int";
|
||||
case EPropertyTypeNew::Enum: return "enum";
|
||||
case EPropertyTypeNew::Flags: return "Flags";
|
||||
case EPropertyTypeNew::Float: return "float";
|
||||
case EPropertyTypeNew::String: return "string";
|
||||
case EPropertyTypeNew::Color: return "Color";
|
||||
case EPropertyTypeNew::Vector: return "Vector";
|
||||
case EPropertyTypeNew::Sound: return "sound";
|
||||
case EPropertyTypeNew::Asset: return "asset";
|
||||
case EPropertyTypeNew::Spline: return "spline";
|
||||
|
||||
// All other types are either invalid or need a custom reimplementation because they can return multiple strings (like struct)
|
||||
default:
|
||||
ASSERT(false);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// ************ DEBUG ************
|
||||
void CStructTemplate::DebugPrintProperties(TString base)
|
||||
{
|
||||
base = base + Name() + "::";
|
||||
for (auto it = mSubProperties.begin(); it != mSubProperties.end(); it++)
|
||||
{
|
||||
IPropertyTemplate *tmp = *it;
|
||||
if (tmp->Type() == eStructProperty)
|
||||
{
|
||||
CStructTemplate *tmp2 = static_cast<CStructTemplate*>(tmp);
|
||||
tmp2->DebugPrintProperties(base);
|
||||
}
|
||||
else
|
||||
Log::Write(base + tmp->Name());
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,804 +0,0 @@
|
|||
#ifndef IPROPERTYTEMPLATE
|
||||
#define IPROPERTYTEMPLATE
|
||||
|
||||
#if 0
|
||||
#include "EPropertyType.h"
|
||||
#include "IProperty.h"
|
||||
#include "IPropertyValue.h"
|
||||
#include "Core/Resource/CResTypeFilter.h"
|
||||
#include "Core/Resource/Animation/CAnimationParameters.h"
|
||||
#include <Common/CColor.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Common/types.h>
|
||||
#include <Math/CVector3f.h>
|
||||
#include <vector>
|
||||
|
||||
typedef TString TIDString;
|
||||
class CMasterTemplate;
|
||||
class CStructTemplate;
|
||||
class IProperty;
|
||||
|
||||
enum ECookPreference
|
||||
{
|
||||
eNoCookPreference,
|
||||
eAlwaysCook,
|
||||
eNeverCook
|
||||
};
|
||||
|
||||
// IPropertyTemplate - Base class. Contains basic info that every property has,
|
||||
// plus virtual functions for determining more specific property type.
|
||||
class IPropertyTemplate
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
protected:
|
||||
CStructTemplate *mpParent;
|
||||
CScriptTemplate *mpScriptTemplate;
|
||||
CMasterTemplate *mpMasterTemplate;
|
||||
TString mName;
|
||||
TString mDescription;
|
||||
u32 mID;
|
||||
ECookPreference mCookPreference;
|
||||
std::vector<u32> mAllowedVersions;
|
||||
mutable bool mHasCachedNameCheck;
|
||||
mutable bool mCachedNameIsCorrect;
|
||||
|
||||
public:
|
||||
IPropertyTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: mID(ID)
|
||||
, mpParent(pParent)
|
||||
, mpScriptTemplate(pScript)
|
||||
, mpMasterTemplate(pMaster)
|
||||
, mName("UNSET PROPERTY NAME")
|
||||
, mCookPreference(eNoCookPreference)
|
||||
, mHasCachedNameCheck(false)
|
||||
, mCachedNameIsCorrect(false)
|
||||
{
|
||||
}
|
||||
|
||||
IPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: mID(ID)
|
||||
, mpParent(pParent)
|
||||
, mpScriptTemplate(pScript)
|
||||
, mpMasterTemplate(pMaster)
|
||||
, mName(rkName)
|
||||
, mCookPreference(CookPreference)
|
||||
, mHasCachedNameCheck(false)
|
||||
, mCachedNameIsCorrect(false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual EPropertyType Type() const = 0;
|
||||
virtual bool CanHaveDefault() const = 0;
|
||||
virtual bool IsNumerical() const = 0;
|
||||
virtual IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent) = 0;
|
||||
virtual IPropertyTemplate* Clone(CScriptTemplate *pScript, CStructTemplate *pParent = 0) const = 0;
|
||||
|
||||
virtual void Copy(const IPropertyTemplate *pkTemp)
|
||||
{
|
||||
mName = pkTemp->mName;
|
||||
mDescription = pkTemp->mDescription;
|
||||
mID = pkTemp->mID;
|
||||
mCookPreference = pkTemp->mCookPreference;
|
||||
mAllowedVersions = pkTemp->mAllowedVersions;
|
||||
}
|
||||
|
||||
virtual bool Matches(const IPropertyTemplate *pkTemp) const
|
||||
{
|
||||
return ( (pkTemp != nullptr) &&
|
||||
(mName == pkTemp->mName) &&
|
||||
(mDescription == pkTemp->mDescription) &&
|
||||
(mID == pkTemp->mID) &&
|
||||
(mCookPreference == pkTemp->mCookPreference) &&
|
||||
(mAllowedVersions == pkTemp->mAllowedVersions) &&
|
||||
(Type() == pkTemp->Type()) );
|
||||
}
|
||||
|
||||
virtual TString DefaultToString() const { return ""; }
|
||||
virtual const IPropertyValue* RawDefaultValue() const { return nullptr; }
|
||||
virtual bool HasValidRange() const { return false; }
|
||||
virtual TString RangeToString() const { return ""; }
|
||||
virtual TString Suffix() const { return ""; }
|
||||
virtual const char* GetTypeNameString() const { return HashablePropTypeName(Type()); }
|
||||
|
||||
virtual void SetParam(const TString& rkParamName, const TString& rkValue)
|
||||
{
|
||||
if (rkParamName == "cook_pref")
|
||||
{
|
||||
TString lValue = rkValue.ToLower();
|
||||
|
||||
if (lValue == "always")
|
||||
mCookPreference = eAlwaysCook;
|
||||
else if (lValue == "never")
|
||||
mCookPreference = eNeverCook;
|
||||
else
|
||||
mCookPreference = eNoCookPreference;
|
||||
}
|
||||
|
||||
else if (rkParamName == "description")
|
||||
mDescription = rkValue;
|
||||
}
|
||||
|
||||
EGame Game() const;
|
||||
bool IsInVersion(u32 Version) const;
|
||||
TString FullName() const;
|
||||
TIDString IDString(bool FullPath) const;
|
||||
bool IsDescendantOf(const CStructTemplate *pStruct) const;
|
||||
bool IsFromStructTemplate() const;
|
||||
bool IsNameCorrect() const;
|
||||
TString FindStructSource() const;
|
||||
CStructTemplate* RootStruct();
|
||||
|
||||
// Inline Accessors
|
||||
inline TString Name() const { return mName; }
|
||||
inline TString Description() const { return mDescription; }
|
||||
inline u32 PropertyID() const { return mID; }
|
||||
inline ECookPreference CookPreference() const { return mCookPreference; }
|
||||
inline CStructTemplate* Parent() const { return mpParent; }
|
||||
inline CScriptTemplate* ScriptTemplate() const { return mpScriptTemplate; }
|
||||
inline CMasterTemplate* MasterTemplate() const { return mpMasterTemplate; }
|
||||
inline void SetName(const TString& rkName) { mName = rkName; mHasCachedNameCheck = false; }
|
||||
inline void SetDescription(const TString& rkDesc) { mDescription = rkDesc; }
|
||||
};
|
||||
|
||||
// Macro for defining reimplementations of IPropertyTemplate::Clone(), which are usually identical to each other aside from the class being instantiated
|
||||
#define IMPLEMENT_TEMPLATE_CLONE(ClassName) \
|
||||
virtual IPropertyTemplate* Clone(CScriptTemplate *pScript, CStructTemplate *pParent = 0) const \
|
||||
{ \
|
||||
if (!pParent) pParent = mpParent; \
|
||||
if (!pScript) pScript = mpScriptTemplate; \
|
||||
ClassName *pTemp = new ClassName(mID, pScript, mpMasterTemplate, pParent); \
|
||||
pTemp->Copy(this); \
|
||||
return pTemp; \
|
||||
}
|
||||
|
||||
// TTypedPropertyTemplate - Template property class that allows for tracking
|
||||
// a default value. Typedefs are set up for a bunch of property types.
|
||||
template<typename PropType, EPropertyType PropTypeEnum, class ValueClass, bool CanHaveDefaultValue>
|
||||
class TTypedPropertyTemplate : public IPropertyTemplate
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
protected:
|
||||
ValueClass mDefaultValue;
|
||||
|
||||
public:
|
||||
TTypedPropertyTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: IPropertyTemplate(ID, pScript, pMaster, pParent) {}
|
||||
|
||||
TTypedPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: IPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent) {}
|
||||
|
||||
virtual EPropertyType Type() const { return PropTypeEnum; }
|
||||
virtual bool CanHaveDefault() const { return CanHaveDefaultValue; }
|
||||
virtual bool IsNumerical() const { return false; }
|
||||
|
||||
virtual IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
typedef TTypedProperty<PropType, PropTypeEnum, ValueClass> TPropertyType;
|
||||
TPropertyType *pOut = new TPropertyType(this, pInstance, pParent, GetDefaultValue());
|
||||
return pOut;
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(TTypedPropertyTemplate)
|
||||
|
||||
virtual void Copy(const IPropertyTemplate *pkTemp)
|
||||
{
|
||||
IPropertyTemplate::Copy(pkTemp);
|
||||
mDefaultValue.Copy(&static_cast<const TTypedPropertyTemplate*>(pkTemp)->mDefaultValue);
|
||||
}
|
||||
|
||||
virtual bool Matches(const IPropertyTemplate *pkTemp) const
|
||||
{
|
||||
const TTypedPropertyTemplate *pkTyped = static_cast<const TTypedPropertyTemplate*>(pkTemp);
|
||||
|
||||
return ( (IPropertyTemplate::Matches(pkTemp)) &&
|
||||
(mDefaultValue.Matches(&pkTyped->mDefaultValue)) );
|
||||
}
|
||||
|
||||
virtual TString DefaultToString() const
|
||||
{
|
||||
return mDefaultValue.ToString();
|
||||
}
|
||||
|
||||
virtual const IPropertyValue* RawDefaultValue() const
|
||||
{
|
||||
return &mDefaultValue;
|
||||
}
|
||||
|
||||
virtual void SetParam(const TString& rkParamName, const TString& rkValue)
|
||||
{
|
||||
IPropertyTemplate::SetParam(rkParamName, rkValue);
|
||||
|
||||
if (rkParamName == "default")
|
||||
mDefaultValue.FromString(rkValue.ToLower());
|
||||
}
|
||||
|
||||
inline PropType GetDefaultValue() const { return mDefaultValue.Get(); }
|
||||
inline void SetDefaultValue(const PropType& rkIn) { mDefaultValue.Set(rkIn); }
|
||||
};
|
||||
|
||||
// TNumericalPropertyTemplate - Subclass of TTypedPropertyTemplate for numerical
|
||||
// property types, and allows a min/max value and a suffix to be tracked.
|
||||
template<typename PropType, EPropertyType PropTypeEnum, class ValueClass>
|
||||
class TNumericalPropertyTemplate : public TTypedPropertyTemplate<PropType,PropTypeEnum,ValueClass,true>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
ValueClass mMin;
|
||||
ValueClass mMax;
|
||||
TString mSuffix;
|
||||
|
||||
public:
|
||||
TNumericalPropertyTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent)
|
||||
{}
|
||||
|
||||
TNumericalPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent)
|
||||
, mMin(0)
|
||||
, mMax(0)
|
||||
{}
|
||||
|
||||
virtual bool IsNumerical() const { return true; }
|
||||
virtual bool HasValidRange() const { return (mMin != 0 || mMax != 0); }
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(TNumericalPropertyTemplate)
|
||||
|
||||
virtual void Copy(const IPropertyTemplate *pkTemp)
|
||||
{
|
||||
TTypedPropertyTemplate::Copy(pkTemp);
|
||||
|
||||
const TNumericalPropertyTemplate *pkNumerical = static_cast<const TNumericalPropertyTemplate*>(pkTemp);
|
||||
mMin.Copy(&pkNumerical->mMin);
|
||||
mMax.Copy(&pkNumerical->mMax);
|
||||
mSuffix = pkNumerical->mSuffix;
|
||||
}
|
||||
|
||||
virtual bool Matches(const IPropertyTemplate *pkTemp) const
|
||||
{
|
||||
const TNumericalPropertyTemplate *pkNumerical = static_cast<const TNumericalPropertyTemplate*>(pkTemp);
|
||||
|
||||
return ( (TTypedPropertyTemplate::Matches(pkTemp)) &&
|
||||
(mMin.Matches(&pkNumerical->mMin)) &&
|
||||
(mMax.Matches(&pkNumerical->mMax)) &&
|
||||
(mSuffix == pkNumerical->mSuffix) );
|
||||
}
|
||||
|
||||
virtual TString RangeToString() const
|
||||
{
|
||||
return mMin.ToString() + "," + mMax.ToString();
|
||||
}
|
||||
|
||||
virtual void SetParam(const TString& rkParamName, const TString& rkValue)
|
||||
{
|
||||
TTypedPropertyTemplate::SetParam(rkParamName, rkValue);
|
||||
|
||||
if (rkParamName == "range")
|
||||
{
|
||||
TStringList Components = rkValue.ToLower().Split(", ");
|
||||
|
||||
if (Components.size() == 2)
|
||||
{
|
||||
mMin.FromString(Components.front());
|
||||
mMax.FromString(Components.back());
|
||||
}
|
||||
}
|
||||
|
||||
else if (rkParamName == "suffix")
|
||||
{
|
||||
mSuffix = rkValue;
|
||||
}
|
||||
}
|
||||
|
||||
virtual TString Suffix() const { return mSuffix; }
|
||||
inline PropType GetMin() const { return mMin.Get(); }
|
||||
inline PropType GetMax() const { return mMax.Get(); }
|
||||
|
||||
inline void SetRange(const PropType& rkMin, const PropType& rkMax)
|
||||
{
|
||||
mMin.Set(rkMin);
|
||||
mMax.Set(rkMax);
|
||||
}
|
||||
|
||||
inline void SetSuffix(const TString& rkSuffix)
|
||||
{
|
||||
mSuffix = rkSuffix;
|
||||
}
|
||||
};
|
||||
|
||||
// Typedefs for all property types that don't need further functionality.
|
||||
typedef TTypedPropertyTemplate<bool, eBoolProperty, CBoolValue, true> TBoolTemplate;
|
||||
typedef TNumericalPropertyTemplate<s8, eByteProperty, CByteValue> TByteTemplate;
|
||||
typedef TNumericalPropertyTemplate<s16, eShortProperty, CShortValue> TShortTemplate;
|
||||
typedef TNumericalPropertyTemplate<s32, eLongProperty, CLongValue> TLongTemplate;
|
||||
typedef TNumericalPropertyTemplate<float, eFloatProperty, CFloatValue> TFloatTemplate;
|
||||
typedef TTypedPropertyTemplate<CVector3f, eVector3Property, CVector3Value, true> TVector3Template;
|
||||
typedef TTypedPropertyTemplate<CColor, eColorProperty, CColorValue, true> TColorTemplate;
|
||||
|
||||
// TCharacterTemplate, TSoundTemplate, TStringTemplate, and TMayaSplineTemplate get their own subclasses so they can reimplement a couple functions
|
||||
class TCharacterTemplate : public TTypedPropertyTemplate<CAnimationParameters, eCharacterProperty, CCharacterValue, false>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
public:
|
||||
TCharacterTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent) {}
|
||||
|
||||
TCharacterTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent) {}
|
||||
|
||||
IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
return new TCharacterProperty(this, pInstance, pParent, CAnimationParameters(Game()));
|
||||
}
|
||||
|
||||
const char* GetTypeNameString() const
|
||||
{
|
||||
return (Game() < eCorruptionProto ? "AnimationSet" : "CharacterAnimationSet");
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(TCharacterTemplate)
|
||||
};
|
||||
|
||||
class TSoundTemplate : public TTypedPropertyTemplate<u32, eSoundProperty, CSoundValue, false>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
public:
|
||||
TSoundTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent) {}
|
||||
|
||||
TSoundTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent) {}
|
||||
|
||||
IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
return new TSoundProperty(this, pInstance, pParent, -1);
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(TSoundTemplate)
|
||||
};
|
||||
|
||||
class TStringTemplate : public TTypedPropertyTemplate<TString, eStringProperty, CStringValue, false>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
public:
|
||||
TStringTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent) {}
|
||||
|
||||
TStringTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent) {}
|
||||
|
||||
IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
return new TStringProperty(this, pInstance, pParent);
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(TStringTemplate)
|
||||
};
|
||||
|
||||
class TMayaSplineTemplate : public TTypedPropertyTemplate<std::vector<u8>, eMayaSplineProperty, CMayaSplineValue, false>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
public:
|
||||
TMayaSplineTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent) {}
|
||||
|
||||
TMayaSplineTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent) {}
|
||||
|
||||
IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
return new TMayaSplineProperty(this, pInstance, pParent);
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(TMayaSplineTemplate)
|
||||
};
|
||||
|
||||
// CAssetTemplate - Property template for assets. Tracks a list of resource types that
|
||||
// the property is allowed to accept.
|
||||
class CAssetTemplate : public IPropertyTemplate
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
CResTypeFilter mTypeFilter;
|
||||
public:
|
||||
CAssetTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: IPropertyTemplate(ID, pScript, pMaster, pParent) {}
|
||||
|
||||
CAssetTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: IPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent) {}
|
||||
|
||||
virtual EPropertyType Type() const { return eAssetProperty; }
|
||||
virtual bool CanHaveDefault() const { return false; }
|
||||
virtual bool IsNumerical() const { return false; }
|
||||
|
||||
IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
return new TAssetProperty(this, pInstance, pParent);
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(CAssetTemplate)
|
||||
|
||||
virtual void Copy(const IPropertyTemplate *pkTemp)
|
||||
{
|
||||
IPropertyTemplate::Copy(pkTemp);
|
||||
mTypeFilter = static_cast<const CAssetTemplate*>(pkTemp)->mTypeFilter;
|
||||
}
|
||||
|
||||
virtual bool Matches(const IPropertyTemplate *pkTemp) const
|
||||
{
|
||||
const CAssetTemplate *pkAsset = static_cast<const CAssetTemplate*>(pkTemp);
|
||||
|
||||
return ( (IPropertyTemplate::Matches(pkTemp)) &&
|
||||
(mTypeFilter == pkAsset->mTypeFilter) );
|
||||
}
|
||||
|
||||
void SetTypeFilter(const TStringList& rkExtensions) { mTypeFilter.SetAcceptedTypes(Game(), rkExtensions); }
|
||||
const CResTypeFilter& TypeFilter() const { return mTypeFilter; }
|
||||
};
|
||||
|
||||
// CEnumTemplate - Property template for enums. Tracks a list of possible values (enumerators).
|
||||
class CEnumTemplate : public TTypedPropertyTemplate<s32, eEnumProperty, CHexLongValue, true>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
struct SEnumerator
|
||||
{
|
||||
TString Name;
|
||||
u32 ID;
|
||||
|
||||
SEnumerator(const TString& rkName, u32 _ID)
|
||||
: Name(rkName), ID(_ID) {}
|
||||
|
||||
bool operator==(const SEnumerator& rkOther) const
|
||||
{
|
||||
return ( (Name == rkOther.Name) && (ID == rkOther.ID) );
|
||||
}
|
||||
};
|
||||
std::vector<SEnumerator> mEnumerators;
|
||||
TString mSourceFile;
|
||||
bool mUsesHashes;
|
||||
|
||||
public:
|
||||
CEnumTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent)
|
||||
, mUsesHashes(false)
|
||||
{
|
||||
}
|
||||
|
||||
CEnumTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent)
|
||||
, mUsesHashes(false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual EPropertyType Type() const { return eEnumProperty; }
|
||||
virtual bool CanHaveDefault() const { return true; }
|
||||
virtual bool IsNumerical() const { return false; }
|
||||
|
||||
virtual IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
TEnumProperty *pEnum = new TEnumProperty(this, pInstance, pParent);
|
||||
pEnum->Set(GetDefaultValue());
|
||||
return pEnum;
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(CEnumTemplate)
|
||||
|
||||
virtual void Copy(const IPropertyTemplate *pkTemp)
|
||||
{
|
||||
TTypedPropertyTemplate::Copy(pkTemp);
|
||||
|
||||
const CEnumTemplate *pkEnum = static_cast<const CEnumTemplate*>(pkTemp);
|
||||
mEnumerators = pkEnum->mEnumerators;
|
||||
mSourceFile = pkEnum->mSourceFile;
|
||||
mUsesHashes = pkEnum->mUsesHashes;
|
||||
}
|
||||
|
||||
virtual bool Matches(const IPropertyTemplate *pkTemp) const
|
||||
{
|
||||
const CEnumTemplate *pkEnum = static_cast<const CEnumTemplate*>(pkTemp);
|
||||
|
||||
return ( (TTypedPropertyTemplate::Matches(pkTemp)) &&
|
||||
(mEnumerators == pkEnum->mEnumerators) &&
|
||||
(mSourceFile == pkEnum->mSourceFile) &&
|
||||
(mUsesHashes == pkEnum->mUsesHashes) );
|
||||
}
|
||||
|
||||
virtual const char* GetTypeNameString() const
|
||||
{
|
||||
return (mUsesHashes ? "enum" : "choice");
|
||||
}
|
||||
|
||||
inline TString SourceFile() const { return mSourceFile; }
|
||||
inline u32 NumEnumerators() const { return mEnumerators.size(); }
|
||||
|
||||
u32 EnumeratorIndex(u32 enumID) const
|
||||
{
|
||||
for (u32 iEnum = 0; iEnum < mEnumerators.size(); iEnum++)
|
||||
{
|
||||
if (mEnumerators[iEnum].ID == enumID)
|
||||
return iEnum;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
u32 EnumeratorID(u32 enumIndex) const
|
||||
{
|
||||
if (mEnumerators.size() > enumIndex)
|
||||
return mEnumerators[enumIndex].ID;
|
||||
|
||||
else return -1;
|
||||
}
|
||||
|
||||
TString EnumeratorName(u32 enumIndex) const
|
||||
{
|
||||
if (mEnumerators.size() > enumIndex)
|
||||
return mEnumerators[enumIndex].Name;
|
||||
|
||||
else return "INVALID ENUM INDEX";
|
||||
}
|
||||
};
|
||||
|
||||
// CBitfieldTemplate - Property template for bitfields, which can have multiple
|
||||
// distinct boolean parameters packed into one property.
|
||||
class CBitfieldTemplate : public TTypedPropertyTemplate<u32, eBitfieldProperty, CHexLongValue, true>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
struct SBitFlag
|
||||
{
|
||||
TString Name;
|
||||
u32 Mask;
|
||||
|
||||
SBitFlag(const TString& _name, u32 _mask)
|
||||
: Name(_name), Mask(_mask) {}
|
||||
|
||||
bool operator==(const SBitFlag& rkOther) const
|
||||
{
|
||||
return ( (Name == rkOther.Name) && (Mask == rkOther.Mask) );
|
||||
}
|
||||
};
|
||||
std::vector<SBitFlag> mBitFlags;
|
||||
TString mSourceFile;
|
||||
|
||||
public:
|
||||
CBitfieldTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent)
|
||||
{
|
||||
}
|
||||
|
||||
CBitfieldTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent)
|
||||
{
|
||||
}
|
||||
|
||||
virtual EPropertyType Type() const { return eBitfieldProperty; }
|
||||
virtual bool CanHaveDefault() const { return true; }
|
||||
virtual bool IsNumerical() const { return false; }
|
||||
|
||||
virtual IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
TBitfieldProperty *pBitfield = new TBitfieldProperty(this, pInstance, pParent);
|
||||
pBitfield->Set(GetDefaultValue());
|
||||
return pBitfield;
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(CBitfieldTemplate)
|
||||
|
||||
virtual void Copy(const IPropertyTemplate *pkTemp)
|
||||
{
|
||||
TTypedPropertyTemplate::Copy(pkTemp);
|
||||
|
||||
const CBitfieldTemplate *pkBitfield = static_cast<const CBitfieldTemplate*>(pkTemp);
|
||||
mBitFlags = pkBitfield->mBitFlags;
|
||||
mSourceFile = pkBitfield->mSourceFile;
|
||||
}
|
||||
|
||||
virtual bool Matches(const IPropertyTemplate *pkTemp) const
|
||||
{
|
||||
const CBitfieldTemplate *pkBitfield = static_cast<const CBitfieldTemplate*>(pkTemp);
|
||||
|
||||
return ( (TTypedPropertyTemplate::Matches(pkTemp)) &&
|
||||
(mBitFlags == pkBitfield->mBitFlags) &&
|
||||
(mSourceFile == pkBitfield->mSourceFile) );
|
||||
}
|
||||
|
||||
inline TString SourceFile() const { return mSourceFile; }
|
||||
inline u32 NumFlags() const { return mBitFlags.size(); }
|
||||
inline TString FlagName(u32 index) const { return mBitFlags[index].Name; }
|
||||
inline u32 FlagMask(u32 index) const { return mBitFlags[index].Mask; }
|
||||
};
|
||||
|
||||
// CStructTemplate - Defines structs composed of multiple sub-properties.
|
||||
class CStructTemplate : public IPropertyTemplate
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
|
||||
protected:
|
||||
std::vector<IPropertyTemplate*> mSubProperties;
|
||||
std::vector<u32> mVersionPropertyCounts;
|
||||
bool mIsSingleProperty;
|
||||
TString mSourceFile;
|
||||
TString mTypeName;
|
||||
|
||||
void DetermineVersionPropertyCounts();
|
||||
public:
|
||||
CStructTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: IPropertyTemplate(ID, pScript, pMaster, pParent)
|
||||
, mIsSingleProperty(false) {}
|
||||
|
||||
CStructTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: IPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent)
|
||||
, mIsSingleProperty(false) {}
|
||||
|
||||
~CStructTemplate()
|
||||
{
|
||||
for (auto it = mSubProperties.begin(); it != mSubProperties.end(); it++)
|
||||
delete *it;
|
||||
}
|
||||
|
||||
EPropertyType Type() const { return eStructProperty; }
|
||||
bool CanHaveDefault() const { return false; }
|
||||
bool IsNumerical() const { return false; }
|
||||
|
||||
IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
CPropertyStruct *pStruct = new CPropertyStruct(this, pInstance, pParent);
|
||||
|
||||
for (u32 iSub = 0; iSub < mSubProperties.size(); iSub++)
|
||||
{
|
||||
IProperty *pSubProp = mSubProperties[iSub]->InstantiateProperty(pInstance, pStruct);
|
||||
pStruct->AddSubProperty(pSubProp);
|
||||
}
|
||||
|
||||
return pStruct;
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(CStructTemplate)
|
||||
|
||||
virtual void Copy(const IPropertyTemplate *pkTemp)
|
||||
{
|
||||
IPropertyTemplate::Copy(pkTemp);
|
||||
|
||||
const CStructTemplate *pkStruct = static_cast<const CStructTemplate*>(pkTemp);
|
||||
CopyStructData(pkStruct);
|
||||
}
|
||||
|
||||
void CopyStructData(const CStructTemplate *pkStruct);
|
||||
|
||||
virtual bool Matches(const IPropertyTemplate *pkTemp) const
|
||||
{
|
||||
const CStructTemplate *pkStruct = static_cast<const CStructTemplate*>(pkTemp);
|
||||
|
||||
if ( (IPropertyTemplate::Matches(pkTemp)) &&
|
||||
(mVersionPropertyCounts == pkStruct->mVersionPropertyCounts) &&
|
||||
(mIsSingleProperty == pkStruct->mIsSingleProperty) &&
|
||||
(mSourceFile == pkStruct->mSourceFile) &&
|
||||
(mTypeName == pkStruct->mTypeName) )
|
||||
{
|
||||
return StructDataMatches(pkStruct);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* GetTypeNameString() const
|
||||
{
|
||||
// hack - currently templates embedded within another XML can't have a type name
|
||||
return mTypeName.IsEmpty() ? *mName : *mTypeName;
|
||||
}
|
||||
|
||||
bool StructDataMatches(const CStructTemplate *pkStruct) const
|
||||
{
|
||||
if ( (mIsSingleProperty == pkStruct->mIsSingleProperty) &&
|
||||
(mSubProperties.size() == pkStruct->mSubProperties.size()) )
|
||||
{
|
||||
for (u32 iSub = 0; iSub < mSubProperties.size(); iSub++)
|
||||
{
|
||||
if (!mSubProperties[iSub]->Matches(pkStruct->mSubProperties[iSub]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline TString SourceFile() const { return mSourceFile; }
|
||||
inline bool IsSingleProperty() const { return mIsSingleProperty; }
|
||||
inline u32 Count() const { return mSubProperties.size(); }
|
||||
inline u32 NumVersions() const { return mVersionPropertyCounts.size(); }
|
||||
|
||||
u32 PropertyCountForVersion(u32 Version);
|
||||
u32 VersionForPropertyCount(u32 PropCount);
|
||||
IPropertyTemplate* PropertyByIndex(u32 index);
|
||||
IPropertyTemplate* PropertyByID(u32 ID);
|
||||
IPropertyTemplate* PropertyByIDString(const TIDString& str);
|
||||
CStructTemplate* StructByIndex(u32 index);
|
||||
CStructTemplate* StructByID(u32 ID);
|
||||
CStructTemplate* StructByIDString(const TIDString& str);
|
||||
bool HasProperty(const TIDString& rkIdString);
|
||||
void DebugPrintProperties(TString base);
|
||||
};
|
||||
|
||||
// CArrayTemplate - Defines a repeating struct composed of multiple sub-properties.
|
||||
// Similar to CStructTemplate, but with new implementations of Type() and InstantiateProperty().
|
||||
class CArrayTemplate : public CStructTemplate
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class CTemplateWriter;
|
||||
TString mElementName;
|
||||
|
||||
public:
|
||||
CArrayTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: CStructTemplate(ID, pScript, pMaster, pParent)
|
||||
{
|
||||
mIsSingleProperty = true;
|
||||
}
|
||||
|
||||
CArrayTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
|
||||
: CStructTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent)
|
||||
{
|
||||
mIsSingleProperty = true;
|
||||
}
|
||||
|
||||
EPropertyType Type() const { return eArrayProperty; }
|
||||
|
||||
IProperty* InstantiateProperty(CScriptObject *pInstance, CPropertyStruct *pParent)
|
||||
{
|
||||
return new CArrayProperty(this, pInstance, pParent);
|
||||
}
|
||||
|
||||
IMPLEMENT_TEMPLATE_CLONE(CArrayTemplate)
|
||||
|
||||
virtual void Copy(const IPropertyTemplate *pkTemp)
|
||||
{
|
||||
CStructTemplate::Copy(pkTemp);
|
||||
mElementName = static_cast<const CArrayTemplate*>(pkTemp)->mElementName;
|
||||
}
|
||||
|
||||
virtual bool Matches(const IPropertyTemplate *pkTemp) const
|
||||
{
|
||||
const CArrayTemplate *pkArray = static_cast<const CArrayTemplate*>(pkTemp);
|
||||
|
||||
return ( (mElementName == pkArray->mElementName) &
|
||||
(CStructTemplate::Matches(pkTemp)) );
|
||||
}
|
||||
|
||||
void SetParam(const TString& rkParamName, const TString& rkValue)
|
||||
{
|
||||
if (rkParamName == "element_name")
|
||||
mElementName = rkValue;
|
||||
else
|
||||
CStructTemplate::SetParam(rkParamName, rkValue);
|
||||
}
|
||||
|
||||
TString ElementName() const { return mElementName; }
|
||||
void SetElementName(const TString& rkName) { mElementName = rkName; }
|
||||
|
||||
CPropertyStruct* CreateSubStruct(CScriptObject *pInstance, CArrayProperty *pArray)
|
||||
{
|
||||
return (CPropertyStruct*) CStructTemplate::InstantiateProperty(pInstance, pArray);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // IPROPERTYTEMPLATE
|
||||
|
|
@ -1,392 +0,0 @@
|
|||
#ifndef IPROPERTYVALUE_H
|
||||
#define IPROPERTYVALUE_H
|
||||
|
||||
#if 0
|
||||
#include "EPropertyType.h"
|
||||
#include <Common/CAssetID.h>
|
||||
#include <Common/Log.h>
|
||||
#include "Core/Resource/Animation/CAnimationParameters.h"
|
||||
#include "Core/Resource/CResource.h"
|
||||
#include "Core/Resource/TResPtr.h"
|
||||
|
||||
#include <Common/CColor.h>
|
||||
#include <Common/TString.h>
|
||||
#include <Math/CVector3f.h>
|
||||
|
||||
class IPropertyValue
|
||||
{
|
||||
public:
|
||||
virtual TString ToString() const = 0;
|
||||
virtual void FromString(const TString& rkString) = 0;
|
||||
virtual IPropertyValue* Clone() const = 0;
|
||||
virtual void Copy(const IPropertyValue *pkValue) = 0;
|
||||
virtual bool Matches(const IPropertyValue *pkValue) const = 0;
|
||||
};
|
||||
|
||||
template<typename PropType>
|
||||
class TTypedPropertyValue : public IPropertyValue
|
||||
{
|
||||
protected:
|
||||
PropType mValue;
|
||||
|
||||
public:
|
||||
TTypedPropertyValue() {}
|
||||
|
||||
TTypedPropertyValue(PropType rkVal)
|
||||
: mValue(rkVal) {}
|
||||
|
||||
virtual void Copy(const IPropertyValue *pkValue)
|
||||
{
|
||||
const TTypedPropertyValue *pkOther = static_cast<const TTypedPropertyValue*>(pkValue);
|
||||
mValue = pkOther->mValue;
|
||||
}
|
||||
|
||||
virtual bool Matches(const IPropertyValue *pkValue) const
|
||||
{
|
||||
const TTypedPropertyValue *pkOther = static_cast<const TTypedPropertyValue*>(pkValue);
|
||||
return ((pkValue != nullptr) && (mValue == pkOther->mValue));
|
||||
}
|
||||
|
||||
PropType Get() const
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
void Set(const PropType& rkIn)
|
||||
{
|
||||
mValue = rkIn;
|
||||
}
|
||||
|
||||
bool operator==(const TTypedPropertyValue& rkOther) const
|
||||
{
|
||||
return (mValue == rkOther.mValue);
|
||||
}
|
||||
|
||||
bool operator==(const PropType& rkOther) const { return (mValue == rkOther); }
|
||||
bool operator!=(const PropType& rkOther) const { return (mValue != rkOther); }
|
||||
bool operator< (const PropType& rkOther) const { return (mValue < rkOther); }
|
||||
bool operator<=(const PropType& rkOther) const { return (mValue <= rkOther); }
|
||||
bool operator> (const PropType& rkOther) const { return (mValue > rkOther); }
|
||||
bool operator>=(const PropType& rkOther) const { return (mValue >= rkOther); }
|
||||
};
|
||||
|
||||
class CBoolValue : public TTypedPropertyValue<bool>
|
||||
{
|
||||
public:
|
||||
CBoolValue() { mValue = false; }
|
||||
CBoolValue(bool Val) { mValue = Val; }
|
||||
|
||||
TString ToString() const
|
||||
{
|
||||
return (!mValue ? "false" : "true");
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
mValue = (rkString == "true");
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CBoolValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CByteValue : public TTypedPropertyValue<s8>
|
||||
{
|
||||
public:
|
||||
CByteValue() { mValue = 0; }
|
||||
CByteValue(s8 Val) { mValue = Val; }
|
||||
|
||||
TString ToString() const
|
||||
{
|
||||
return TString::FromInt32(mValue, 0, 10);
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
u32 base = (rkString.StartsWith("0x") ? 16 : 10);
|
||||
mValue = (s8) rkString.ToInt32(base);
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CByteValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CShortValue : public TTypedPropertyValue<s16>
|
||||
{
|
||||
public:
|
||||
CShortValue() { mValue = 0; }
|
||||
CShortValue(s16 Val) { mValue = Val; }
|
||||
|
||||
TString ToString() const
|
||||
{
|
||||
return TString::FromInt32((s32) mValue, 0, 10);
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
u32 base = (rkString.StartsWith("0x") ? 16 : 10);
|
||||
mValue = (s16) rkString.ToInt32(base);
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CShortValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CLongValue : public TTypedPropertyValue<s32>
|
||||
{
|
||||
public:
|
||||
CLongValue() { mValue = 0; }
|
||||
CLongValue(s32 Val) { mValue = Val; }
|
||||
|
||||
TString ToString() const
|
||||
{
|
||||
return TString::FromInt32(mValue, 0, 10);
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
u32 base = (rkString.StartsWith("0x") ? 16 : 10);
|
||||
mValue = (s32) rkString.ToInt32(base);
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CLongValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CHexLongValue : public TTypedPropertyValue<u32>
|
||||
{
|
||||
public:
|
||||
CHexLongValue() { mValue = 0; }
|
||||
CHexLongValue(u32 Val) { mValue = Val; }
|
||||
|
||||
TString ToString() const
|
||||
{
|
||||
return TString::HexString(mValue, 8);
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
u32 Base = (rkString.StartsWith("0x") ? 16 : 10);
|
||||
mValue = (s32) rkString.ToInt32(Base);
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CHexLongValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CFloatValue : public TTypedPropertyValue<float>
|
||||
{
|
||||
public:
|
||||
CFloatValue() { mValue = 0.0f; }
|
||||
CFloatValue(float Val) { mValue = Val; }
|
||||
|
||||
TString ToString() const
|
||||
{
|
||||
return TString::FromFloat(mValue);
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
mValue = rkString.ToFloat();
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CFloatValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CStringValue : public TTypedPropertyValue<TString>
|
||||
{
|
||||
public:
|
||||
CStringValue() {}
|
||||
CStringValue(const TString& rkVal) { mValue = rkVal; }
|
||||
|
||||
// These functions are extremely complicated, but try to follow along
|
||||
TString ToString() const
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
mValue = rkString;
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CStringValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CColorValue : public TTypedPropertyValue<CColor>
|
||||
{
|
||||
public:
|
||||
CColorValue() {}
|
||||
CColorValue(const CColor& rkVal) { mValue = rkVal; }
|
||||
|
||||
TString ToString() const
|
||||
{
|
||||
TString out;
|
||||
out += TString::FromFloat(mValue.R) + ", ";
|
||||
out += TString::FromFloat(mValue.G) + ", ";
|
||||
out += TString::FromFloat(mValue.B) + ", ";
|
||||
out += TString::FromFloat(mValue.A);
|
||||
return out;
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
TStringList Components = rkString.Split(", ");
|
||||
|
||||
if (Components.size() < 3 || Components.size() > 4)
|
||||
{
|
||||
Log::Error("CColorValue::FromString was passed a string with an invalid number of components");
|
||||
mValue = CColor::skTransparentBlack;
|
||||
return;
|
||||
}
|
||||
|
||||
float *pPtr = &mValue.R;
|
||||
mValue.A = 1.0f;
|
||||
|
||||
for (auto it = Components.begin(); it != Components.end(); it++)
|
||||
{
|
||||
*pPtr = it->ToFloat();
|
||||
pPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CColorValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CVector3Value : public TTypedPropertyValue<CVector3f>
|
||||
{
|
||||
public:
|
||||
CVector3Value() {}
|
||||
CVector3Value(const CVector3f& rkVal) { mValue = rkVal; }
|
||||
|
||||
TString ToString() const
|
||||
{
|
||||
TString out;
|
||||
out += TString::FromFloat(mValue.X) + ", ";
|
||||
out += TString::FromFloat(mValue.Y) + ", ";
|
||||
out += TString::FromFloat(mValue.Z);
|
||||
return out;
|
||||
}
|
||||
|
||||
void FromString(const TString& rkString)
|
||||
{
|
||||
TStringList Components = rkString.Split(", ");
|
||||
|
||||
if (Components.size() != 3)
|
||||
{
|
||||
Log::Error("CVector3Value::FromString was passed a string with an invalid number of components");
|
||||
mValue = CVector3f::skInfinite;
|
||||
return;
|
||||
}
|
||||
|
||||
float *pPtr = &mValue.X;
|
||||
|
||||
for (auto it = Components.begin(); it != Components.end(); it++)
|
||||
{
|
||||
*pPtr = it->ToFloat();
|
||||
pPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CVector3Value(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CCharacterValue : public TTypedPropertyValue<CAnimationParameters>
|
||||
{
|
||||
public:
|
||||
CCharacterValue() {}
|
||||
CCharacterValue(const CAnimationParameters& rkParams) { mValue = rkParams; }
|
||||
|
||||
TString ToString() const { return ""; }
|
||||
void FromString(const TString&) { }
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CCharacterValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CMayaSplineValue : public TTypedPropertyValue<std::vector<u8>>
|
||||
{
|
||||
public:
|
||||
CMayaSplineValue() {}
|
||||
CMayaSplineValue(const std::vector<u8>& rkData) { mValue = rkData; }
|
||||
|
||||
TString ToString() const { return "[MayaSpline]"; }
|
||||
void FromString(const TString&) {}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CMayaSplineValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CSoundValue : public TTypedPropertyValue<u32>
|
||||
{
|
||||
public:
|
||||
CSoundValue() {}
|
||||
CSoundValue(u32 SoundID) { mValue = SoundID; }
|
||||
|
||||
TString ToString() const { return TString::FromInt32(mValue, 0, 10); }
|
||||
void FromString(const TString& rkString) { mValue = rkString.ToInt32(10); }
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CSoundValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CAssetValue : public TTypedPropertyValue<CAssetID>
|
||||
{
|
||||
public:
|
||||
CAssetValue() {}
|
||||
CAssetValue(const CAssetID& rkID) { mValue = rkID; }
|
||||
|
||||
TString ToString() const { return ""; }
|
||||
void FromString(const TString&) {}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CAssetValue(mValue);
|
||||
}
|
||||
};
|
||||
|
||||
class CUnknownValue : public TTypedPropertyValue<std::vector<u8>>
|
||||
{
|
||||
public:
|
||||
CUnknownValue();
|
||||
CUnknownValue(const std::vector<u8>& rkVec) { mValue = rkVec; }
|
||||
|
||||
TString ToString() const { return ""; }
|
||||
void FromString(const TString&) {}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
return new CUnknownValue(mValue);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // IPROPERTYVALUE_H
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef CANIMATIONPROPERTY_H
|
||||
#define CANIMATIONPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CAnimationProperty : public TSerializeableTypedProperty< u32, EPropertyTypeNew::Animation >
|
||||
class CAnimationProperty : public TSerializeableTypedProperty< u32, EPropertyType::Animation >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CAnimationProperty(EGame Game)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef CANIMATIONSETPROPERTY_H
|
||||
#define CANIMATIONSETPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CAnimationSetProperty : public TSerializeableTypedProperty< CAnimationParameters, EPropertyTypeNew::AnimationSet >
|
||||
class CAnimationSetProperty : public TSerializeableTypedProperty< CAnimationParameters, EPropertyType::AnimationSet >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CAnimationSetProperty(EGame Game)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CARRAYPROPERTY_H
|
||||
#define CARRAYPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
struct SScriptArray
|
||||
{
|
||||
|
@ -20,9 +20,9 @@ struct SScriptArray
|
|||
|
||||
/** You probably shouldn't use this on intrinsic classes; script only */
|
||||
/** @todo proper support of default values for arrays (this would be used for prefabs) */
|
||||
class CArrayProperty : public TTypedPropertyNew<u32, EPropertyTypeNew::Array>
|
||||
class CArrayProperty : public TTypedProperty<u32, EPropertyType::Array>
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
friend class CTemplateLoader;
|
||||
|
||||
/** This class inherits from TTypedPropertyNew<int> in order to expose the array
|
||||
|
@ -30,7 +30,7 @@ class CArrayProperty : public TTypedPropertyNew<u32, EPropertyTypeNew::Array>
|
|||
* value and we respond by updating the allocated space, handling item destruction
|
||||
* and construction, etc.
|
||||
*/
|
||||
IPropertyNew* mpItemArchetype;
|
||||
IProperty* mpItemArchetype;
|
||||
|
||||
/** Internal functions */
|
||||
SScriptArray& _GetInternalArray(void* pData) const
|
||||
|
@ -46,7 +46,7 @@ class CArrayProperty : public TTypedPropertyNew<u32, EPropertyTypeNew::Array>
|
|||
|
||||
protected:
|
||||
CArrayProperty(EGame Game)
|
||||
: TTypedPropertyNew(Game)
|
||||
: TTypedProperty(Game)
|
||||
, mpItemArchetype(nullptr)
|
||||
{}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
virtual void Destruct(void* pData) const
|
||||
{
|
||||
RevertToDefault(pData);
|
||||
TTypedPropertyNew::Destruct(pData);
|
||||
TTypedProperty::Destruct(pData);
|
||||
}
|
||||
|
||||
virtual bool MatchesDefault(void* pData) const
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
|
||||
virtual void Serialize(IArchive& rArc)
|
||||
{
|
||||
TTypedPropertyNew::Serialize(rArc);
|
||||
TTypedProperty::Serialize(rArc);
|
||||
rArc << SerialParameter("ItemArchetype", mpItemArchetype);
|
||||
|
||||
if (rArc.IsReader())
|
||||
|
@ -135,16 +135,16 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void InitFromArchetype(IPropertyNew* pOther)
|
||||
virtual void InitFromArchetype(IProperty* pOther)
|
||||
{
|
||||
TTypedPropertyNew::InitFromArchetype(pOther);
|
||||
TTypedProperty::InitFromArchetype(pOther);
|
||||
CArrayProperty* pOtherArray = static_cast<CArrayProperty*>(pOther);
|
||||
mpItemArchetype = IPropertyNew::CreateCopy(pOtherArray->mpItemArchetype);
|
||||
mpItemArchetype = IProperty::CreateCopy(pOtherArray->mpItemArchetype);
|
||||
}
|
||||
|
||||
virtual void PostInitialize()
|
||||
{
|
||||
TTypedPropertyNew::PostInitialize();
|
||||
TTypedProperty::PostInitialize();
|
||||
mpItemArchetype->Initialize(this, mpScriptTemplate, 0);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ public:
|
|||
}
|
||||
|
||||
/** Accessors */
|
||||
IPropertyNew* ItemArchetype() const { return mpItemArchetype; }
|
||||
IProperty* ItemArchetype() const { return mpItemArchetype; }
|
||||
};
|
||||
|
||||
#endif // CARRAYPROPERTY_H
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef CASSETPROPERTY_H
|
||||
#define CASSETPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
#include "Core/Resource/CResTypeFilter.h"
|
||||
|
||||
class CAssetProperty : public TSerializeableTypedProperty<CAssetID, EPropertyTypeNew::Asset>
|
||||
class CAssetProperty : public TSerializeableTypedProperty<CAssetID, EPropertyType::Asset>
|
||||
{
|
||||
friend class CTemplateLoader;
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
CResTypeFilter mTypeFilter;
|
||||
|
||||
|
@ -33,9 +33,9 @@ public:
|
|||
mTypeFilter != pArchetype->mTypeFilter;
|
||||
}
|
||||
|
||||
virtual void InitFromArchetype(IPropertyNew* pOther)
|
||||
virtual void InitFromArchetype(IProperty* pOther)
|
||||
{
|
||||
TTypedPropertyNew::InitFromArchetype(pOther);
|
||||
TTypedProperty::InitFromArchetype(pOther);
|
||||
mTypeFilter = static_cast<CAssetProperty*>(pOther)->mTypeFilter;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef CBOOLPROPERTY_H
|
||||
#define CBOOLPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CBoolProperty : public TSerializeableTypedProperty< bool, EPropertyTypeNew::Bool >
|
||||
class CBoolProperty : public TSerializeableTypedProperty< bool, EPropertyType::Bool >
|
||||
{
|
||||
friend class IPropertyNew;
|
||||
friend class IProperty;
|
||||
|
||||
protected:
|
||||
CBoolProperty(EGame Game)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CBYTEPROPERTY_H
|
||||
#define CBYTEPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CByteProperty : public TNumericalPropertyNew< s8, EPropertyTypeNew::Byte >
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CCOLORPROPERTY_H
|
||||
#define CCOLORPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
#include "CFloatProperty.h"
|
||||
|
||||
class CColorProperty : public TSerializeableTypedProperty< CColor, EPropertyTypeNew::Color >
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CENUMPROPERTY_H
|
||||
#define CENUMPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
/** There are two types of enum properties in the game data: enum and choice.
|
||||
*
|
||||
|
|
|
@ -29,7 +29,7 @@ void CFlagsProperty::SerializeValue(void* pData, IArchive& rArc) const
|
|||
rArc.SerializePrimitive( (u32&) ValueRef(pData), SH_HexDisplay );
|
||||
}
|
||||
|
||||
void CFlagsProperty::InitFromArchetype(IPropertyNew* pOther)
|
||||
void CFlagsProperty::InitFromArchetype(IProperty* pOther)
|
||||
{
|
||||
TSerializeableTypedProperty::InitFromArchetype(pOther);
|
||||
CFlagsProperty* pOtherFlags = static_cast<CFlagsProperty*>(pOther);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CFLAGSPROPERTY_H
|
||||
#define CFLAGSPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CFlagsProperty : public TSerializeableTypedProperty<u32, EPropertyTypeNew::Flags>
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CFLOATPROPERTY_H
|
||||
#define CFLOATPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CFloatProperty : public TNumericalPropertyNew< float, EPropertyTypeNew::Float >
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CGUIDPROPERTY_H
|
||||
#define CGUIDPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CGuidProperty : public TTypedPropertyNew< std::vector<char>, EPropertyTypeNew::Guid >
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CINTPROPERTY_H
|
||||
#define CINTPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CIntProperty : public TNumericalPropertyNew< s32, EPropertyTypeNew::Int >
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CPOINTERPROPERTY_H
|
||||
#define CPOINTERPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CPointerProperty : public TTypedPropertyNew<void*, EPropertyTypeNew::Pointer>
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CSEQUENCEPROPERTY_H
|
||||
#define CSEQUENCEPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CSequenceProperty : public TTypedPropertyNew< s32, EPropertyTypeNew::Sequence >
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CSHORTPROPERTY_H
|
||||
#define CSHORTPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CShortProperty : public TNumericalPropertyNew< s16, EPropertyTypeNew::Short >
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CSOUNDPROPERTY_H
|
||||
#define CSOUNDPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CSoundProperty : public TSerializeableTypedProperty< s32, EPropertyTypeNew::Sound >
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CSPLINEPROPERTY_H
|
||||
#define CSPLINEPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CSplineProperty : public TTypedPropertyNew< std::vector<char>, EPropertyTypeNew::Spline >
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CSTRINGPROPERTY_H
|
||||
#define CSTRINGPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CStringProperty : public TSerializeableTypedProperty< TString, EPropertyTypeNew::String >
|
||||
{
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include "CStructProperty.h"
|
||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||
|
||||
EPropertyTypeNew CStructPropertyNew::Type() const
|
||||
EPropertyType CStructProperty::Type() const
|
||||
{
|
||||
return EPropertyTypeNew::Struct;
|
||||
return EPropertyType::Struct;
|
||||
}
|
||||
|
||||
u32 CStructPropertyNew::DataSize() const
|
||||
u32 CStructProperty::DataSize() const
|
||||
{
|
||||
if (!mChildren.empty())
|
||||
{
|
||||
IPropertyNew* pLastChild = mChildren.back();
|
||||
IProperty* pLastChild = mChildren.back();
|
||||
return (pLastChild->Offset() - Offset()) + pLastChild->DataSize();
|
||||
}
|
||||
else
|
||||
|
@ -19,13 +19,13 @@ u32 CStructPropertyNew::DataSize() const
|
|||
}
|
||||
}
|
||||
|
||||
u32 CStructPropertyNew::DataAlignment() const
|
||||
u32 CStructProperty::DataAlignment() const
|
||||
{
|
||||
// Structs are aligned to the first child property.
|
||||
return (mChildren.empty() ? 1 : mChildren[0]->DataAlignment());
|
||||
}
|
||||
|
||||
void CStructPropertyNew::Construct(void* pData) const
|
||||
void CStructProperty::Construct(void* pData) const
|
||||
{
|
||||
for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ void CStructPropertyNew::Construct(void* pData) const
|
|||
}
|
||||
}
|
||||
|
||||
void CStructPropertyNew::Destruct(void* pData) const
|
||||
void CStructProperty::Destruct(void* pData) const
|
||||
{
|
||||
for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ void CStructPropertyNew::Destruct(void* pData) const
|
|||
}
|
||||
}
|
||||
|
||||
bool CStructPropertyNew::MatchesDefault(void* pData) const
|
||||
bool CStructProperty::MatchesDefault(void* pData) const
|
||||
{
|
||||
for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ bool CStructPropertyNew::MatchesDefault(void* pData) const
|
|||
return true;
|
||||
}
|
||||
|
||||
void CStructPropertyNew::RevertToDefault(void* pData) const
|
||||
void CStructProperty::RevertToDefault(void* pData) const
|
||||
{
|
||||
for (int ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
|
@ -61,14 +61,14 @@ void CStructPropertyNew::RevertToDefault(void* pData) const
|
|||
}
|
||||
}
|
||||
|
||||
const char* CStructPropertyNew::HashableTypeName() const
|
||||
const char* CStructProperty::HashableTypeName() const
|
||||
{
|
||||
return mpArchetype ? mpArchetype->HashableTypeName() : *mName;
|
||||
}
|
||||
|
||||
void CStructPropertyNew::Serialize(IArchive& rArc)
|
||||
void CStructProperty::Serialize(IArchive& rArc)
|
||||
{
|
||||
IPropertyNew::Serialize(rArc);
|
||||
IProperty::Serialize(rArc);
|
||||
|
||||
// Serialize atomic flag
|
||||
bool Atomic = IsAtomic();
|
||||
|
@ -85,7 +85,7 @@ void CStructPropertyNew::Serialize(IArchive& rArc)
|
|||
// Serialize archetype
|
||||
if (mpArchetype)
|
||||
{
|
||||
CStructPropertyNew* pArchetype = static_cast<CStructPropertyNew*>(mpArchetype);
|
||||
CStructProperty* pArchetype = static_cast<CStructProperty*>(mpArchetype);
|
||||
ASSERT(pArchetype != nullptr);
|
||||
|
||||
if (rArc.IsReader())
|
||||
|
@ -103,13 +103,13 @@ void CStructPropertyNew::Serialize(IArchive& rArc)
|
|||
// Serialize type and ID, then look up the matching property and serialize it.
|
||||
// We don't really need the type, but it's a good sanity check, and it's also good practice
|
||||
// to guarantee that parameters are read in order, as some serializers are order-dependent.
|
||||
EPropertyTypeNew ChildType;
|
||||
EPropertyType ChildType;
|
||||
u32 ChildID;
|
||||
|
||||
rArc << SerialParameter("Type", ChildType, SH_Attribute)
|
||||
<< SerialParameter("ID", ChildID, SH_Attribute | SH_HexDisplay );
|
||||
|
||||
IPropertyNew* pChild = ChildByID(ChildID);
|
||||
IProperty* pChild = ChildByID(ChildID);
|
||||
ASSERT(pChild != nullptr && pChild->Type() == ChildType);
|
||||
pChild->Serialize(rArc);
|
||||
|
||||
|
@ -123,7 +123,7 @@ void CStructPropertyNew::Serialize(IArchive& rArc)
|
|||
else
|
||||
{
|
||||
// Check if any properties need to override parameters from their archetype.
|
||||
std::vector<IPropertyNew*> PropertiesToSerialize;
|
||||
std::vector<IProperty*> PropertiesToSerialize;
|
||||
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ void CStructPropertyNew::Serialize(IArchive& rArc)
|
|||
}
|
||||
}
|
||||
|
||||
void CStructPropertyNew::SerializeValue(void* pData, IArchive& Arc) const
|
||||
void CStructProperty::SerializeValue(void* pData, IArchive& Arc) const
|
||||
{
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
{
|
||||
|
@ -159,9 +159,9 @@ void CStructPropertyNew::SerializeValue(void* pData, IArchive& Arc) const
|
|||
}
|
||||
}
|
||||
|
||||
void CStructPropertyNew::InitFromArchetype(IPropertyNew* pOther)
|
||||
void CStructProperty::InitFromArchetype(IProperty* pOther)
|
||||
{
|
||||
IPropertyNew::InitFromArchetype(pOther);
|
||||
IProperty::InitFromArchetype(pOther);
|
||||
|
||||
// Copy children
|
||||
_ClearChildren();
|
||||
|
@ -169,14 +169,14 @@ void CStructPropertyNew::InitFromArchetype(IPropertyNew* pOther)
|
|||
|
||||
for (u32 ChildIdx = 0; ChildIdx < pOther->NumChildren(); ChildIdx++)
|
||||
{
|
||||
IPropertyNew* pChild = CreateCopy( pOther->ChildByIndex(ChildIdx) );
|
||||
IProperty* pChild = CreateCopy( pOther->ChildByIndex(ChildIdx) );
|
||||
mChildren.push_back( pChild );
|
||||
}
|
||||
}
|
||||
|
||||
bool CStructPropertyNew::ShouldSerialize() const
|
||||
bool CStructProperty::ShouldSerialize() const
|
||||
{
|
||||
if (IPropertyNew::ShouldSerialize())
|
||||
if (IProperty::ShouldSerialize())
|
||||
return true;
|
||||
|
||||
for (u32 ChildIdx = 0; ChildIdx < mChildren.size(); ChildIdx++)
|
||||
|
@ -188,7 +188,7 @@ bool CStructPropertyNew::ShouldSerialize() const
|
|||
return false;
|
||||
}
|
||||
|
||||
TString CStructPropertyNew::GetTemplateFileName()
|
||||
TString CStructProperty::GetTemplateFileName()
|
||||
{
|
||||
ASSERT(IsArchetype() || mpArchetype);
|
||||
return IsArchetype() ? mTemplateFileName : mpArchetype->GetTemplateFileName();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CSTRUCTPROPERTY_H
|
||||
#define CSTRUCTPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CStructPropertyNew : public IPropertyNew
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CVECTORPROPERTY_H
|
||||
#define CVECTORPROPERTY_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
|
||||
class CVectorProperty : public TSerializeableTypedProperty< CVector3f, EPropertyTypeNew::Vector >
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "IPropertyNew.h"
|
||||
#include "Property/CAssetProperty.h"
|
||||
#include "Property/CArrayProperty.h"
|
||||
#include "Property/CEnumProperty.h"
|
||||
#include "Property/CFlagsProperty.h"
|
||||
#include "Property/CPointerProperty.h"
|
||||
#include "IProperty.h"
|
||||
#include "CAssetProperty.h"
|
||||
#include "CArrayProperty.h"
|
||||
#include "CEnumProperty.h"
|
||||
#include "CFlagsProperty.h"
|
||||
#include "CPointerProperty.h"
|
||||
|
||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||
#include "Core/Resource/Script/CScriptTemplate.h"
|
|
@ -87,7 +87,7 @@ inline const char* PropEnumToHashableTypeName(EPropertyTypeNew Type)
|
|||
case EPropertyTypeNew::Spline: return "spline";
|
||||
case EPropertyTypeNew::Guid: return "guid";
|
||||
// unknown hashable types - used in hashes but these names are inaccurate
|
||||
case EPropertyTypeNew::Animation: return "animation"; // hashable but real name unknown
|
||||
case EPropertyTypeNew::Animation: return "animation";
|
||||
case EPropertyTypeNew::Sequence: return "sequence";
|
||||
// non hashable types - not used in ID hashes but still displayed on the UI
|
||||
case EPropertyTypeNew::Byte: return "byte";
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef PROPERTIES_H
|
||||
#define PROPERTIES_H
|
||||
|
||||
#include "../IPropertyNew.h"
|
||||
#include "IProperty.h"
|
||||
#include "CAnimationProperty.h"
|
||||
#include "CAnimationSetProperty.h"
|
||||
#include "CArrayProperty.h"
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
#ifndef TPROPERTYPROXY_H
|
||||
#define TPROPERTYPROXY_H
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
/**
|
||||
* Lightweight proxy class representing a property instance. Easy to read/modify
|
||||
* specific properties and efficient to pass around.
|
||||
*/
|
||||
template<class PropertyClass>
|
||||
class TPropertyProxy
|
||||
{
|
||||
typedef PropertyClass::ValueType ValueType;
|
||||
|
||||
/** Property data buffer */
|
||||
void* mpDataPtr;
|
||||
|
||||
/** Source property */
|
||||
PropertyClass* mpProperty;
|
||||
|
||||
public:
|
||||
TPropertyProxy()
|
||||
: mpDataPtr(nullptr)
|
||||
, mpProperty(nullptr)
|
||||
{}
|
||||
|
||||
TPropertyProxy(void* pDataPtr, PropertyClass* pProperty)
|
||||
: mpDataPtr(pDataPtr)
|
||||
, mpProperty(pProperty)
|
||||
{}
|
||||
|
||||
/** Returns whether this proxy points to a valid property instance */
|
||||
bool IsValid() const
|
||||
{
|
||||
return mpDataPtr != nullptr && mpProperty != nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // TPROPERTYPROXY_H
|
|
@ -130,7 +130,7 @@ CStructRef CLightNode::GetProperties() const
|
|||
return CStructRef(mpLight, mpLight->GetProperties());
|
||||
}
|
||||
|
||||
void CLightNode::PropertyModified(IPropertyNew* pProperty)
|
||||
void CLightNode::PropertyModified(IProperty* pProperty)
|
||||
{
|
||||
CSceneNode::PropertyModified(pProperty);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||
CStructRef GetProperties() const;
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
void PropertyModified(IProperty* pProperty);
|
||||
bool AllowsRotate() const { return false; }
|
||||
CLight* Light();
|
||||
CVector2f BillboardScale();
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
virtual CColor TintColor(const SViewInfo& rkViewInfo) const;
|
||||
virtual CColor WireframeColor() const;
|
||||
virtual CStructRef GetProperties() const { return CStructRef(); }
|
||||
virtual void PropertyModified(IPropertyNew* pProperty) {}
|
||||
virtual void PropertyModified(IProperty* pProperty) {}
|
||||
|
||||
void OnLoadFinished();
|
||||
void Unparent();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "CScriptAttachNode.h"
|
||||
#include "CScriptNode.h"
|
||||
#include "Core/Render/CRenderer.h"
|
||||
#include "Core/Resource/Script/IProperty.h"
|
||||
#include "Core/Resource/Script/Property/IProperty.h"
|
||||
#include <Common/AssertMacro.h>
|
||||
|
||||
CScriptAttachNode::CScriptAttachNode(CScene *pScene, const SAttachment& rkAttachment, CScriptNode *pParent)
|
||||
|
|
|
@ -12,7 +12,7 @@ class CScriptAttachNode : public CSceneNode
|
|||
CScriptNode* mpScriptNode;
|
||||
TResPtr<CResource> mpAttachAsset;
|
||||
|
||||
IPropertyNew* mpAttachAssetProp;
|
||||
IProperty* mpAttachAssetProp;
|
||||
CAssetRef mAttachAssetRef;
|
||||
CAnimationSetRef mAttachAnimSetRef;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo);
|
||||
SRayIntersection RayNodeIntersectTest(const CRay& rkRay, u32 AssetID, const SViewInfo& rkViewInfo);
|
||||
|
||||
inline IPropertyNew* AttachProperty() const { return mpAttachAssetProp; }
|
||||
inline IProperty* AttachProperty() const { return mpAttachAssetProp; }
|
||||
inline TString LocatorName() const { return mLocatorName; }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -459,26 +459,26 @@ CStructRef CScriptNode::GetProperties() const
|
|||
return CStructRef(mpInstance->PropertyData(), mpInstance->Template()->Properties());
|
||||
}
|
||||
|
||||
void CScriptNode::PropertyModified(IPropertyNew* pProp)
|
||||
void CScriptNode::PropertyModified(IProperty* pProp)
|
||||
{
|
||||
// Update volume
|
||||
EPropertyTypeNew Type = pProp->Type();
|
||||
EPropertyType Type = pProp->Type();
|
||||
|
||||
if ( Type == EPropertyTypeNew::Bool || Type == EPropertyTypeNew::Byte || Type == EPropertyTypeNew::Short ||
|
||||
Type == EPropertyTypeNew::Int || Type == EPropertyTypeNew::Choice || Type == EPropertyTypeNew::Enum )
|
||||
if ( Type == EPropertyType::Bool || Type == EPropertyType::Byte || Type == EPropertyType::Short ||
|
||||
Type == EPropertyType::Int || Type == EPropertyType::Choice || Type == EPropertyType::Enum )
|
||||
{
|
||||
mpInstance->EvaluateVolume();
|
||||
UpdatePreviewVolume();
|
||||
}
|
||||
|
||||
// Update resources
|
||||
else if (Type == EPropertyTypeNew::AnimationSet)
|
||||
else if (Type == EPropertyType::AnimationSet)
|
||||
{
|
||||
mpInstance->EvaluateDisplayAsset();
|
||||
SetDisplayAsset(mpInstance->DisplayAsset());
|
||||
}
|
||||
|
||||
else if (Type == EPropertyTypeNew::Asset)
|
||||
else if (Type == EPropertyType::Asset)
|
||||
{
|
||||
CAssetProperty* pAssetProperty = TPropCast<CAssetProperty>(pProp);
|
||||
const CResTypeFilter& rkFilter = pAssetProperty->GetTypeFilter();
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
CColor TintColor(const SViewInfo& rkViewInfo) const;
|
||||
CColor WireframeColor() const;
|
||||
CStructRef GetProperties() const;
|
||||
void PropertyModified(IPropertyNew* pProp);
|
||||
void PropertyModified(IProperty* pProp);
|
||||
|
||||
void LinksModified();
|
||||
void UpdatePreviewVolume();
|
||||
|
|
|
@ -14,7 +14,7 @@ CDamageableTriggerExtra::CDamageableTriggerExtra(CScriptObject *pInstance, CScen
|
|||
SetInheritance(true, false, false);
|
||||
CreateMaterial();
|
||||
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
CStructProperty* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
// Fetch render side
|
||||
mRenderSide = TEnumRef<ERenderSide>(pInstance->PropertyData(), pProperties->ChildByIndex(5));
|
||||
|
@ -178,7 +178,7 @@ void CDamageableTriggerExtra::OnTransformed()
|
|||
UpdatePlaneTransform();
|
||||
}
|
||||
|
||||
void CDamageableTriggerExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
void CDamageableTriggerExtra::PropertyModified(IProperty* pProperty)
|
||||
{
|
||||
if (pProperty == mRenderSide || pProperty == mPlaneSize)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
ERenderSide RenderSideForDirection(const CVector3f& rkDir);
|
||||
ERenderSide TransformRenderSide(ERenderSide Side);
|
||||
void OnTransformed();
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
void PropertyModified(IProperty* pProperty);
|
||||
bool ShouldDrawNormalAssets();
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
CDoorExtra::CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent)
|
||||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
{
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
CStructProperty* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
mShieldModelProp = CAssetRef(pInstance->PropertyData(), pProperties->ChildByID(0xB20CC271));
|
||||
if (mShieldModelProp.IsValid()) PropertyModified(mShieldModelProp.Property());
|
||||
|
@ -22,7 +22,7 @@ CDoorExtra::CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pP
|
|||
}
|
||||
}
|
||||
|
||||
void CDoorExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
void CDoorExtra::PropertyModified(IProperty* pProperty)
|
||||
{
|
||||
if (pProperty == mShieldModelProp)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ class CDoorExtra : public CScriptExtra
|
|||
|
||||
public:
|
||||
explicit CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0);
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
void PropertyModified(IProperty* pProperty);
|
||||
void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo);
|
||||
void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo);
|
||||
void DrawSelection();
|
||||
|
|
|
@ -8,7 +8,7 @@ CPointOfInterestExtra::CPointOfInterestExtra(CScriptObject *pInstance, CScene *p
|
|||
, mpScanData(nullptr)
|
||||
{
|
||||
// Fetch scan data property
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
CStructProperty* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
if (mGame <= ePrime) mScanProperty = CAssetRef(pInstance->PropertyData(), pProperties->ChildByIDString("0x04:0x00"));
|
||||
else mScanProperty = CAssetRef(pInstance->PropertyData(), pProperties->ChildByIDString("0xBDBEC295:0xB94E9BE7"));
|
||||
|
@ -16,7 +16,7 @@ CPointOfInterestExtra::CPointOfInterestExtra(CScriptObject *pInstance, CScene *p
|
|||
PropertyModified(mScanProperty.Property());
|
||||
}
|
||||
|
||||
void CPointOfInterestExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
void CPointOfInterestExtra::PropertyModified(IProperty* pProperty)
|
||||
{
|
||||
if (mScanProperty.Property() == pProperty)
|
||||
mpScanData = gpResourceStore->LoadResource<CScan>( mScanProperty.Get() );
|
||||
|
|
|
@ -13,7 +13,7 @@ class CPointOfInterestExtra : public CScriptExtra
|
|||
|
||||
public:
|
||||
explicit CPointOfInterestExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0);
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
void PropertyModified(IProperty* pProperty);
|
||||
void ModifyTintColor(CColor& Color);
|
||||
CScan* GetScan() const { return mpScanData; }
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ CRadiusSphereExtra::CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene,
|
|||
: CScriptExtra(pInstance, pScene, pParent)
|
||||
{
|
||||
mObjectType = pInstance->ObjectTypeID();
|
||||
CStructPropertyNew* pProperties = pInstance->Template()->Properties();
|
||||
CStructProperty* pProperties = pInstance->Template()->Properties();
|
||||
|
||||
switch (mObjectType)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ CSandwormExtra::CSandwormExtra(CScriptObject* pInstance, CScene* pScene, CScript
|
|||
if (mPincersScale.IsValid()) PropertyModified(mPincersScale.Property());
|
||||
}
|
||||
|
||||
void CSandwormExtra::PropertyModified(IPropertyNew* pProp)
|
||||
void CSandwormExtra::PropertyModified(IProperty* pProp)
|
||||
{
|
||||
if (pProp == mPincersScale)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ class CSandwormExtra : public CScriptExtra
|
|||
|
||||
public:
|
||||
explicit CSandwormExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent);
|
||||
void PropertyModified(IPropertyNew* pProp);
|
||||
void PropertyModified(IProperty* pProp);
|
||||
};
|
||||
|
||||
#endif // CSANDWORMEXTRA_H
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
// Virtual CScriptExtra functions
|
||||
virtual void InstanceTransformed() {}
|
||||
virtual void PropertyModified(IPropertyNew* /*pProperty*/) {}
|
||||
virtual void PropertyModified(IProperty* /*pProperty*/) {}
|
||||
virtual void DisplayAssetChanged(CResource* /*pNewDisplayAsset*/) {}
|
||||
virtual void LinksModified() {}
|
||||
virtual bool ShouldDrawNormalAssets() { return true; }
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
CSpacePirateExtra::CSpacePirateExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent)
|
||||
: CScriptExtra(pInstance, pScene ,pParent)
|
||||
{
|
||||
CStructPropertyNew* pBaseStruct = pInstance->Template()->Properties();
|
||||
CStructPropertyNew* pVulnerabilities = TPropCast<CStructPropertyNew>(pBaseStruct->ChildByIDString("0x04:0x10"));
|
||||
CStructProperty* pBaseStruct = pInstance->Template()->Properties();
|
||||
CStructProperty* pVulnerabilities = TPropCast<CStructProperty>(pBaseStruct->ChildByIDString("0x04:0x10"));
|
||||
|
||||
if (pVulnerabilities)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define CSPACEPIRATEEXTRA_H
|
||||
|
||||
#include "CScriptExtra.h"
|
||||
#include "Core/Resource/Script/IProperty.h"
|
||||
#include "Core/Resource/Script/Property/IProperty.h"
|
||||
|
||||
enum class EVulnerabilityTypeMP1
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ CSplinePathExtra::CSplinePathExtra(CScriptObject* pInstance, CScene* pScene, CSc
|
|||
mPathColor = CColorRef(pInstance->PropertyData(), pInstance->Template()->Properties()->ChildByID(0x00DD86E2));
|
||||
}
|
||||
|
||||
void CSplinePathExtra::PropertyModified(IPropertyNew* pProperty)
|
||||
void CSplinePathExtra::PropertyModified(IProperty* pProperty)
|
||||
{
|
||||
if (pProperty == mPathColor.Property())
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
inline CColor PathColor() const { return (mPathColor.IsValid() ? mPathColor.Get() : CColor::skBlack); }
|
||||
|
||||
void PostLoad();
|
||||
void PropertyModified(IPropertyNew* pProperty);
|
||||
void PropertyModified(IProperty* pProperty);
|
||||
|
||||
void FindAttachedWaypoints(std::set<CWaypointExtra*>& rChecked, CWaypointExtra* pWaypoint);
|
||||
void AddWaypoints();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define CGENERATEPROPERTYNAMESDIALOG_H
|
||||
|
||||
#include "CProgressBarNotifier.h"
|
||||
#include <Core/Resource/Script/CPropertyNameGenerator.h>
|
||||
#include <Core/Resource/Script/Property/CPropertyNameGenerator.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFuture>
|
||||
|
|
|
@ -6,7 +6,7 @@ CPropertyNameValidator::CPropertyNameValidator(QObject* pParent)
|
|||
{}
|
||||
|
||||
/** Set the property to validate against */
|
||||
void CPropertyNameValidator::SetProperty(IPropertyNew* pProp)
|
||||
void CPropertyNameValidator::SetProperty(IProperty* pProp)
|
||||
{
|
||||
mpProperty = pProp;
|
||||
emit changed();
|
||||
|
|
|
@ -10,13 +10,13 @@ class CPropertyNameValidator : public QValidator
|
|||
Q_OBJECT
|
||||
|
||||
/** The property being validated against */
|
||||
IPropertyNew* mpProperty;
|
||||
IProperty* mpProperty;
|
||||
|
||||
public:
|
||||
CPropertyNameValidator(QObject* pParent = 0);
|
||||
|
||||
/** Set the property to validate against */
|
||||
void SetProperty(IPropertyNew* pProp);
|
||||
void SetProperty(IProperty* pProp);
|
||||
|
||||
/** Perform validation */
|
||||
QValidator::State validate(QString& rInput, int& rPos) const;
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include "Editor/Widgets/WIntegralSpinBox.h"
|
||||
|
||||
#include <Core/Resource/Animation/CAnimSet.h>
|
||||
#include <Core/Resource/Script/IProperty.h>
|
||||
#include <Core/Resource/Script/IPropertyTemplate.h>
|
||||
#include <Core/Resource/Script/Property/Properties.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
QWidget* CreateCharacterEditor(QWidget *pParent, const QModelIndex& rkIndex) const;
|
||||
void SetCharacterEditorData(QWidget *pEditor, const QModelIndex& rkIndex) const;
|
||||
void SetCharacterModelData(QWidget *pEditor, const QModelIndex& rkIndex) const;
|
||||
EPropertyTypeNew DetermineCharacterPropType(EGame Game, const QModelIndex& rkIndex) const;
|
||||
EPropertyType DetermineCharacterPropType(EGame Game, const QModelIndex& rkIndex) const;
|
||||
|
||||
public slots:
|
||||
void WidgetEdited(QWidget *pWidget, const QModelIndex& rkIndex);
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include "CPropertyModel.h"
|
||||
#include "Editor/UICommon.h"
|
||||
#include <Core/GameProject/CGameProject.h>
|
||||
#include <Core/Resource/Script/IProperty.h>
|
||||
#include <Core/Resource/Script/IPropertyTemplate.h>
|
||||
#include <Core/Resource/Script/Property/IProperty.h>
|
||||
#include <QFont>
|
||||
#include <QSize>
|
||||
|
||||
|
|
|
@ -11,32 +11,32 @@ class CPropertyModel : public QAbstractItemModel
|
|||
|
||||
struct SProperty
|
||||
{
|
||||
IPropertyNew* pProperty;
|
||||
IProperty* pProperty;
|
||||
QModelIndex Index;
|
||||
int ParentID;
|
||||
std::vector<int> ChildIDs;
|
||||
};
|
||||
QVector<SProperty> mProperties;
|
||||
QMap<IPropertyNew*, int> mPropertyToIDMap;
|
||||
QMap<IProperty*, int> mPropertyToIDMap;
|
||||
int mFirstUnusedID;
|
||||
|
||||
CGameProject* mpProject;
|
||||
CScriptObject* mpObject; // may be null
|
||||
IPropertyNew* mpRootProperty;
|
||||
IProperty* mpRootProperty;
|
||||
void* mpPropertyData;
|
||||
|
||||
bool mBoldModifiedProperties;
|
||||
bool mShowNameValidity;
|
||||
QFont mFont;
|
||||
|
||||
int RecursiveBuildArrays(IPropertyNew* pProperty, int ParentID);
|
||||
int RecursiveBuildArrays(IProperty* pProperty, int ParentID);
|
||||
|
||||
public:
|
||||
CPropertyModel(QObject *pParent = 0);
|
||||
void ConfigureIntrinsic(CGameProject* pProject, IPropertyNew* pRootProperty, void* pPropertyData);
|
||||
void ConfigureScript(CGameProject* pProject, IPropertyNew* pRootProperty, CScriptObject* pObject);
|
||||
IPropertyNew* PropertyForIndex(const QModelIndex& rkIndex, bool HandleFlaggedIndices) const;
|
||||
QModelIndex IndexForProperty(IPropertyNew *pProp) const;
|
||||
void ConfigureIntrinsic(CGameProject* pProject, IProperty* pRootProperty, void* pPropertyData);
|
||||
void ConfigureScript(CGameProject* pProject, IProperty* pRootProperty, CScriptObject* pObject);
|
||||
IProperty* PropertyForIndex(const QModelIndex& rkIndex, bool HandleFlaggedIndices) const;
|
||||
QModelIndex IndexForProperty(IProperty *pProp) const;
|
||||
void* DataPointerForIndex(const QModelIndex& rkIndex) const;
|
||||
|
||||
int columnCount(const QModelIndex& rkParent) const;
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
inline CScriptObject* GetScriptObject() const { return mpObject; }
|
||||
|
||||
public slots:
|
||||
void NotifyPropertyModified(class CScriptObject *pInst, IPropertyNew *pProp);
|
||||
void NotifyPropertyModified(class CScriptObject *pInst, IProperty *pProp);
|
||||
void NotifyPropertyModified(const QModelIndex& rkIndex);
|
||||
|
||||
signals:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "CPropertyView.h"
|
||||
#include "CPropertyDelegate.h"
|
||||
#include "Editor/WorldEditor/CTemplateEditDialog.h"
|
||||
#include <Core/Resource/Script/IPropertyTemplate.h>
|
||||
#include <Core/Resource/Script/Property/Properties.h>
|
||||
|
||||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
|
|
|
@ -15,7 +15,7 @@ class CPropertyView : public QTreeView
|
|||
CPropertyDelegate *mpDelegate;
|
||||
CScriptObject *mpObject;
|
||||
|
||||
IPropertyNew *mpMenuProperty;
|
||||
IProperty *mpMenuProperty;
|
||||
QAction *mpShowNameValidityAction;
|
||||
QAction *mpEditTemplateAction;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ protected:
|
|||
QModelIndex mIndex;
|
||||
|
||||
public:
|
||||
CEditScriptPropertyCommand(IPropertyNew* pProperty,
|
||||
CEditScriptPropertyCommand(IProperty* pProperty,
|
||||
CWorldEditor* pEditor,
|
||||
const QVector<CScriptObject*>& rkInstances,
|
||||
QModelIndex Index = QModelIndex(),
|
||||
|
|
|
@ -13,7 +13,7 @@ class CResizeScriptArrayCommand : public CEditScriptPropertyCommand
|
|||
int mNewRowCount;
|
||||
|
||||
public:
|
||||
CResizeScriptArrayCommand(IPropertyNew* pProperty,
|
||||
CResizeScriptArrayCommand(IProperty* pProperty,
|
||||
CWorldEditor* pEditor,
|
||||
const QVector<CScriptObject*>& rkInstances,
|
||||
CPropertyModel* pModel = nullptr,
|
||||
|
|
|
@ -30,7 +30,7 @@ void IEditPropertyCommand::RestoreObjectStateFromArray(std::vector<char>& rArray
|
|||
}
|
||||
|
||||
IEditPropertyCommand::IEditPropertyCommand(
|
||||
IPropertyNew* pProperty,
|
||||
IProperty* pProperty,
|
||||
const QString& rkCommandName /*= "Edit Property"*/
|
||||
)
|
||||
: IUndoCommand(rkCommandName)
|
||||
|
|
|
@ -12,7 +12,7 @@ protected:
|
|||
std::vector<char> mOldData;
|
||||
std::vector<char> mNewData;
|
||||
|
||||
IPropertyNew* mpProperty;
|
||||
IProperty* mpProperty;
|
||||
bool mCommandEnded;
|
||||
bool mSavedOldData;
|
||||
bool mSavedNewData;
|
||||
|
@ -25,7 +25,7 @@ protected:
|
|||
|
||||
public:
|
||||
IEditPropertyCommand(
|
||||
IPropertyNew* pProperty,
|
||||
IProperty* pProperty,
|
||||
const QString& rkCommandName = "Edit Property"
|
||||
);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ CInstancesModel::CInstancesModel(CWorldEditor *pEditor, QObject *pParent)
|
|||
connect(mpEditor, SIGNAL(NodeSpawned(CSceneNode*)), this, SLOT(NodeCreated(CSceneNode*)));
|
||||
connect(mpEditor, SIGNAL(NodeAboutToBeDeleted(CSceneNode*)), this, SLOT(NodeAboutToBeDeleted(CSceneNode*)));
|
||||
connect(mpEditor, SIGNAL(NodeDeleted()), this, SLOT(NodeDeleted()));
|
||||
connect(mpEditor, SIGNAL(PropertyModified(CScriptObject*,IPropertyNew*)), this, SLOT(PropertyModified(CScriptObject*,IPropertyNew*)));
|
||||
connect(mpEditor, SIGNAL(PropertyModified(CScriptObject*,IProperty*)), this, SLOT(PropertyModified(CScriptObject*,IProperty*)));
|
||||
connect(mpEditor, SIGNAL(InstancesLayerAboutToChange()), this, SLOT(InstancesLayerPreChange()));
|
||||
connect(mpEditor, SIGNAL(InstancesLayerChanged(QList<CScriptNode*>)), this, SLOT(InstancesLayerPostChange(QList<CScriptNode*>)));
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ void CInstancesModel::NodeDeleted()
|
|||
}
|
||||
}
|
||||
|
||||
void CInstancesModel::PropertyModified(CScriptObject *pInst, IPropertyNew *pProp)
|
||||
void CInstancesModel::PropertyModified(CScriptObject *pInst, IProperty *pProp)
|
||||
{
|
||||
if (pProp->Name() == "Name")
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ public slots:
|
|||
void NodeAboutToBeDeleted(CSceneNode *pNode);
|
||||
void NodeDeleted();
|
||||
|
||||
void PropertyModified(CScriptObject *pInst, IPropertyNew *pProp);
|
||||
void PropertyModified(CScriptObject *pInst, IProperty *pProp);
|
||||
void InstancesLayerPreChange();
|
||||
void InstancesLayerPostChange(const QList<CScriptNode*>& rkInstanceList);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <Core/Resource/Factory/CTemplateLoader.h>
|
||||
#include <Core/Resource/Script/CMasterTemplate.h>
|
||||
|
||||
CTemplateEditDialog::CTemplateEditDialog(IPropertyNew *pProperty, QWidget *pParent)
|
||||
CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent)
|
||||
: QDialog(pParent)
|
||||
, mpUI(new Ui::CTemplateEditDialog)
|
||||
, mpValidator(new CPropertyNameValidator(this))
|
||||
|
@ -93,7 +93,7 @@ void CTemplateEditDialog::ApplyChanges()
|
|||
CMasterTemplate::RenameProperty(mpProperty, NewName);
|
||||
|
||||
// Add modified templates to pending resave list
|
||||
const std::vector<IPropertyNew*> *pList = CMasterTemplate::TemplatesWithMatchingID(mpProperty);
|
||||
const std::vector<IProperty*> *pList = CMasterTemplate::TemplatesWithMatchingID(mpProperty);
|
||||
|
||||
if (pList)
|
||||
{
|
||||
|
@ -126,9 +126,9 @@ void CTemplateEditDialog::ApplyChanges()
|
|||
}
|
||||
|
||||
// ************ PROTECTED ************
|
||||
void CTemplateEditDialog::AddTemplate(IPropertyNew* pProp)
|
||||
void CTemplateEditDialog::AddTemplate(IProperty* pProp)
|
||||
{
|
||||
IPropertyNew* pArchetype = pProp->Archetype();
|
||||
IProperty* pArchetype = pProp->Archetype();
|
||||
|
||||
if (pArchetype)
|
||||
{
|
||||
|
@ -137,9 +137,9 @@ void CTemplateEditDialog::AddTemplate(IPropertyNew* pProp)
|
|||
switch (pArchetype->Type())
|
||||
{
|
||||
|
||||
case EPropertyTypeNew::Struct:
|
||||
case EPropertyType::Struct:
|
||||
{
|
||||
CStructPropertyNew* pStruct = TPropCast<CStructPropertyNew>(pArchetype);
|
||||
CStructProperty* pStruct = TPropCast<CStructProperty>(pArchetype);
|
||||
if (!mStructTemplatesToResave.contains(pStruct))
|
||||
{
|
||||
mStructTemplatesToResave << pStruct;
|
||||
|
@ -179,13 +179,13 @@ void CTemplateEditDialog::UpdateDescription(const TString& rkNewDesc)
|
|||
|
||||
if (!SourceFile.IsEmpty())
|
||||
{
|
||||
const std::vector<IPropertyNew*>* pkTemplates = CMasterTemplate::TemplatesWithMatchingID(mpProperty);
|
||||
const std::vector<IProperty*>* pkTemplates = CMasterTemplate::TemplatesWithMatchingID(mpProperty);
|
||||
|
||||
if (pkTemplates)
|
||||
{
|
||||
for (u32 TemplateIdx = 0; TemplateIdx < pkTemplates->size(); TemplateIdx++)
|
||||
{
|
||||
IPropertyNew* pProp = pkTemplates->at(TemplateIdx);
|
||||
IProperty* pProp = pkTemplates->at(TemplateIdx);
|
||||
|
||||
if (pProp->GetTemplateFileName() == SourceFile && pProp->Description() == mOriginalDescription)
|
||||
pProp->SetDescription(rkNewDesc);
|
||||
|
@ -194,14 +194,14 @@ void CTemplateEditDialog::UpdateDescription(const TString& rkNewDesc)
|
|||
}
|
||||
|
||||
// Update equivalent properties with new description
|
||||
foreach (IPropertyNew* pProperty, mEquivalentProperties)
|
||||
foreach (IProperty* pProperty, mEquivalentProperties)
|
||||
{
|
||||
pProperty->SetDescription(rkNewDesc);
|
||||
AddTemplate(pProperty);
|
||||
}
|
||||
}
|
||||
|
||||
void CTemplateEditDialog::FindEquivalentProperties(IPropertyNew *pTemp)
|
||||
void CTemplateEditDialog::FindEquivalentProperties(IProperty *pTemp)
|
||||
{
|
||||
//FIXME
|
||||
/*
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define CTEMPLATEEDITDIALOG_H
|
||||
|
||||
#include "Editor/CPropertyNameValidator.h"
|
||||
#include <Core/Resource/Script/IPropertyTemplate.h>
|
||||
#include <Core/Resource/Script/Property/Properties.h>
|
||||
#include <Core/Resource/Script/CMasterTemplate.h>
|
||||
#include <QDialog>
|
||||
|
||||
|
|
|
@ -569,7 +569,7 @@ void CWorldEditor::OnLinksModified(const QList<CScriptObject*>& rkInstances)
|
|||
emit InstanceLinksModified(rkInstances);
|
||||
}
|
||||
|
||||
void CWorldEditor::OnPropertyModified(CScriptObject* pObject, IPropertyNew *pProp)
|
||||
void CWorldEditor::OnPropertyModified(CScriptObject* pObject, IProperty *pProp)
|
||||
{
|
||||
CScriptNode *pScript = mScene.NodeForInstance(pObject);
|
||||
|
||||
|
@ -592,7 +592,7 @@ void CWorldEditor::OnPropertyModified(CScriptObject* pObject, IPropertyNew *pPro
|
|||
}
|
||||
|
||||
// If this is a model/character, then we'll treat this as a modified selection. This is to make sure the selection bounds updates.
|
||||
if (pProp->Type() == EPropertyTypeNew::Asset)
|
||||
if (pProp->Type() == EPropertyType::Asset)
|
||||
{
|
||||
CAssetProperty *pAsset = TPropCast<CAssetProperty>(pProp);
|
||||
const CResTypeFilter& rkFilter = pAsset->GetTypeFilter();
|
||||
|
@ -600,7 +600,7 @@ void CWorldEditor::OnPropertyModified(CScriptObject* pObject, IPropertyNew *pPro
|
|||
if (rkFilter.Accepts(eModel) || rkFilter.Accepts(eAnimSet) || rkFilter.Accepts(eCharacter))
|
||||
SelectionModified();
|
||||
}
|
||||
else if (pProp->Type() == EPropertyTypeNew::AnimationSet)
|
||||
else if (pProp->Type() == EPropertyType::AnimationSet)
|
||||
SelectionModified();
|
||||
|
||||
// Emit signal so other widgets can react to the property change
|
||||
|
|
|
@ -122,7 +122,7 @@ public slots:
|
|||
|
||||
void OnActiveProjectChanged(CGameProject *pProj);
|
||||
void OnLinksModified(const QList<CScriptObject*>& rkInstances);
|
||||
void OnPropertyModified(CScriptObject* pObject, IPropertyNew *pProp);
|
||||
void OnPropertyModified(CScriptObject* pObject, IProperty *pProp);
|
||||
void SetSelectionActive(bool Active);
|
||||
void SetSelectionInstanceNames(const QString& rkNewName, bool IsDone);
|
||||
void SetSelectionLayer(CScriptLayer *pLayer);
|
||||
|
@ -187,7 +187,7 @@ signals:
|
|||
void InstancesLayerAboutToChange();
|
||||
void InstancesLayerChanged(const QList<CScriptNode*>& rkInstanceList);
|
||||
void InstanceLinksModified(const QList<CScriptObject*>& rkInstances);
|
||||
void PropertyModified(CScriptObject *pInst, IPropertyNew *pProp);
|
||||
void PropertyModified(CScriptObject *pInst, IProperty *pProp);
|
||||
};
|
||||
|
||||
#endif // CWORLDEDITOR_H
|
||||
|
|
|
@ -65,7 +65,7 @@ void WEditorProperties::SyncToEditor(CWorldEditor *pEditor)
|
|||
connect(mpEditor, SIGNAL(SelectionModified()), this, SLOT(OnSelectionModified()));
|
||||
connect(mpEditor, SIGNAL(LayersModified()), this, SLOT(OnLayersModified()));
|
||||
connect(mpEditor, SIGNAL(InstancesLayerChanged(QList<CScriptNode*>)), this, SLOT(OnInstancesLayerChanged(QList<CScriptNode*>)));
|
||||
connect(mpEditor, SIGNAL(PropertyModified(CScriptObject*,IPropertyNew*)), this, SLOT(OnPropertyModified(CScriptObject*,IPropertyNew*)));
|
||||
connect(mpEditor, SIGNAL(PropertyModified(CScriptObject*,IProperty*)), this, SLOT(OnPropertyModified(CScriptObject*,IProperty*)));
|
||||
|
||||
OnLayersModified();
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void WEditorProperties::OnSelectionModified()
|
|||
SetLayerComboBox();
|
||||
}
|
||||
|
||||
void WEditorProperties::OnPropertyModified(CScriptObject *pInstance, IPropertyNew *pProp)
|
||||
void WEditorProperties::OnPropertyModified(CScriptObject *pInstance, IProperty *pProp)
|
||||
{
|
||||
if (!mpInstanceNameLineEdit->hasFocus())
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void OnSelectionModified();
|
||||
void OnPropertyModified(CScriptObject *pInst, IPropertyNew *pProp);
|
||||
void OnPropertyModified(CScriptObject *pInst, IProperty *pProp);
|
||||
void OnInstancesLayerChanged(const QList<CScriptNode*>& rkNodeList);
|
||||
void OnLayersModified();
|
||||
void UpdatePropertyValues();
|
||||
|
|
Loading…
Reference in New Issue