mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 08:27:01 +00:00
Fixed incorrect LayerSwitch/LayerID templates, made IPropertyTemplate::CookPreference() virtual and overrode it for certain types, fixed a CAnimationParameters bug
This commit is contained in:
@@ -92,6 +92,7 @@ public:
|
||||
virtual bool HasValidRange() const { return false; }
|
||||
virtual TString RangeToString() const { return ""; }
|
||||
virtual TString Suffix() const { return ""; }
|
||||
virtual ECookPreference CookPreference() const { return mCookPreference; }
|
||||
|
||||
virtual void SetParam(const TString& rkParamName, const TString& rkValue)
|
||||
{
|
||||
@@ -123,7 +124,6 @@ public:
|
||||
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; }
|
||||
@@ -307,11 +307,10 @@ typedef TNumericalPropertyTemplate<s8, eByteProperty, CByteValue>
|
||||
typedef TNumericalPropertyTemplate<s16, eShortProperty, CShortValue> TShortTemplate;
|
||||
typedef TNumericalPropertyTemplate<s32, eLongProperty, CLongValue> TLongTemplate;
|
||||
typedef TNumericalPropertyTemplate<float, eFloatProperty, CFloatValue> TFloatTemplate;
|
||||
typedef TTypedPropertyTemplate<TString, eStringProperty, CStringValue, false> TStringTemplate;
|
||||
typedef TTypedPropertyTemplate<CVector3f, eVector3Property, CVector3Value, true> TVector3Template;
|
||||
typedef TTypedPropertyTemplate<CColor, eColorProperty, CColorValue, true> TColorTemplate;
|
||||
|
||||
// TCharacterTemplate and TMayaSplineTemplate - quick subclasses in order to reimplement InstantiateProperty
|
||||
// TCharacterTemplate, 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;
|
||||
@@ -326,7 +325,41 @@ public:
|
||||
|
||||
IProperty* InstantiateProperty(CPropertyStruct *pParent)
|
||||
{
|
||||
return new TCharacterProperty(this, pParent);
|
||||
return new TCharacterProperty(this, pParent, CAnimationParameters(Game()));
|
||||
}
|
||||
|
||||
ECookPreference CookPreference() const
|
||||
{
|
||||
if (mCookPreference != eNoCookPreference)
|
||||
return mCookPreference;
|
||||
else
|
||||
return eAlwaysCook;
|
||||
}
|
||||
};
|
||||
|
||||
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(CPropertyStruct *pParent)
|
||||
{
|
||||
return new TStringProperty(this, pParent);
|
||||
}
|
||||
|
||||
ECookPreference CookPreference() const
|
||||
{
|
||||
if (mCookPreference != eNoCookPreference)
|
||||
return mCookPreference;
|
||||
else
|
||||
return eAlwaysCook;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -388,6 +421,14 @@ public:
|
||||
(mAcceptedExtensions == pkFile->mAcceptedExtensions) );
|
||||
}
|
||||
|
||||
ECookPreference CookPreference() const
|
||||
{
|
||||
if (mCookPreference != eNoCookPreference)
|
||||
return mCookPreference;
|
||||
else
|
||||
return eAlwaysCook;
|
||||
}
|
||||
|
||||
bool AcceptsExtension(const TString& rkExtension)
|
||||
{
|
||||
for (auto it = mAcceptedExtensions.begin(); it != mAcceptedExtensions.end(); it++)
|
||||
@@ -653,6 +694,22 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual ECookPreference CookPreference() const
|
||||
{
|
||||
if (mCookPreference != eNoCookPreference) return mCookPreference;
|
||||
bool SubsNeverCook = true;
|
||||
|
||||
for (u32 iProp = 0; iProp < mSubProperties.size(); iProp++)
|
||||
{
|
||||
IPropertyTemplate *pProp = mSubProperties[iProp];
|
||||
ECookPreference Pref = pProp->CookPreference();
|
||||
if (Pref != eNeverCook) SubsNeverCook = false;
|
||||
if (Pref == eAlwaysCook) return eAlwaysCook;
|
||||
}
|
||||
|
||||
return (SubsNeverCook ? eNeverCook : eNoCookPreference);
|
||||
}
|
||||
|
||||
inline TString SourceFile() const { return mSourceFile; }
|
||||
inline bool IsSingleProperty() const { return mIsSingleProperty; }
|
||||
inline u32 Count() const { return mSubProperties.size(); }
|
||||
@@ -714,6 +771,14 @@ public:
|
||||
(CStructTemplate::Matches(pkTemp)) );
|
||||
}
|
||||
|
||||
ECookPreference CookPreference()
|
||||
{
|
||||
if (mCookPreference != eNoCookPreference)
|
||||
return mCookPreference;
|
||||
else
|
||||
return eAlwaysCook;
|
||||
}
|
||||
|
||||
void SetParam(const TString& rkParamName, const TString& rkValue)
|
||||
{
|
||||
if (rkParamName == "element_name")
|
||||
|
||||
Reference in New Issue
Block a user