mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 00:17:14 +00:00
Added "support" for MayaSpline properties
This commit is contained in:
@@ -19,13 +19,14 @@ enum EPropertyType
|
||||
eStructProperty,
|
||||
eArrayProperty,
|
||||
eCharacterProperty,
|
||||
eMayaSplineProperty,
|
||||
eUnknownProperty,
|
||||
eInvalidProperty
|
||||
};
|
||||
|
||||
// functions defined in CScriptTemplate.cpp
|
||||
EPropertyType PropStringToPropEnum(const TString& prop);
|
||||
TString PropEnumToPropString(EPropertyType prop);
|
||||
// functions defined in IPropertyTemplate.cpp
|
||||
EPropertyType PropStringToPropEnum(TString Prop);
|
||||
TString PropEnumToPropString(EPropertyType Prop);
|
||||
|
||||
#endif // EPROPERTYTYPE
|
||||
|
||||
|
||||
@@ -151,6 +151,18 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class TMayaSplineProperty : public TTypedProperty<std::vector<u8>, eMayaSplineProperty, CMayaSplineValue>
|
||||
{
|
||||
public:
|
||||
TMayaSplineProperty(IPropertyTemplate *pTemp, CPropertyStruct *pParent)
|
||||
: TTypedProperty(pTemp, pParent) {}
|
||||
|
||||
TMayaSplineProperty(IPropertyTemplate *pTemp, CPropertyStruct *pParent, const std::vector<u8>& v)
|
||||
: TTypedProperty(pTemp, pParent, v) {}
|
||||
|
||||
virtual bool MatchesDefault() { return true; }
|
||||
};
|
||||
|
||||
/*
|
||||
* CPropertyStruct is for defining structs of properties.
|
||||
*/
|
||||
|
||||
@@ -215,9 +215,9 @@ void CStructTemplate::DetermineVersionPropertyCounts()
|
||||
}
|
||||
|
||||
// ************ GLOBAL FUNCTIONS ************
|
||||
TString PropEnumToPropString(EPropertyType prop)
|
||||
TString PropEnumToPropString(EPropertyType Prop)
|
||||
{
|
||||
switch (prop)
|
||||
switch (Prop)
|
||||
{
|
||||
case eBoolProperty: return "bool";
|
||||
case eByteProperty: return "byte";
|
||||
@@ -233,6 +233,7 @@ TString PropEnumToPropString(EPropertyType prop)
|
||||
case eStructProperty: return "struct";
|
||||
case eArrayProperty: return "array";
|
||||
case eCharacterProperty: return "character";
|
||||
case eMayaSplineProperty: return "MayaSpline";
|
||||
case eUnknownProperty: return "unknown";
|
||||
|
||||
case eInvalidProperty:
|
||||
@@ -241,23 +242,25 @@ TString PropEnumToPropString(EPropertyType prop)
|
||||
}
|
||||
}
|
||||
|
||||
EPropertyType PropStringToPropEnum(const TString& rkProp)
|
||||
EPropertyType PropStringToPropEnum(TString Prop)
|
||||
{
|
||||
if (rkProp == "bool") return eBoolProperty;
|
||||
if (rkProp == "byte") return eByteProperty;
|
||||
if (rkProp == "short") return eShortProperty;
|
||||
if (rkProp == "long") return eLongProperty;
|
||||
if (rkProp == "enum") return eEnumProperty;
|
||||
if (rkProp == "bitfield") return eBitfieldProperty;
|
||||
if (rkProp == "float") return eFloatProperty;
|
||||
if (rkProp == "string") return eStringProperty;
|
||||
if (rkProp == "color") return eColorProperty;
|
||||
if (rkProp == "vector3f") return eVector3Property;
|
||||
if (rkProp == "file") return eFileProperty;
|
||||
if (rkProp == "struct") return eStructProperty;
|
||||
if (rkProp == "array") return eArrayProperty;
|
||||
if (rkProp == "character") return eCharacterProperty;
|
||||
if (rkProp == "unknown") return eUnknownProperty;
|
||||
Prop = Prop.ToLower();
|
||||
if (Prop == "bool") return eBoolProperty;
|
||||
if (Prop == "byte") return eByteProperty;
|
||||
if (Prop == "short") return eShortProperty;
|
||||
if (Prop == "long") return eLongProperty;
|
||||
if (Prop == "enum") return eEnumProperty;
|
||||
if (Prop == "bitfield") return eBitfieldProperty;
|
||||
if (Prop == "float") return eFloatProperty;
|
||||
if (Prop == "string") return eStringProperty;
|
||||
if (Prop == "color") return eColorProperty;
|
||||
if (Prop == "vector3f") return eVector3Property;
|
||||
if (Prop == "file") return eFileProperty;
|
||||
if (Prop == "struct") return eStructProperty;
|
||||
if (Prop == "array") return eArrayProperty;
|
||||
if (Prop == "character") return eCharacterProperty;
|
||||
if (Prop == "mayaspline") return eMayaSplineProperty;
|
||||
if (Prop == "unknown") return eUnknownProperty;
|
||||
return eInvalidProperty;
|
||||
}
|
||||
|
||||
|
||||
@@ -310,7 +310,43 @@ typedef TNumericalPropertyTemplate<float, eFloatProperty, CFloatValue>
|
||||
typedef TTypedPropertyTemplate<TString, eStringProperty, CStringValue, false> TStringTemplate;
|
||||
typedef TTypedPropertyTemplate<CVector3f, eVector3Property, CVector3Value, true> TVector3Template;
|
||||
typedef TTypedPropertyTemplate<CColor, eColorProperty, CColorValue, true> TColorTemplate;
|
||||
typedef TTypedPropertyTemplate<CAnimationParameters, eCharacterProperty, CCharacterValue, false> TCharacterTemplate;
|
||||
|
||||
// TCharacterTemplate and TMayaSplineTemplate - quick subclasses in order to reimplement InstantiateProperty
|
||||
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(CPropertyStruct *pParent)
|
||||
{
|
||||
return new TCharacterProperty(this, pParent);
|
||||
}
|
||||
};
|
||||
|
||||
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(CPropertyStruct *pParent)
|
||||
{
|
||||
return new TMayaSplineProperty(this, pParent);
|
||||
}
|
||||
};
|
||||
|
||||
// CFileTemplate - Property template for files. Tracks a list of file types that
|
||||
// the property is allowed to accept.
|
||||
|
||||
@@ -327,6 +327,21 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
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 CFileValue : public TTypedPropertyValue<CResourceInfo>
|
||||
{
|
||||
public:
|
||||
@@ -334,7 +349,7 @@ public:
|
||||
CFileValue(const CResourceInfo& rkInfo) { mValue = rkInfo; }
|
||||
|
||||
TString ToString() const { return ""; }
|
||||
void FromString(const TString&) { }
|
||||
void FromString(const TString&) {}
|
||||
|
||||
IPropertyValue* Clone() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user