Added dialog for editing property templates

This commit is contained in:
parax0 2016-02-14 21:36:24 -07:00
parent 34eb7c436e
commit c1e3808196
34 changed files with 970 additions and 224 deletions

View File

@ -11,6 +11,33 @@ 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
@ -76,7 +103,7 @@ void CTemplateWriter::SaveGameTemplates(CMasterTemplate *pMaster)
// Resave struct templates
for (auto it = pMaster->mStructTemplates.begin(); it != pMaster->mStructTemplates.end(); it++)
SaveStructTemplate(it->second, pMaster);
SaveStructTemplate(it->second);
// Resave master template
XMLDocument Master;
@ -202,7 +229,7 @@ void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp)
pRoot->LinkEndChild(pName);
// Write properties
SaveProperties(&ScriptXML, pRoot, pTemp->mpBaseStruct, pMaster);
SaveProperties(&ScriptXML, pRoot, pTemp->mpBaseStruct);
// States/Messages [todo]
XMLElement *pStates = ScriptXML.NewElement("states");
@ -345,9 +372,10 @@ void CTemplateWriter::SaveScriptTemplate(CScriptTemplate *pTemp)
ScriptXML.SaveFile(*OutFile);
}
void CTemplateWriter::SaveStructTemplate(CStructTemplate *pTemp, CMasterTemplate *pMaster)
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);
@ -364,13 +392,14 @@ void CTemplateWriter::SaveStructTemplate(CStructTemplate *pTemp, CMasterTemplate
pRoot->SetAttribute("type", (pTemp->IsSingleProperty() ? "single" : "multi"));
StructXML.LinkEndChild(pRoot);
SaveProperties(&StructXML, pRoot, pTemp, pMaster);
SaveProperties(&StructXML, pRoot, pTemp);
StructXML.SaveFile(*OutFile);
}
void CTemplateWriter::SaveEnumTemplate(CEnumTemplate *pTemp, CMasterTemplate *pMaster)
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);
@ -390,9 +419,10 @@ void CTemplateWriter::SaveEnumTemplate(CEnumTemplate *pTemp, CMasterTemplate *pM
EnumXML.SaveFile(*OutFile);
}
void CTemplateWriter::SaveBitfieldTemplate(CBitfieldTemplate *pTemp, CMasterTemplate *pMaster)
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);
@ -412,7 +442,7 @@ void CTemplateWriter::SaveBitfieldTemplate(CBitfieldTemplate *pTemp, CMasterTemp
BitfieldXML.SaveFile(*OutFile);
}
void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CStructTemplate *pTemp, CMasterTemplate *pMaster)
void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CStructTemplate *pTemp)
{
// Create base element
XMLElement *pPropsBlock = pDoc->NewElement("properties");
@ -447,7 +477,7 @@ void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CSt
// Name
TString Name = pProp->Name();
if (pMaster->GetGame() >= eEchoesDemo && ID > 0xFF)
if (pProp->Game() >= eEchoesDemo && ID > 0xFF)
{
TString MasterName = CMasterTemplate::GetPropertyName(ID);
@ -471,6 +501,7 @@ void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CSt
pElem->SetAttribute("type", *PropEnumToPropString(pProp->Type()));
// Versions
CMasterTemplate *pMaster = pProp->MasterTemplate();
u32 NumVersions = pProp->mAllowedVersions.size();
if (NumVersions > 0 && NumVersions != pMaster->mGameVersions.size())
@ -490,7 +521,7 @@ void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CSt
}
// Default
if (pProp->CanHaveDefault() && pMaster->GetGame() >= eEchoesDemo)
if (pProp->CanHaveDefault() && pProp->Game() >= eEchoesDemo)
{
XMLElement *pDefault = pDoc->NewElement("default");
pDefault->SetText(*pProp->DefaultToString());
@ -561,7 +592,7 @@ void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CSt
else
{
SaveEnumTemplate(pEnum, pMaster);
SaveEnumTemplate(pEnum);
pElem->SetAttribute("template", *pEnum->mSourceFile);
}
}
@ -576,7 +607,7 @@ void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CSt
else
{
SaveBitfieldTemplate(pBitfield, pMaster);
SaveBitfieldTemplate(pBitfield);
pElem->SetAttribute("template", *pBitfield->mSourceFile);
}
}
@ -601,14 +632,14 @@ void CTemplateWriter::SaveProperties(XMLDocument *pDoc, XMLElement *pParent, CSt
CStructTemplate *pStruct = static_cast<CStructTemplate*>(pProp);
if (pStruct->mSourceFile.IsEmpty())
SaveProperties(pDoc, pElem, pStruct, pMaster);
SaveProperties(pDoc, pElem, pStruct);
else
{
auto it = pMaster->mStructTemplates.find(pStruct->mSourceFile);
CStructTemplate *pOriginal = pMaster->GetStructAtSource(pStruct->mSourceFile);
if (it != pMaster->mStructTemplates.end())
SavePropertyOverrides(pDoc, pElem, pStruct, it->second);
if (pOriginal)
SavePropertyOverrides(pDoc, pElem, pStruct, pOriginal);
pElem->SetAttribute("template", *pStruct->mSourceFile);
}

View File

@ -11,14 +11,15 @@ class 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, CMasterTemplate *pMaster);
static void SaveEnumTemplate(CEnumTemplate *pTemp, CMasterTemplate *pMaster);
static void SaveBitfieldTemplate(CBitfieldTemplate *pTemp, CMasterTemplate *pMaster);
static void SaveProperties(tinyxml2::XMLDocument *pDoc, tinyxml2::XMLElement *pParent, CStructTemplate *pTemp, CMasterTemplate *pMaster);
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);

View File

@ -9,7 +9,7 @@ const TString CTemplateLoader::mskGameListPath = CTemplateLoader::mskTemplatesDi
using namespace tinyxml2;
IPropertyTemplate* CTemplateLoader::LoadProperty(XMLElement *pElem, CStructTemplate *pStruct, const TString& rkTemplateName)
IPropertyTemplate* CTemplateLoader::LoadProperty(XMLElement *pElem, CScriptTemplate *pScript, CStructTemplate *pStruct, const TString& rkTemplateName)
{
TString NodeType = TString(pElem->Name()).ToLower();
TString IDAttr = TString(pElem->Attribute("ID")).ToLower();
@ -60,7 +60,7 @@ IPropertyTemplate* CTemplateLoader::LoadProperty(XMLElement *pElem, CStructTempl
return nullptr;
}
pProp = CreateProperty(ID, Type, Name, pStruct);
pProp = CreateProperty(ID, Type, Name, pScript, pStruct);
if (!pProp)
{
@ -162,15 +162,15 @@ IPropertyTemplate* CTemplateLoader::LoadProperty(XMLElement *pElem, CStructTempl
XMLElement *pProperties = pElem->FirstChildElement("properties");
if (pProperties)
LoadProperties(pProperties, pStruct, rkTemplateName);
LoadProperties(pProperties, pScript, pStruct, rkTemplateName);
}
CMasterTemplate::AddProperty(pProp, mMasterDir + rkTemplateName);
return pProp;
}
#define CREATE_PROP_TEMP(Class) new Class(ID, rkName, eNoCookPreference, pStruct)
IPropertyTemplate* CTemplateLoader::CreateProperty(u32 ID, EPropertyType Type, const TString& rkName, CStructTemplate *pStruct)
#define CREATE_PROP_TEMP(Class) new Class(ID, rkName, eNoCookPreference, pScript, mpMaster, pStruct)
IPropertyTemplate* CTemplateLoader::CreateProperty(u32 ID, EPropertyType Type, const TString& rkName, CScriptTemplate *pScript, CStructTemplate *pStruct)
{
IPropertyTemplate *pOut = pStruct->PropertyByID(ID);
@ -216,7 +216,7 @@ void CTemplateLoader::LoadStructTemplate(const TString& rkTemplateFileName, CStr
if (pStruct->Type() == eStructProperty)
{
pSource = new CStructTemplate(-1, nullptr);
pSource = new CStructTemplate(-1, nullptr, mpMaster);
pRootElem = Doc.FirstChildElement("struct");
if (!pRootElem)
@ -238,6 +238,7 @@ void CTemplateLoader::LoadStructTemplate(const TString& rkTemplateFileName, CStr
else if (pStruct->Type() == eArrayProperty)
{
pSource = new CArrayTemplate(-1, nullptr, mpMaster);
pRootElem = Doc.FirstChildElement("array");
if (!pRootElem)
@ -246,15 +247,19 @@ void CTemplateLoader::LoadStructTemplate(const TString& rkTemplateFileName, CStr
return;
}
}
pSource->mSourceFile = rkTemplateFileName;
TString NameAttr = TString(pRootElem->Attribute("name"));
if (!NameAttr.IsEmpty())
pSource->mName = NameAttr;
// Read sub-properties
XMLElement *pSubPropsElem = pRootElem->FirstChildElement("properties");
if (pSubPropsElem)
{
LoadProperties(pSubPropsElem, pSource, rkTemplateFileName);
LoadProperties(pSubPropsElem, nullptr, pSource, rkTemplateFileName);
mpMaster->mStructTemplates[rkTemplateFileName] = pSource;
pSource->mSourceFile = rkTemplateFileName;
}
else
@ -278,6 +283,7 @@ void CTemplateLoader::LoadEnumTemplate(const TString& rkTemplateFileName, CEnumT
if (!Doc.Error())
{
pEnum->mSourceFile = rkTemplateFileName;
XMLElement *pRootElem = Doc.FirstChildElement("enum");
if (!pRootElem)
@ -294,7 +300,6 @@ void CTemplateLoader::LoadEnumTemplate(const TString& rkTemplateFileName, CEnumT
else
Log::Error(rkTemplateFileName + ": There is no \"enumerators\" block element");
pEnum->mSourceFile = rkTemplateFileName;
}
}
@ -305,6 +310,7 @@ void CTemplateLoader::LoadBitfieldTemplate(const TString& rkTemplateFileName, CB
if (!Doc.Error())
{
pBitfield->mSourceFile = rkTemplateFileName;
XMLElement *pRootElem = Doc.FirstChildElement("bitfield");
if (!pRootElem)
@ -320,12 +326,10 @@ void CTemplateLoader::LoadBitfieldTemplate(const TString& rkTemplateFileName, CB
else
Log::Error(rkTemplateFileName + ": There is no \"flags\" block element");
pBitfield->mSourceFile = rkTemplateFileName;
}
}
void CTemplateLoader::LoadProperties(XMLElement *pPropertiesElem, CStructTemplate *pStruct, const TString& rkTemplateName)
void CTemplateLoader::LoadProperties(XMLElement *pPropertiesElem, CScriptTemplate *pScript, CStructTemplate *pStruct, const TString& rkTemplateName)
{
XMLElement *pChild = pPropertiesElem->FirstChildElement();
@ -341,7 +345,7 @@ void CTemplateLoader::LoadProperties(XMLElement *pPropertiesElem, CStructTemplat
// LoadProperty adds newly created properties to the struct, so we don't need to do anything other than call it for each sub-element.
else
{
LoadProperty(pChild, pStruct, rkTemplateName);
LoadProperty(pChild, pScript, pStruct, rkTemplateName);
}
pChild = pChild->NextSiblingElement();
@ -406,7 +410,7 @@ CScriptTemplate* CTemplateLoader::LoadScriptTemplate(XMLDocument *pDoc, const TS
{
CScriptTemplate *pScript = new CScriptTemplate(mpMaster);
pScript->mObjectID = ObjectID;
pScript->mpBaseStruct = new CStructTemplate(-1, nullptr);
pScript->mpBaseStruct = new CStructTemplate(-1, nullptr, mpMaster);
pScript->mSourceFile = rkTemplateName;
XMLElement *pRoot = pDoc->FirstChildElement("ScriptTemplate");
@ -424,7 +428,7 @@ CScriptTemplate* CTemplateLoader::LoadScriptTemplate(XMLDocument *pDoc, const TS
XMLElement *pPropsElem = pRoot->FirstChildElement("properties");
if (pPropsElem)
LoadProperties(pPropsElem, pScript->mpBaseStruct, rkTemplateName);
LoadProperties(pPropsElem, pScript, pScript->mpBaseStruct, rkTemplateName);
else
Log::Error(rkTemplateName + ": There is no \"properties\" block element");

View File

@ -20,14 +20,14 @@ class CTemplateLoader
: mTemplatesDir(rkTemplatesDir) {}
// Load Property
IPropertyTemplate* LoadProperty(tinyxml2::XMLElement *pElem, CStructTemplate *pParentStruct, const TString& rkTemplateName);
IPropertyTemplate* CreateProperty(u32 ID, EPropertyType Type, const TString& rkName, CStructTemplate *pStruct);
IPropertyTemplate* LoadProperty(tinyxml2::XMLElement *pElem, CScriptTemplate *pScript, CStructTemplate *pParentStruct, const TString& rkTemplateName);
IPropertyTemplate* CreateProperty(u32 ID, EPropertyType Type, const TString& rkName, CScriptTemplate *pScript, CStructTemplate *pStruct);
void LoadStructTemplate(const TString& rkTemplateFileName, CStructTemplate *pStruct);
void LoadEnumTemplate(const TString& rkTemplateFileName, CEnumTemplate *pEnum);
void LoadBitfieldTemplate(const TString& rkTemplateFileName, CBitfieldTemplate *pBitfield);
void LoadProperties(tinyxml2::XMLElement *pPropertiesElem, CStructTemplate *pStruct, const TString& rkTemplateName);
void LoadProperties(tinyxml2::XMLElement *pPropertiesElem, CScriptTemplate *pScript, CStructTemplate *pStruct, const TString& rkTemplateName);
void LoadEnumerators(tinyxml2::XMLElement *pEnumeratorsElem, CEnumTemplate *pEnum, const TString& rkTemplateName);
void LoadBitFlags(tinyxml2::XMLElement *pFlagsElem, CBitfieldTemplate *pBitfield, const TString& rkTemplateName);

View File

@ -104,6 +104,16 @@ TString CMasterTemplate::GetDirectory() const
return mSourceFile.GetFileDirectory();
}
CStructTemplate* CMasterTemplate::GetStructAtSource(const TString& rkSource)
{
auto InfoIt = mStructTemplates.find(rkSource);
if (InfoIt != mStructTemplates.end())
return InfoIt->second;
else return nullptr;
}
bool CMasterTemplate::IsLoadedSuccessfully()
{
return mFullyLoaded;
@ -140,46 +150,92 @@ TString CMasterTemplate::GetPropertyName(u32 PropertyID)
return "Unknown";
}
void CMasterTemplate::AddProperty(IPropertyTemplate *pTemp, const TString& rkTemplateName)
u32 CMasterTemplate::CreatePropertyID(IPropertyTemplate *pTemp)
{
auto it = smIDMap.find(pTemp->PropertyID());
// 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).
TString IDString = pTemp->IDString(false);
TString Source;
CStructTemplate *pStruct = pTemp->Parent();
while (pStruct)
{
Source = pStruct->SourceFile();
if (!Source.IsEmpty()) break;
IDString.Prepend(pStruct->IDString(false) + ":");
pStruct = pStruct->Parent();
}
return IDString.Hash32() * Source.Hash32();
}
void CMasterTemplate::AddProperty(IPropertyTemplate *pTemp, const TString& rkTemplateName /*= ""*/)
{
u32 ID;
if (pTemp->Game() >= eEchoesDemo)
ID = pTemp->PropertyID();
// Use a different ID for MP1
else
{
// For MP1 we only really need to track properties that come from struct templates.
if (!pTemp->IsFromStructTemplate()) return;
else ID = CreatePropertyID(pTemp);
}
auto it = smIDMap.find(ID);
// Add this property/template to existing ID info
if (it != smIDMap.end())
{
SPropIDInfo& rInfo = it->second;
bool NewTemplate = true;
rInfo.PropertyList.push_back(pTemp);
for (u32 iTemp = 0; iTemp < rInfo.XMLList.size(); iTemp++)
if (!rkTemplateName.IsEmpty())
{
if (rInfo.XMLList[iTemp] == rkTemplateName)
bool NewTemplate = true;
for (u32 iTemp = 0; iTemp < rInfo.XMLList.size(); iTemp++)
{
NewTemplate = false;
break;
if (rInfo.XMLList[iTemp] == rkTemplateName)
{
NewTemplate = false;
break;
}
}
if (NewTemplate)
rInfo.XMLList.push_back(rkTemplateName);
}
if (NewTemplate)
rInfo.XMLList.push_back(rkTemplateName);
it->second.PropertyList.push_back(pTemp);
}
// Create new ID info
else
{
SPropIDInfo Info;
Info.XMLList.push_back(rkTemplateName);
if (!rkTemplateName.IsEmpty()) Info.XMLList.push_back(rkTemplateName);
Info.PropertyList.push_back(pTemp);
smIDMap[pTemp->PropertyID()] = Info;
smIDMap[ID] = Info;
}
}
void CMasterTemplate::RenameProperty(u32 ID, const TString& rkNewName)
void CMasterTemplate::RenameProperty(IPropertyTemplate *pTemp, const TString& rkNewName)
{
auto NameIt = smPropertyNames.find(ID);
TString CurName = (NameIt == smPropertyNames.end() ? "" : NameIt->second);
u32 ID = pTemp->PropertyID();
if (ID <= 0xFF) ID = CreatePropertyID(pTemp);
// Master name list
auto NameIt = smPropertyNames.find(ID);
TString Original;
if (NameIt != smPropertyNames.end())
{
Original = NameIt->second;
smPropertyNames[ID] = rkNewName;
}
// Properties
auto InfoIt = smIDMap.find(ID);
if (InfoIt != smIDMap.end())
@ -188,18 +244,13 @@ void CMasterTemplate::RenameProperty(u32 ID, const TString& rkNewName)
for (u32 iTemp = 0; iTemp < rkInfo.PropertyList.size(); iTemp++)
{
IPropertyTemplate *pTemp = rkInfo.PropertyList[iTemp];
if (pTemp->Name() == CurName)
pTemp->SetName(rkNewName);
if (Original.IsEmpty() || rkInfo.PropertyList[iTemp]->Name() == Original)
rkInfo.PropertyList[iTemp]->SetName(rkNewName);
}
}
if (NameIt != smPropertyNames.end())
smPropertyNames[ID] = rkNewName;
}
std::vector<TString> CMasterTemplate::GetTemplatesUsingID(u32 ID)
std::vector<TString> CMasterTemplate::GetXMLsUsingID(u32 ID)
{
auto InfoIt = smIDMap.find(ID);
@ -212,6 +263,21 @@ std::vector<TString> CMasterTemplate::GetTemplatesUsingID(u32 ID)
return std::vector<TString>();
}
const std::vector<IPropertyTemplate*>* CMasterTemplate::GetTemplatesWithMatchingID(IPropertyTemplate *pTemp)
{
u32 ID = pTemp->PropertyID();
if (ID <= 0xFF) ID = CreatePropertyID(pTemp);
auto InfoIt = smIDMap.find(ID);
if (InfoIt != smIDMap.end())
{
const SPropIDInfo& rkInfo = InfoIt->second;
return &rkInfo.PropertyList;
}
return nullptr;
}
std::map<u32, CMasterTemplate::SPropIDInfo> CMasterTemplate::smIDMap;
std::map<EGame, CMasterTemplate*> CMasterTemplate::smMasterMap;
std::map<u32, TString> CMasterTemplate::smPropertyNames;

View File

@ -53,14 +53,17 @@ public:
TString MessageByID(const CFourCC& MessageID);
TString MessageByIndex(u32 Index);
TString GetDirectory() const;
CStructTemplate* GetStructAtSource(const TString& rkSource);
bool IsLoadedSuccessfully();
static CMasterTemplate* GetMasterForGame(EGame Game);
static std::list<CMasterTemplate*> GetMasterList();
static TString GetPropertyName(u32 PropertyID);
static void AddProperty(IPropertyTemplate *pTemp, const TString& rkTemplateName);
static void RenameProperty(u32 ID, const TString& rkNewName);
static std::vector<TString> GetTemplatesUsingID(u32 ID);
static u32 CreatePropertyID(IPropertyTemplate *pTemp);
static void AddProperty(IPropertyTemplate *pTemp, const TString& rkTemplateName = "");
static void RenameProperty(IPropertyTemplate *pTemp, const TString& rkNewName);
static std::vector<TString> GetXMLsUsingID(u32 ID);
static const std::vector<IPropertyTemplate*>* GetTemplatesWithMatchingID(IPropertyTemplate *pTemp);
};
// ************ INLINE ************

View File

@ -117,6 +117,7 @@ public:
CCollisionMeshGroup* FindCollision(CPropertyStruct *pProperties);
bool HasInGameModel(CPropertyStruct *pProperties);
inline TString SourceFile() const { return mSourceFile; }
inline bool HasName() const { return !mNameIDString.IsEmpty(); }
inline bool HasPosition() const { return !mPositionIDString.IsEmpty(); }
inline bool HasRotation() const { return !mRotationIDString.IsEmpty(); }

View File

@ -1,7 +1,13 @@
#include "IPropertyTemplate.h"
#include "CMasterTemplate.h"
#include <iostream>
// ************ IPropertyTemplate ************
EGame IPropertyTemplate::Game() const
{
return (mpMasterTemplate ? mpMasterTemplate->GetGame() : eUnknownVersion);
}
bool IPropertyTemplate::IsInVersion(u32 Version) const
{
if (mAllowedVersions.empty())
@ -32,6 +38,45 @@ TIDString IPropertyTemplate::IDString(bool FullPath) const
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;
}
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();
@ -40,19 +85,19 @@ CStructTemplate* IPropertyTemplate::RootStruct()
}
// ************ CStructTemplate ************
bool CStructTemplate::IsSingleProperty() const
void CStructTemplate::CopyStructData(const CStructTemplate *pkStruct)
{
return mIsSingleProperty;
}
mVersionPropertyCounts = pkStruct->mVersionPropertyCounts;
mIsSingleProperty = pkStruct->mIsSingleProperty;
mSourceFile = pkStruct->mSourceFile;
u32 CStructTemplate::Count() const
{
return mSubProperties.size();
}
mSubProperties.resize(pkStruct->mSubProperties.size());
u32 CStructTemplate::NumVersions()
{
return mVersionPropertyCounts.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)

View File

@ -12,6 +12,7 @@
#include <vector>
typedef TString TIDString;
class CMasterTemplate;
class CStructTemplate;
class IProperty;
@ -31,6 +32,8 @@ class IPropertyTemplate
protected:
CStructTemplate *mpParent;
CScriptTemplate *mpScriptTemplate;
CMasterTemplate *mpMasterTemplate;
TString mName;
TString mDescription;
u32 mID;
@ -38,17 +41,21 @@ protected:
std::vector<u32> mAllowedVersions;
public:
IPropertyTemplate(u32 ID, CStructTemplate *pParent = 0)
IPropertyTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: mID(ID)
, mpParent(pParent)
, mpScriptTemplate(pScript)
, mpMasterTemplate(pMaster)
, mName("UNSET PROPERTY NAME")
, mCookPreference(eNoCookPreference)
{
}
IPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
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)
{
@ -58,7 +65,7 @@ public:
virtual bool CanHaveDefault() const = 0;
virtual bool IsNumerical() const = 0;
virtual IProperty* InstantiateProperty(CPropertyStruct *pParent) = 0;
virtual IPropertyTemplate* Clone(CStructTemplate *pParent = 0) const = 0;
virtual IPropertyTemplate* Clone(CScriptTemplate *pScript, CStructTemplate *pParent = 0) const = 0;
virtual void Copy(const IPropertyTemplate *pkTemp)
{
@ -104,8 +111,12 @@ public:
mDescription = rkValue;
}
EGame Game() const;
bool IsInVersion(u32 Version) const;
TIDString IDString(bool FullPath) const;
bool IsDescendantOf(const CStructTemplate *pStruct) const;
bool IsFromStructTemplate() const;
TString FindStructSource() const;
CStructTemplate* RootStruct();
// Inline Accessors
@ -114,16 +125,19 @@ public:
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; }
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 DEFINE_TEMPLATE_CLONE(ClassName) \
virtual IPropertyTemplate* Clone(CStructTemplate *pParent = 0) const \
#define IMPLEMENT_TEMPLATE_CLONE(ClassName) \
virtual IPropertyTemplate* Clone(CScriptTemplate *pScript, CStructTemplate *pParent = 0) const \
{ \
if (!pParent) pParent = mpParent; \
ClassName *pTemp = new ClassName(mID, pParent); \
if (!pScript) pScript = mpScriptTemplate; \
ClassName *pTemp = new ClassName(mID, pScript, mpMasterTemplate, pParent); \
pTemp->Copy(this); \
return pTemp; \
}
@ -140,11 +154,11 @@ protected:
ValueClass mDefaultValue;
public:
TTypedPropertyTemplate(u32 ID, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, pParent) {}
TTypedPropertyTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, pScript, pMaster, pParent) {}
TTypedPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, rkName, CookPreference, 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; }
@ -159,7 +173,7 @@ public:
return pOut;
}
DEFINE_TEMPLATE_CLONE(TTypedPropertyTemplate)
IMPLEMENT_TEMPLATE_CLONE(TTypedPropertyTemplate)
virtual void Copy(const IPropertyTemplate *pkTemp)
{
@ -210,12 +224,12 @@ class TNumericalPropertyTemplate : public TTypedPropertyTemplate<PropType,PropTy
TString mSuffix;
public:
TNumericalPropertyTemplate(u32 ID, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, pParent)
TNumericalPropertyTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent)
{}
TNumericalPropertyTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, rkName, CookPreference, 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)
{}
@ -223,7 +237,7 @@ public:
virtual bool IsNumerical() const { return true; }
virtual bool HasValidRange() const { return (mMin != 0 || mMax != 0); }
DEFINE_TEMPLATE_CLONE(TNumericalPropertyTemplate)
IMPLEMENT_TEMPLATE_CLONE(TNumericalPropertyTemplate)
virtual void Copy(const IPropertyTemplate *pkTemp)
{
@ -307,11 +321,11 @@ class CFileTemplate : public IPropertyTemplate
TStringList mAcceptedExtensions;
public:
CFileTemplate(u32 ID, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, pParent) {}
CFileTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, pScript, pMaster, pParent) {}
CFileTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, rkName, CookPreference, pParent) {}
CFileTemplate(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 eFileProperty; }
virtual bool CanHaveDefault() const { return false; }
@ -322,7 +336,7 @@ public:
return new TFileProperty(this, pParent);
}
DEFINE_TEMPLATE_CLONE(CFileTemplate)
IMPLEMENT_TEMPLATE_CLONE(CFileTemplate)
virtual void Copy(const IPropertyTemplate *pkTemp)
{
@ -372,13 +386,13 @@ class CEnumTemplate : public TTypedPropertyTemplate<s32, eEnumProperty, CHexLong
TString mSourceFile;
public:
CEnumTemplate(u32 ID, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, pParent)
CEnumTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent)
{
}
CEnumTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, rkName, CookPreference, pParent)
CEnumTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent)
{
}
@ -393,7 +407,7 @@ public:
return pEnum;
}
DEFINE_TEMPLATE_CLONE(CEnumTemplate)
IMPLEMENT_TEMPLATE_CLONE(CEnumTemplate)
virtual void Copy(const IPropertyTemplate *pkTemp)
{
@ -413,10 +427,8 @@ public:
(mSourceFile == pkEnum->mSourceFile) );
}
inline u32 NumEnumerators() const
{
return mEnumerators.size();
}
inline TString SourceFile() const { return mSourceFile; }
inline u32 NumEnumerators() const { return mEnumerators.size(); }
u32 EnumeratorIndex(u32 enumID) const
{
@ -469,13 +481,13 @@ class CBitfieldTemplate : public TTypedPropertyTemplate<u32, eBitfieldProperty,
TString mSourceFile;
public:
CBitfieldTemplate(u32 ID, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, pParent)
CBitfieldTemplate(u32 ID, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, pScript, pMaster, pParent)
{
}
CBitfieldTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, rkName, CookPreference, pParent)
CBitfieldTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: TTypedPropertyTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent)
{
}
@ -490,7 +502,7 @@ public:
return pBitfield;
}
DEFINE_TEMPLATE_CLONE(CBitfieldTemplate)
IMPLEMENT_TEMPLATE_CLONE(CBitfieldTemplate)
virtual void Copy(const IPropertyTemplate *pkTemp)
{
@ -510,9 +522,10 @@ public:
(mSourceFile == pkBitfield->mSourceFile) );
}
u32 NumFlags() const { return mBitFlags.size(); }
TString FlagName(u32 index) const { return mBitFlags[index].Name; }
u32 FlagMask(u32 index) const { return mBitFlags[index].Mask; }
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.
@ -529,12 +542,12 @@ protected:
void DetermineVersionPropertyCounts();
public:
CStructTemplate(u32 ID, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, pParent)
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, CStructTemplate *pParent = 0)
: IPropertyTemplate(ID, rkName, CookPreference, pParent)
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()
@ -560,7 +573,7 @@ public:
return pStruct;
}
DEFINE_TEMPLATE_CLONE(CStructTemplate)
IMPLEMENT_TEMPLATE_CLONE(CStructTemplate)
virtual void Copy(const IPropertyTemplate *pkTemp)
{
@ -570,17 +583,7 @@ public:
CopyStructData(pkStruct);
}
void CopyStructData(const CStructTemplate *pkStruct)
{
mVersionPropertyCounts = pkStruct->mVersionPropertyCounts;
mIsSingleProperty = pkStruct->mIsSingleProperty;
mSourceFile = pkStruct->mSourceFile;
mSubProperties.resize(pkStruct->mSubProperties.size());
for (u32 iSub = 0; iSub < pkStruct->mSubProperties.size(); iSub++)
mSubProperties[iSub] = pkStruct->mSubProperties[iSub]->Clone(this);
}
void CopyStructData(const CStructTemplate *pkStruct);
virtual bool Matches(const IPropertyTemplate *pkTemp) const
{
@ -614,9 +617,11 @@ public:
return false;
}
bool IsSingleProperty() const;
u32 Count() const;
u32 NumVersions();
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);
@ -638,14 +643,14 @@ class CArrayTemplate : public CStructTemplate
TString mElementName;
public:
CArrayTemplate(u32 ID, CStructTemplate *pParent = 0)
: CStructTemplate(ID, pParent)
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, CStructTemplate *pParent = 0)
: CStructTemplate(ID, rkName, CookPreference, pParent)
CArrayTemplate(u32 ID, const TString& rkName, ECookPreference CookPreference, CScriptTemplate *pScript, CMasterTemplate *pMaster, CStructTemplate *pParent = 0)
: CStructTemplate(ID, rkName, CookPreference, pScript, pMaster, pParent)
{
mIsSingleProperty = true;
}
@ -657,12 +662,10 @@ public:
return new CArrayProperty(this, pParent);
}
DEFINE_TEMPLATE_CLONE(CArrayTemplate)
IMPLEMENT_TEMPLATE_CLONE(CArrayTemplate)
virtual void Copy(const IPropertyTemplate *pkTemp)
{
IPropertyTemplate::Copy(pkTemp);
CStructTemplate::Copy(pkTemp);
mElementName = static_cast<const CArrayTemplate*>(pkTemp)->mElementName;
}

View File

@ -139,7 +139,8 @@ HEADERS += \
Undo/CBasicPropertyCommand.h \
Undo/IUndoCommand.h \
WorldEditor/WEditorProperties.h \
Undo/CChangeLayerCommand.h
Undo/CChangeLayerCommand.h \
WorldEditor/CTemplateEditDialog.h
# Source Files
SOURCES += \
@ -195,7 +196,8 @@ SOURCES += \
Undo/CResizeScriptArrayCommand.cpp \
Undo/CBasicPropertyCommand.cpp \
WorldEditor/WEditorProperties.cpp \
Undo/CChangeLayerCommand.cpp
Undo/CChangeLayerCommand.cpp \
WorldEditor/CTemplateEditDialog.cpp
# UI Files
FORMS += \
@ -211,4 +213,5 @@ FORMS += \
WorldEditor/WInstancesTab.ui \
WorldEditor/WModifyTab.ui \
CErrorLogDialog.ui \
WorldEditor/CPoiMapEditDialog.ui
WorldEditor/CPoiMapEditDialog.ui \
WorldEditor/CTemplateEditDialog.ui

View File

@ -1,13 +1,16 @@
#include "CPropertyView.h"
#include "CPropertyDelegate.h"
#include "Editor/WorldEditor/CTemplateEditDialog.h"
#include <Core/Resource/Script/IPropertyTemplate.h>
#include <QEvent>
#include <QMenu>
#include <QToolTip>
CPropertyView::CPropertyView(QWidget *pParent)
: QTreeView(pParent)
, mpEditor(nullptr)
, mpMenuProperty(nullptr)
{
mpModel = new CPropertyModel(this);
mpDelegate = new CPropertyDelegate(this);
@ -15,8 +18,13 @@ CPropertyView::CPropertyView(QWidget *pParent)
setEditTriggers(AllEditTriggers);
setModel(mpModel);
setContextMenuPolicy(Qt::CustomContextMenu);
mpEditTemplateAction = new QAction("Edit template", this);
connect(mpEditTemplateAction, SIGNAL(triggered()), this, SLOT(EditPropertyTemplate()));
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(SetPersistentEditors(QModelIndex)));
connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(edit(QModelIndex)));
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CreateContextMenu(QPoint)));
connect(mpModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(SetPersistentEditors(QModelIndex)));
connect(mpModel, SIGNAL(PropertyModified(const QModelIndex&)), this, SLOT(OnPropertyModified(const QModelIndex&)));
}
@ -196,3 +204,24 @@ void CPropertyView::OnPropertyModified(const QModelIndex& rkIndex)
SetPersistentEditors(rkIndex);
}
}
void CPropertyView::CreateContextMenu(const QPoint& rkPos)
{
QModelIndex Index = indexAt(rkPos);
if (Index.isValid())
{
IProperty *pProp = mpModel->PropertyForIndex(Index, true);
mpMenuProperty = pProp;
QMenu Menu;
Menu.addAction(mpEditTemplateAction);
Menu.exec(viewport()->mapToGlobal(rkPos));
}
}
void CPropertyView::EditPropertyTemplate()
{
CTemplateEditDialog Dialog(mpMenuProperty->Template(), mpEditor);
Dialog.exec();
}

View File

@ -15,6 +15,9 @@ class CPropertyView : public QTreeView
CPropertyDelegate *mpDelegate;
CScriptObject *mpObject;
IProperty *mpMenuProperty;
QAction *mpEditTemplateAction;
public:
CPropertyView(QWidget *pParent = 0);
void setModel(QAbstractItemModel *pModel);
@ -29,6 +32,9 @@ public slots:
void SetPersistentEditors(const QModelIndex& rkIndex);
void ClosePersistentEditors(const QModelIndex& rkIndex);
void OnPropertyModified(const QModelIndex& rkIndex);
void CreateContextMenu(const QPoint& rkPos);
void EditPropertyTemplate();
};
#endif // CPROPERTYVIEW_H

View File

@ -0,0 +1,259 @@
#include "CTemplateEditDialog.h"
#include "ui_CTemplateEditDialog.h"
#include "Editor/UICommon.h"
#include <Core/Resource/Cooker/CTemplateWriter.h>
#include <Core/Resource/Factory/CTemplateLoader.h>
#include <Core/Resource/Script/CMasterTemplate.h>
CTemplateEditDialog::CTemplateEditDialog(IPropertyTemplate *pTemplate, QWidget *pParent)
: QDialog(pParent)
, ui(new Ui::CTemplateEditDialog)
, mpTemplate(pTemplate)
{
ui->setupUi(this);
mGame = pTemplate->Game();
mOriginalName = pTemplate->Name();
mOriginalDescription = pTemplate->Description();
ui->IDDisplayLabel->setText(TO_QSTRING(pTemplate->IDString(false)));
ui->PathDisplayLabel->setText(TO_QSTRING(pTemplate->IDString(true)));
ui->NameLineEdit->setText(TO_QSTRING(pTemplate->Name()));
ui->DescriptionTextEdit->setPlainText(TO_QSTRING(pTemplate->Description()));
if (mGame <= ePrime)
{
ui->TemplatesGroupBox->hide();
ui->RenameAllCheckBox->setText("Rename all copies of this property");
resize(width(), minimumHeight());
}
else
{
CTemplateLoader::LoadAllGames();
std::vector<TString> TemplateList = CMasterTemplate::GetXMLsUsingID(pTemplate->PropertyID());
for (u32 iTemp = 0; iTemp < TemplateList.size(); iTemp++)
ui->TemplatesListWidget->addItem(TO_QSTRING(TemplateList[iTemp]));
}
TString Source;
if (mpTemplate->Type() == eStructProperty || mpTemplate->Type() == eArrayProperty)
Source = static_cast<CStructTemplate*>(mpTemplate)->SourceFile();
else if (mpTemplate->Type() == eEnumProperty)
Source = static_cast<CEnumTemplate*>(mpTemplate)->SourceFile();
else if (mpTemplate->Type() == eBitfieldProperty)
Source = static_cast<CBitfieldTemplate*>(mpTemplate)->SourceFile();
if (Source.IsEmpty())
{
CStructTemplate *pParent = mpTemplate->Parent();
while (pParent)
{
Source = pParent->SourceFile();
if (!Source.IsEmpty()) break;
pParent = pParent->Parent();
}
}
if (Source.IsEmpty())
{
if (mpTemplate->ScriptTemplate())
Source = mpTemplate->ScriptTemplate()->SourceFile();
if (Source.IsEmpty())
Source = "None";
}
ui->SourceFileDisplayLabel->setText(TO_QSTRING(Source));
connect(ui->ButtonBox, SIGNAL(accepted()), this, SLOT(ApplyChanges()));
connect(ui->ButtonBox, SIGNAL(rejected()), this, SLOT(close()));
}
CTemplateEditDialog::~CTemplateEditDialog()
{
delete ui;
}
// ************ PUBLIC SLOTS ************
void CTemplateEditDialog::ApplyChanges()
{
FindEquivalentProperties(mpTemplate);
bool NeedsListResave = false;
bool RenameAll = ui->RenameAllCheckBox->isChecked();
TString NewName = TO_TSTRING(ui->NameLineEdit->text());
if (NewName.IsEmpty()) NewName = "Unknown";
if (mOriginalName != NewName)
{
// Rename properties
if (RenameAll && (mGame >= eEchoesDemo || mpTemplate->IsFromStructTemplate()))
{
CMasterTemplate::RenameProperty(mpTemplate, NewName);
// Add modified templates to pending resave list
const std::vector<IPropertyTemplate*> *pList = CMasterTemplate::GetTemplatesWithMatchingID(mpTemplate);
if (pList)
{
for (u32 iTemp = 0; iTemp < pList->size(); iTemp++)
AddTemplate( pList->at(iTemp) );
}
}
mpTemplate->SetName(NewName); // If mpTemplate has an overridden name then CMasterTemplate::RenameProperty won't touch it
if (RenameAll && mGame >= eEchoesDemo)
NeedsListResave = true;
}
TString NewDescription = TO_TSTRING(ui->DescriptionTextEdit->toPlainText());
UpdateDescription(NewDescription);
// Resave templates
foreach (CScriptTemplate *pScript, mScriptTemplatesToResave)
CTemplateWriter::SaveScriptTemplate(pScript);
foreach (CStructTemplate *pStruct, mStructTemplatesToResave)
CTemplateWriter::SaveStructTemplate(pStruct);
if (NeedsListResave)
CTemplateWriter::SavePropertyList();
close();
}
// ************ PROTECTED ************
void CTemplateEditDialog::AddTemplate(IPropertyTemplate *pTemp)
{
if (pTemp->IsFromStructTemplate())
{
TString Source = pTemp->FindStructSource();
if (!Source.IsEmpty())
{
CStructTemplate *pStruct = pTemp->MasterTemplate()->GetStructAtSource(Source);
if (!mStructTemplatesToResave.contains(pStruct))
mStructTemplatesToResave << pStruct;
}
}
else
{
CScriptTemplate *pScript = pTemp->ScriptTemplate();
if (pScript)
{
if (!mScriptTemplatesToResave.contains(pScript))
mScriptTemplatesToResave << pScript;
}
else
{
Log::Error("Can't determine where property " + pTemp->IDString(true) + " comes from");
}
}
}
void CTemplateEditDialog::UpdateDescription(const TString& rkNewDesc)
{
mpTemplate->SetDescription(rkNewDesc);
AddTemplate(mpTemplate);
// Update all copies of this property in memory with the new description
TString SourceFile = mpTemplate->FindStructSource();
if (!SourceFile.IsEmpty())
{
const std::vector<IPropertyTemplate*> *pkTemplates = CMasterTemplate::GetTemplatesWithMatchingID(mpTemplate);
if (pkTemplates)
{
for (u32 iTemp = 0; iTemp < pkTemplates->size(); iTemp++)
{
IPropertyTemplate *pTemp = pkTemplates->at(iTemp);
if (pTemp->FindStructSource() == SourceFile && pTemp->Description() == mOriginalDescription)
pTemp->SetDescription(rkNewDesc);
}
}
}
// Update equivalent properties with new description
foreach (IPropertyTemplate *pTemp, mEquivalentProperties)
{
pTemp->SetDescription(rkNewDesc);
AddTemplate(pTemp);
}
}
void CTemplateEditDialog::FindEquivalentProperties(IPropertyTemplate *pTemp)
{
if (mGame <= ePrime) return;
// Find the equivalent version of this property in other games.
CScriptTemplate *pScript = pTemp->ScriptTemplate();
TString Source = pTemp->FindStructSource();
// Determine struct-relative ID string
TIDString IDString;
if (Source.IsEmpty())
IDString = pTemp->IDString(true);
else
{
IDString = pTemp->IDString(false);
CStructTemplate *pParent = pTemp->Parent();
while (pParent)
{
if (!pParent->SourceFile().IsEmpty()) break;
IDString.Prepend(pParent->IDString(false) + ":");
pParent = pParent->Parent();
}
}
QList<CMasterTemplate*> MasterList = QList<CMasterTemplate*>::fromStdList(CMasterTemplate::GetMasterList());
if (Source.IsEmpty())
{
u32 ObjectID = pScript->ObjectID();
foreach (CMasterTemplate *pMaster, MasterList)
{
if (pMaster == pTemp->MasterTemplate() || pMaster->GetGame() <= ePrime) continue;
CScriptTemplate *pNewScript = pMaster->TemplateByID(ObjectID);
if (pNewScript)
{
IPropertyTemplate *pNewTemp = pNewScript->BaseStruct()->PropertyByIDString(IDString);
if (pNewTemp)
mEquivalentProperties << pNewTemp;
}
}
}
else
{
foreach (CMasterTemplate *pMaster, MasterList)
{
if (pMaster == pTemp->MasterTemplate() || pMaster->GetGame() <= ePrime) continue;
CStructTemplate *pStruct = pMaster->GetStructAtSource(Source);
if (pStruct)
{
IPropertyTemplate *pNewTemp = pStruct->PropertyByIDString(IDString);
if (pNewTemp)
mEquivalentProperties << pNewTemp;
}
}
}
}

View File

@ -0,0 +1,41 @@
#ifndef CTEMPLATEEDITDIALOG_H
#define CTEMPLATEEDITDIALOG_H
#include <Core/Resource/Script/IPropertyTemplate.h>
#include <Core/Resource/Script/CMasterTemplate.h>
#include <QDialog>
namespace Ui {
class CTemplateEditDialog;
}
class CTemplateEditDialog : public QDialog
{
Q_OBJECT
Ui::CTemplateEditDialog *ui;
IPropertyTemplate *mpTemplate;
EGame mGame;
TString mOriginalName;
TString mOriginalDescription;
// These members help track what templates need to be updated and resaved after the user clicks OK
QVector<CScriptTemplate*> mScriptTemplatesToResave;
QVector<CStructTemplate*> mStructTemplatesToResave;
QVector<IPropertyTemplate*> mEquivalentProperties;
public:
CTemplateEditDialog(IPropertyTemplate *pTemplate, QWidget *pParent = 0);
~CTemplateEditDialog();
public slots:
void ApplyChanges();
protected:
void AddTemplate(IPropertyTemplate *pTemp);
void UpdateDescription(const TString& rkNewDesc);
void FindEquivalentProperties(IPropertyTemplate *pTemp);
};
#endif // CTEMPLATEEDITDIALOG_H

View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CTemplateEditDialog</class>
<widget class="QDialog" name="CTemplateEditDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>328</width>
<height>558</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit Template</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QFormLayout" name="PropertyDataForm">
<item row="0" column="0">
<widget class="QLabel" name="IDLabel">
<property name="text">
<string>ID:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="IDDisplayLabel">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>ID GOES HERE</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="PathLabel">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="PathDisplayLabel">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>PATH GOES HERE</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="NameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="NameLineEdit"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="DescriptionLabel">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPlainTextEdit" name="DescriptionTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="plainText">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="SourceFileLabel">
<property name="text">
<string>Source File:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="SourceFileDisplayLabel">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>SOURCE FILE GOES HERE</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="TemplatesGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Templates</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="TemplatesInfoLabel">
<property name="text">
<string>This property ID is used in these templates:</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="TemplatesListWidget">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="RenameAllCheckBox">
<property name="toolTip">
<string>If checked, all properties in all games that use this ID will be renamed. Otherwise, only the selected property will be renamed. This option only applies to name changes.</string>
</property>
<property name="text">
<string>Apply name changes to all properties using this ID</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="WarningLabel">
<property name="text">
<string>&lt;b&gt;WARNING: Template edits cannot be undone&lt;/b&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="ButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>ButtonBox</sender>
<signal>accepted()</signal>
<receiver>CTemplateEditDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>ButtonBox</sender>
<signal>rejected()</signal>
<receiver>CTemplateEditDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -88,7 +88,7 @@
<property ID="0x01D82EEB" name="PART"/>
<property ID="0x01E12C84" name="TGunResources"/>
<property ID="0x01EAAB17" name="Unknown"/>
<property ID="0x01F9C5BB" name="Unknown"/>
<property ID="0x01F9C5BB" name="Look At POI"/>
<property ID="0x01FBA748" name="SCAN"/>
<property ID="0x020C78BB" name="Turn Speed"/>
<property ID="0x02149892" name="Completion"/>
@ -649,7 +649,7 @@
<property ID="0x0FBCE3FB" name="Unknown"/>
<property ID="0x0FC0B9E3" name="Unknown"/>
<property ID="0x0FC813A7" name="SCAN"/>
<property ID="0x0FC966DC" name="DCLN"/>
<property ID="0x0FC966DC" name="Collision"/>
<property ID="0x0FCE03CA" name="Unknown"/>
<property ID="0x0FD7D0F3" name="Unknown"/>
<property ID="0x0FDF22FC" name="Unknown"/>
@ -1067,7 +1067,7 @@
<property ID="0x191F4F62" name="Unknown"/>
<property ID="0x19275A97" name="Unknown"/>
<property ID="0x19287737" name="Unknown"/>
<property ID="0x192B0E70" name="Unknown"/>
<property ID="0x192B0E70" name="EchoParameters"/>
<property ID="0x193C048F" name="Unknown"/>
<property ID="0x193C7751" name="Unknown"/>
<property ID="0x19468F2A" name="Darkburst"/>
@ -2216,7 +2216,7 @@
<property ID="0x320723A9" name="Unknown"/>
<property ID="0x32133B39" name="Unknown"/>
<property ID="0x32152AB2" name="Unknown"/>
<property ID="0x3217DFF8" name="Start immediately"/>
<property ID="0x3217DFF8" name="Auto-Start"/>
<property ID="0x321C97A9" name="Unknown"/>
<property ID="0x321FAE5B" name="Unknown"/>
<property ID="0x3221407E" name="Unknown"/>
@ -2599,7 +2599,7 @@
<property ID="0x3AC94CF1" name="Unknown"/>
<property ID="0x3ACA31D7" name="Unknown"/>
<property ID="0x3ACD0ECC" name="Unknown"/>
<property ID="0x3AD39B31" name="Max random addition"/>
<property ID="0x3AD39B31" name="Max Random Delay"/>
<property ID="0x3ADFCFEF" name="Unknown"/>
<property ID="0x3AE5D1FA" name="Unknown"/>
<property ID="0x3AE66F80" name="Unknown"/>
@ -3031,7 +3031,7 @@
<property ID="0x44303A9C" name="Unknown"/>
<property ID="0x4432C4FE" name="Unknown"/>
<property ID="0x4432CCD6" name="Unknown"/>
<property ID="0x44335AFF" name="Time"/>
<property ID="0x44335AFF" name="Start Time"/>
<property ID="0x44337A05" name="Unknown"/>
<property ID="0x4436A388" name="Unknown"/>
<property ID="0x443FB4E4" name="Unknown"/>
@ -3237,7 +3237,7 @@
<property ID="0x48B46E55" name="Unknown"/>
<property ID="0x48B4B865" name="Unknown"/>
<property ID="0x48B54A2F" name="Unknown"/>
<property ID="0x48B5B2A2" name="Unknown"/>
<property ID="0x48B5B2A2" name="ActorMultiKeyframeData"/>
<property ID="0x48B5DEF1" name="Unknown"/>
<property ID="0x48BA8EB1" name="Unknown"/>
<property ID="0x48BE7880" name="Unknown"/>
@ -3593,7 +3593,7 @@
<property ID="0x501CC39F" name="Unknown"/>
<property ID="0x501ED3A3" name="ColliderPosition"/>
<property ID="0x50224907" name="Unknown"/>
<property ID="0x50228364" name="Unknown"/>
<property ID="0x50228364" name="BeatUpHandlerData"/>
<property ID="0x5027D1AA" name="Unknown"/>
<property ID="0x50340852" name="CMDL"/>
<property ID="0x5037A0C1" name="Unknown"/>
@ -5525,7 +5525,7 @@
<property ID="0x7BE868CE" name="PART"/>
<property ID="0x7BECDB66" name="Unknown"/>
<property ID="0x7BEE566E" name="CAUD"/>
<property ID="0x7BEF45CA" name="Reset on Zero"/>
<property ID="0x7BEF45CA" name="Loop"/>
<property ID="0x7BF5CD04" name="Unknown"/>
<property ID="0x7BFAB420" name="Unknown"/>
<property ID="0x7C018C6C" name="LaunchProjectileData"/>
@ -5940,7 +5940,7 @@
<property ID="0x85249BD5" name="Unknown"/>
<property ID="0x8527B396" name="Unknown"/>
<property ID="0x852A96D0" name="Unknown"/>
<property ID="0x852D3871" name="Damage multiplier"/>
<property ID="0x852D3871" name="Damage Multiplier"/>
<property ID="0x852D3BB0" name="Unknown"/>
<property ID="0x85437C89" name="Unknown"/>
<property ID="0x854E412D" name="Unknown"/>
@ -6680,7 +6680,7 @@
<property ID="0x95ED96C2" name="Unknown"/>
<property ID="0x95EE9687" name="Unknown"/>
<property ID="0x95F112BE" name="Unknown"/>
<property ID="0x95F8D644" name="SpecialFunction Type"/>
<property ID="0x95F8D644" name="Function"/>
<property ID="0x95FDEA28" name="Unknown"/>
<property ID="0x9603A544" name="Unknown"/>
<property ID="0x9605AAD3" name="Unknown"/>
@ -8244,7 +8244,7 @@
<property ID="0xB93990E6" name="Unknown"/>
<property ID="0xB93E46E5" name="WPSC"/>
<property ID="0xB9413FE6" name="CAUD"/>
<property ID="0xB94E9BE7" name="SCAN"/>
<property ID="0xB94E9BE7" name="Scan File"/>
<property ID="0xB956F379" name="Unknown"/>
<property ID="0xB95725AC" name="Unknown"/>
<property ID="0xB95C4953" name="Unknown"/>
@ -9435,7 +9435,7 @@
<property ID="0xD2F678EB" name="Unknown"/>
<property ID="0xD2FA7631" name="Unknown"/>
<property ID="0xD2FB0FED" name="Unknown"/>
<property ID="0xD2FD4F74" name="Unknown"/>
<property ID="0xD2FD4F74" name="ControlCommand"/>
<property ID="0xD3023E6C" name="Unknown"/>
<property ID="0xD3049E04" name="Unknown"/>
<property ID="0xD3056808" name="Unknown"/>
@ -9542,7 +9542,7 @@
<property ID="0xD5388116" name="Unknown"/>
<property ID="0xD53F059B" name="PART"/>
<property ID="0xD5417338" name="Unknown"/>
<property ID="0xD545F36B" name="Unknown"/>
<property ID="0xD545F36B" name="PickupData"/>
<property ID="0xD54A5BD8" name="CAUD"/>
<property ID="0xD54D6FAD" name="Unknown"/>
<property ID="0xD5505EA4" name="Unknown"/>
@ -11046,7 +11046,7 @@
<property ID="0xF68EADC9" name="Unknown"/>
<property ID="0xF69BED49" name="Unknown"/>
<property ID="0xF6A752E3" name="Always 0"/>
<property ID="0xF6AE5D7C" name="Unknown"/>
<property ID="0xF6AE5D7C" name="ControlCommand"/>
<property ID="0xF6B051B3" name="Unknown"/>
<property ID="0xF6B3C17F" name="Unknown"/>
<property ID="0xF6B9A631" name="Unknown"/>

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="InventorySlot">
<enumerators>
<enumerator ID="0xB22FD89B" name="Unknown 1"/>
<enumerator ID="0x0AB70F9F" name="Unknown 2"/>
<enumerator ID="0x7EC6E111" name="Unknown 3"/>
<enumerator ID="0x556483BA" name="Unknown 4"/>
<enumerator ID="0x28B8C79F" name="Unknown 5"/>
<enumerator ID="0x288E1995" name="Unknown 6"/>
<enumerator ID="0x20452B38" name="Unknown 7"/>
<enumerator ID="0xA08E45BD" name="Unknown 8"/>
<enumerator ID="0x9302608B" name="Unknown 9"/>
<enumerator ID="0x6242D55B" name="Unknown 10"/>
<enumerator ID="0x652F1142" name="Unknown 11"/>
<enumerator ID="0x122821D4" name="Unknown 12"/>
<enumerator ID="0x6BF49970" name="Unknown 13"/>
<enumerator ID="0x67AD9570" name="Unknown 14"/>
<enumerator ID="0xAF376DBC" name="Unknown 15"/>
<enumerator ID="0xC2614252" name="Unknown 16"/>
<enumerator ID="0xE6880EBF" name="Unknown 17"/>
<enumerator ID="0x4CE83DAB" name="Unknown 18"/>
<enumerator ID="0x3132788C" name="Unknown 19"/>
<enumerator ID="0x13F9BA3C" name="Unknown 20"/>
<enumerator ID="0x0B678DCF" name="Unknown 21"/>
<enumerator ID="0x926EDC75" name="Unknown 22"/>
<enumerator ID="0xE569ECE3" name="Unknown 23"/>
<enumerator ID="0x7B0D7940" name="Unknown 24"/>
<enumerator ID="0x0C0A49D6" name="Unknown 25"/>
<enumerator ID="0x9503186C" name="Unknown 26"/>
<enumerator ID="0xE20428FA" name="Unknown 27"/>
<enumerator ID="0x72BB356B" name="Unknown 28"/>
<enumerator ID="0x58839E3B" name="Unknown 29"/>
<enumerator ID="0xC18ACF81" name="Unknown 30"/>
<enumerator ID="0xB68DFF17" name="Unknown 31"/>
<enumerator ID="0x5D1C98AE" name="Unknown 32"/>
<enumerator ID="0xC415C914" name="Unknown 33"/>
<enumerator ID="0xB312F982" name="Unknown 34"/>
<enumerator ID="0x2D766C21" name="Unknown 35"/>
<enumerator ID="0x5A715CB7" name="Unknown 36"/>
<enumerator ID="0xC3780D0D" name="Unknown 37"/>
<enumerator ID="0xB47F3D9B" name="Unknown 38"/>
<enumerator ID="0x24C0200A" name="Unknown 39"/>
<enumerator ID="0xF1925BC3" name="Unknown 40"/>
<enumerator ID="0xB82D38C0" name="Unknown 41"/>
<enumerator ID="0x00F1201C" name="Unknown 42"/>
<enumerator ID="0xE3006233" name="Unknown 43"/>
<enumerator ID="0xBCF65B69" name="Unknown 44"/>
<enumerator ID="0x7F7E9C47" name="Unknown 45"/>
</enumerators>
</enum>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum name="Item">
<enumerators>
<enumerator ID="0xB22FD89B" name="Banana"/>
<enumerator ID="0x0AB70F9F" name="Banana Coin"/>
<enumerator ID="0x7EC6E111" name="Player 1 Dead"/>
<enumerator ID="0x556483BA" name="Player 2 Dead"/>
<enumerator ID="0x28B8C79F" name="Unknown 1"/>
<enumerator ID="0x288E1995" name="Unknown 2"/>
<enumerator ID="0x20452B38" name="1UP"/>
<enumerator ID="0xA08E45BD" name="Unknown 3"/>
<enumerator ID="0x9302608B" name="Puzzle Piece"/>
<enumerator ID="0x6242D55B" name="KONG - K"/>
<enumerator ID="0x652F1142" name="KONG - O"/>
<enumerator ID="0x122821D4" name="KONG - N"/>
<enumerator ID="0x6BF49970" name="KONG - G"/>
<enumerator ID="0x67AD9570" name="Super Guide Available"/>
<enumerator ID="0xAF376DBC" name="Unknown 4"/>
<enumerator ID="0xC2614252" name="Unknown 5"/>
<enumerator ID="0xE6880EBF" name="Unknown 6"/>
<enumerator ID="0x4CE83DAB" name="Unknown 7"/>
<enumerator ID="0x3132788C" name="Unknown 8"/>
<enumerator ID="0x13F9BA3C" name="Unknown 9"/>
<enumerator ID="0x0B678DCF" name="Key 1 (Jungle)"/>
<enumerator ID="0x926EDC75" name="Key 2 (Beach)"/>
<enumerator ID="0xE569ECE3" name="Key 3 (Ruins)"/>
<enumerator ID="0x7B0D7940" name="Key 4 (Cave)"/>
<enumerator ID="0x0C0A49D6" name="Key 5 (Forest)"/>
<enumerator ID="0x9503186C" name="Key 6 (Cliff)"/>
<enumerator ID="0xE20428FA" name="Key 7 (Factory)"/>
<enumerator ID="0x72BB356B" name="Key 8 (Volcano)"/>
<enumerator ID="0x58839E3B" name="Factory Key L5"/>
<enumerator ID="0xC18ACF81" name="Factory Key L6"/>
<enumerator ID="0xB68DFF17" name="Factory Key L7"/>
<enumerator ID="0x5D1C98AE" name="Unknown 10"/>
<enumerator ID="0xC415C914" name="Unknown 11"/>
<enumerator ID="0xB312F982" name="Unknown 12"/>
<enumerator ID="0x2D766C21" name="Unknown 13"/>
<enumerator ID="0x5A715CB7" name="Unknown 14"/>
<enumerator ID="0xC3780D0D" name="Unknown 15"/>
<enumerator ID="0xB47F3D9B" name="Unknown 16"/>
<enumerator ID="0x24C0200A" name="Unknown 17"/>
<enumerator ID="0xF1925BC3" name="Unknown 18"/>
<enumerator ID="0xB82D38C0" name="Unknown 19"/>
<enumerator ID="0x00F1201C" name="Unknown 20"/>
<enumerator ID="0xE3006233" name="Mirror Mode"/>
<enumerator ID="0xBCF65B69" name="Tiki Tong Award"/>
<enumerator ID="0x7F7E9C47" name="Heart"/>
</enumerators>
</enum>

View File

@ -6,7 +6,7 @@
<property ID="0x87C8B399" type="bool">
<default>false</default>
</property>
<enum ID="0xE7338932" template="Enums/InventorySlot.xml">
<enum ID="0xE7338932" template="Enums/Item.xml">
<default>0xB22FD89B</default>
</enum>
</properties>

View File

@ -17,7 +17,7 @@
<struct ID="0x7E397FED" template="Structs/ActorParameters.xml"/>
<struct ID="0xD545F36B" type="multi">
<properties>
<enum ID="0xA02EF0C4" template="Enums/InventorySlot.xml">
<enum ID="0xA02EF0C4" template="Enums/Item.xml">
<default>0xB22FD89B</default>
</enum>
<property ID="0x28C71B54" type="long">

View File

@ -76,7 +76,7 @@
<property ID="0xB581574B" type="long">
<default>0</default>
</property>
<enum ID="0x3FA164BC" template="Enums/InventorySlot.xml">
<enum ID="0x3FA164BC" template="Enums/Item.xml">
<default>0xB22FD89B</default>
</enum>
</properties>

View File

@ -8,9 +8,11 @@
</property>
<property ID="0x3AD39B31" type="float">
<default>0.0</default>
<description>A random value between this number and 0 will be added to the timer's start time.</description>
</property>
<property ID="0x3217DFF8" type="bool">
<default>false</default>
<description>If enabled, the timer will start ticking automatically on load. Otherwise, it will need to be started with a script message.</description>
</property>
<property ID="0xEDA47FF6" type="bool">
<default>false</default>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<struct name="BeatUpHandlerStruct" type="multi">
<properties>
<enum ID="0xB3E3E1E3" template="Enums/InventorySlot.xml">
<enum ID="0xB3E3E1E3" template="Enums/Item.xml">
<default>0xB22FD89B</default>
</enum>
<property ID="0x8FA67C9E" type="long">

View File

@ -7,7 +7,7 @@
<property ID="0x794F9BEB" type="bool">
<default>false</default>
</property>
<enum ID="0xD3AF8D72" template="Enums/InventorySlot.xml">
<enum ID="0xD3AF8D72" template="Enums/Item.xml">
<default>0xB22FD89B</default>
</enum>
<property ID="0x03BDEA98" type="long">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<struct name="UnknownStruct41" type="multi">
<properties>
<enum ID="0xA02EF0C4" template="Enums/InventorySlot.xml">
<enum ID="0xA02EF0C4" template="Enums/Item.xml">
<default>0xB22FD89B</default>
</enum>
<property ID="0x7B7C262A" type="long">

View File

@ -6,11 +6,7 @@
<property ID="0x01" name="Position" type="vector3f"/>
<property ID="0x02" name="Rotation" type="vector3f"/>
<property ID="0x03" name="Unknown 1" type="bool"/>
<struct ID="0x04" name="ScannableParameters" type="multi">
<properties>
<property ID="0x00" name="SCAN" type="file" extensions="SCAN"/>
</properties>
</struct>
<struct ID="0x04" name="ScannableParameters" template="Structs/ScannableParameters.xml"/>
<property ID="0x05" name="Unknown 2" type="float"/>
</properties>
<states/>

View File

@ -2,11 +2,7 @@
<struct name="ActorParameters" type="multi">
<properties>
<struct ID="0x00" name="LightParameters" template="Structs/LightParameters.xml"/>
<struct ID="0x01" name="ScannableParameters" type="multi">
<properties>
<property ID="0x00" name="SCAN" type="file" extensions="SCAN"/>
</properties>
</struct>
<struct ID="0x01" name="ScannableParameters" template="Structs/ScannableParameters.xml"/>
<property ID="0x02" name="X-Ray Visor Model" type="file" extensions="CMDL"/>
<property ID="0x03" name="X-Ray Visor Skin" type="file" extensions="CSKR"/>
<property ID="0x04" name="Thermal Visor Model" type="file" extensions="CMDL"/>

View File

@ -28,7 +28,7 @@
<property ID="0x18" name="Sound ID 1" type="long"/>
<property ID="0x19" name="AnimationParameters" type="character"/>
<property ID="0x1A" name="Active" type="bool"/>
<property ID="0x1B" name="AFSM" type="file" extensions="AFSM"/>
<property ID="0x1B" name="State Machine" type="file" extensions="AFSM"/>
<property ID="0x1C" name="Unknown 8" type="float"/>
<property ID="0x1D" name="Unknown 9" type="float"/>
<property ID="0x1E" name="Unknown 10" type="float"/>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<struct name="ScannableParameters" type="multi">
<properties>
<property ID="0x00" name="Scan File" type="file" extensions="SCAN"/>
</properties>
</struct>

View File

@ -9,6 +9,7 @@
</property>
<property ID="0x01F9C5BB" type="bool">
<default>false</default>
<description>If enabled, Samus will turn to look at the POI while scanning it.</description>
</property>
</properties>
<states/>

View File

@ -8,12 +8,15 @@
</property>
<property ID="0x3AD39B31" type="float">
<default>0.0</default>
<description>A random value between this number and 0 will be added to the timer's start time.</description>
</property>
<property ID="0x7BEF45CA" type="bool">
<default>false</default>
<description>If enabled, when the timer reaches 0, it will reset back to its start time and begin ticking again.</description>
</property>
<property ID="0x3217DFF8" type="bool">
<default>false</default>
<description>If enabled, the timer will start ticking automatically on load. Otherwise, it will need to be started with a script message.</description>
</property>
</properties>
<states/>

View File

@ -8,12 +8,15 @@
</property>
<property ID="0x3AD39B31" type="float">
<default>0.0</default>
<description>A random value between this number and 0 will be added to the timer's start time.</description>
</property>
<property ID="0x7BEF45CA" type="bool">
<default>false</default>
<description>If enabled, when the timer reaches 0, it will reset back to its start time and begin ticking again.</description>
</property>
<property ID="0x3217DFF8" type="bool">
<default>false</default>
<description>If enabled, the timer will start ticking automatically on load. Otherwise, it will need to be started with a script message.</description>
</property>
</properties>
<states/>

View File

@ -8,9 +8,11 @@
</property>
<property ID="0x3AD39B31" type="float">
<default>0.0</default>
<description>A random value between this number and 0 will be added to the timer's start time.</description>
</property>
<property ID="0x3217DFF8" type="bool">
<default>false</default>
<description>If enabled, the timer will start ticking automatically on load. Otherwise, it will need to be started with a script message.</description>
</property>
<property ID="0xEDA47FF6" type="bool">
<default>false</default>

View File

@ -8,9 +8,11 @@
</property>
<property ID="0x3AD39B31" type="float">
<default>0.0</default>
<description>A random value between this number and 0 will be added to the timer's start time.</description>
</property>
<property ID="0x3217DFF8" type="bool">
<default>false</default>
<description>If enabled, the timer will start ticking automatically on load. Otherwise, it will need to be started with a script message.</description>
</property>
<property ID="0xEDA47FF6" type="bool">
<default>false</default>