Fixed incorrect LayerSwitch/LayerID templates, made IPropertyTemplate::CookPreference() virtual and overrode it for certain types, fixed a CAnimationParameters bug
This commit is contained in:
parent
dd4341d251
commit
a166dd8ac3
|
@ -14,6 +14,15 @@ CAnimationParameters::CAnimationParameters()
|
|||
mUnknown3 = 0;
|
||||
}
|
||||
|
||||
CAnimationParameters::CAnimationParameters(EGame Game)
|
||||
{
|
||||
mGame = Game;
|
||||
mNodeIndex = 0;
|
||||
mUnknown1 = 0;
|
||||
mUnknown2 = 0;
|
||||
mUnknown3 = 0;
|
||||
}
|
||||
|
||||
CAnimationParameters::CAnimationParameters(IInputStream& SCLY, EGame Game)
|
||||
{
|
||||
mGame = Game;
|
||||
|
|
|
@ -19,6 +19,7 @@ class CAnimationParameters
|
|||
|
||||
public:
|
||||
CAnimationParameters();
|
||||
CAnimationParameters(EGame Game);
|
||||
CAnimationParameters(IInputStream& SCLY, EGame Game);
|
||||
void Write(IOutputStream& rSCLY);
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -8662,7 +8662,7 @@
|
|||
<property ID="0xC271CFBC" name="Dark Agon Key 1"/>
|
||||
<property ID="0xC271EAF5" name="Unknown"/>
|
||||
<property ID="0xC2784287" name="Unknown"/>
|
||||
<property ID="0xC27FFA8F" name="CMDL"/>
|
||||
<property ID="0xC27FFA8F" name="Model"/>
|
||||
<property ID="0xC287B5AF" name="Unknown"/>
|
||||
<property ID="0xC288AE69" name="CMDL"/>
|
||||
<property ID="0xC28B285E" name="Unknown"/>
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
<should_cook>always</should_cook>
|
||||
</property>
|
||||
<struct ID="0x20091B54" template="Structs/SplineType.xml"/>
|
||||
<property ID="0x00DD86E2" type="color">
|
||||
<default>1.0, 1.0, 1.0, 1.0</default>
|
||||
</property>
|
||||
</properties>
|
||||
<states/>
|
||||
<messages/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</property>
|
||||
<struct ID="0x20091B54" template="Structs/SplineType.xml"/>
|
||||
<property ID="0x00DD86E2" type="color">
|
||||
<default>1.0, 0.0, 1.0, 1.0</default>
|
||||
<default>1.0, 1.0, 1.0, 1.0</default>
|
||||
</property>
|
||||
</properties>
|
||||
<states/>
|
||||
|
|
|
@ -24,6 +24,16 @@
|
|||
</property>
|
||||
</properties>
|
||||
</struct>
|
||||
<struct ID="0x1FF47DDF" type="multi">
|
||||
<should_cook>never</should_cook>
|
||||
<properties>
|
||||
<property ID="0x18C7396A" type="bool">
|
||||
<should_cook>always</should_cook>
|
||||
<default>false</default>
|
||||
</property>
|
||||
<property ID="0xBD0B7EDE" type="string"/>
|
||||
</properties>
|
||||
</struct>
|
||||
<struct ID="0x0CF33816" type="multi">
|
||||
<properties>
|
||||
<property ID="0x6FA2F8BC" type="bool">
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<struct name="LayerID" type="single">
|
||||
<properties>
|
||||
<property ID="0x00" name="Layer ID Part 1" type="long">
|
||||
<property ID="0x00" name="Layer ID 1" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x01" name="Layer ID Part 2" type="long">
|
||||
<property ID="0x01" name="Layer ID 2" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x02" name="Layer ID Part 3" type="long">
|
||||
<property ID="0x02" name="Layer ID 3" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x03" name="Layer ID Part 4" type="long">
|
||||
<property ID="0x03" name="Layer ID 4" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
</properties>
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
<struct name="LayerSwitch" type="single">
|
||||
<properties>
|
||||
<property ID="0x00" name="Area ID" type="file" extensions="UNKN"/>
|
||||
<property ID="0x01" name="Layer #" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<struct ID="0x01" name="Layer ID" template="Structs/LayerID.xml"/>
|
||||
</properties>
|
||||
</struct>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<struct name="LayerID" type="single">
|
||||
<properties>
|
||||
<property ID="0x00" name="Layer ID Part 1" type="long">
|
||||
<property ID="0x00" name="Layer ID 1" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x01" name="Layer ID Part 2" type="long">
|
||||
<property ID="0x01" name="Layer ID 2" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x02" name="Layer ID Part 3" type="long">
|
||||
<property ID="0x02" name="Layer ID 3" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x03" name="Layer ID Part 4" type="long">
|
||||
<property ID="0x03" name="Layer ID 4" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
</properties>
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
<struct name="LayerSwitch" type="single">
|
||||
<properties>
|
||||
<property ID="0x00" name="Area ID" type="file" extensions="UNKN"/>
|
||||
<property ID="0x01" name="Layer #" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<struct ID="0x01" name="Layer ID" template="Structs/LayerID.xml"/>
|
||||
</properties>
|
||||
</struct>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<struct name="LayerID" type="single">
|
||||
<properties>
|
||||
<property ID="0x00" name="Layer ID 1" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x01" name="Layer ID 2" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x02" name="Layer ID 3" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<property ID="0x03" name="Layer ID 4" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
</properties>
|
||||
</struct>
|
|
@ -2,8 +2,6 @@
|
|||
<struct name="LayerSwitch" type="single">
|
||||
<properties>
|
||||
<property ID="0x00" name="Area ID" type="file" extensions="UNKN"/>
|
||||
<property ID="0x01" name="Layer #" type="long">
|
||||
<default>0</default>
|
||||
</property>
|
||||
<struct ID="0x01" name="Layer ID" template="Structs/LayerID.xml"/>
|
||||
</properties>
|
||||
</struct>
|
||||
|
|
Loading…
Reference in New Issue