Add Type information for Properties in EngineXMLExport

This commit is contained in:
Lukas Joergensen 2018-04-21 09:08:26 +02:00
parent a84145421f
commit 5bbda83669
3 changed files with 395 additions and 363 deletions

View file

@ -676,6 +676,8 @@ public:
prop.mFlags |= EnginePropertyGroupBegin; prop.mFlags |= EnginePropertyGroupBegin;
if (sg_tempFieldList[i].type == EndGroupFieldType) if (sg_tempFieldList[i].type == EndGroupFieldType)
prop.mFlags |= EnginePropertyGroupEnd; prop.mFlags |= EnginePropertyGroupEnd;
prop.mType = sg_tempFieldList[i].type;
props[i] = prop; props[i] = prop;
} }

View file

@ -232,6 +232,9 @@ class EnginePropertyTable
/// Combination of EnginePropertyFlags. /// Combination of EnginePropertyFlags.
U32 mFlags; U32 mFlags;
/// Type-id of the property
U32 mType;
/// Return the name of the property. /// Return the name of the property.
const char* getName() const { return mName; } const char* getName() const { return mName; }
@ -255,6 +258,9 @@ class EnginePropertyTable
/// ///
bool hideInInspectors() const { return ( mFlags & EnginePropertyHideInInspectors ); } bool hideInInspectors() const { return ( mFlags & EnginePropertyHideInInspectors ); }
/// Return the type-id of the property.
U32 getType() const { return mType; }
}; };
protected: protected:

View file

@ -467,6 +467,10 @@ static void exportType( const EngineTypeInfo* type, SimXMLDocument* xml )
} }
else else
{ {
if (property.getType() == AbstractClassRep::StartArrayFieldType
|| property.getType() == AbstractClassRep::EndArrayFieldType) {
continue;
}
xml->pushNewElement("EngineProperty"); xml->pushNewElement("EngineProperty");
xml->setAttribute("name", property.getName()); xml->setAttribute("name", property.getName());
@ -476,6 +480,26 @@ static void exportType( const EngineTypeInfo* type, SimXMLDocument* xml )
xml->setAttribute("isVisible", property.hideInInspectors() ? "0" : "1"); xml->setAttribute("isVisible", property.hideInInspectors() ? "0" : "1");
xml->setAttribute("docs", property.getDocString() ? property.getDocString() : ""); xml->setAttribute("docs", property.getDocString() ? property.getDocString() : "");
const bool isDeprecated = (property.getType() == AbstractClassRep::DeprecatedFieldType);
if (isDeprecated)
{
xml->setAttribute("type", "deprecated");
}
else
{
ConsoleBaseType *cbt = ConsoleBaseType::getType(property.getType());
if (cbt != NULL)
{
xml->setAttribute("type", cbt->getTypeClassName());
}
else
{
xml->setAttribute("type", "unknown");
}
}
xml->popElement(); xml->popElement();
} }
} }