mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 00:17:14 +00:00
Added TPropCast property casting function, added support for clean/dirty state in the world editor + check for unsaved changes when the window is closed
This commit is contained in:
@@ -71,6 +71,8 @@ public:
|
||||
|
||||
~TTypedProperty() {}
|
||||
virtual EPropertyType Type() const { return TypeEnum; }
|
||||
static inline EPropertyType StaticType() { return TypeEnum; }
|
||||
|
||||
virtual TString ToString() const { return mValue.ToString(); }
|
||||
virtual IPropertyValue* RawValue() { return &mValue; }
|
||||
|
||||
@@ -124,6 +126,7 @@ public:
|
||||
}
|
||||
|
||||
EPropertyType Type() const { return eStructProperty; }
|
||||
static inline EPropertyType StaticType() { return eStructProperty; }
|
||||
|
||||
virtual void Copy(const IProperty *pkProp);
|
||||
|
||||
@@ -161,6 +164,7 @@ public:
|
||||
: CPropertyStruct(pTemp, pParent) {}
|
||||
|
||||
EPropertyType Type() const { return eArrayProperty; }
|
||||
static inline EPropertyType StaticType() { return eArrayProperty; }
|
||||
|
||||
virtual IProperty* Clone(CPropertyStruct *pParent) const
|
||||
{
|
||||
@@ -179,5 +183,14 @@ public:
|
||||
TString ElementName() const;
|
||||
};
|
||||
|
||||
/*
|
||||
* Function for casting properties. Returns null if the property is not actually the requested type.
|
||||
*/
|
||||
template <class PropertyClass>
|
||||
PropertyClass* TPropCast(IProperty *pProp)
|
||||
{
|
||||
return (pProp && pProp->Type() == PropertyClass::StaticType() ? static_cast<PropertyClass*>(pProp) : nullptr);
|
||||
}
|
||||
|
||||
#endif // IPROPERTY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user