mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
adds json back to taml
Allow taml to be compiled and read as json All of this was already there just was hidden from cmake and code was commented out so just a commit to reapply this. The rest is just some cleanup
This commit is contained in:
parent
6c9263b625
commit
7d497383da
3 changed files with 1479 additions and 1484 deletions
|
|
@ -115,7 +115,8 @@ torqueAddSourceDirectories("scene" "scene/culling" "scene/zones" "scene/mixin")
|
||||||
torqueAddSourceDirectories("math" "math/util")
|
torqueAddSourceDirectories("math" "math/util")
|
||||||
|
|
||||||
# Handle persistence
|
# Handle persistence
|
||||||
torqueAddSourceDirectories("persistence/taml" "persistence/taml/binary" "persistence/taml/xml")
|
set(TORQUE_INCLUDE_DIRECTORIES ${TORQUE_INCLUDE_DIRECTORIES} "persistence/rapidjson")
|
||||||
|
torqueAddSourceDirectories("persistence/taml" "persistence/taml/binary" "persistence/taml/xml" "persistence/taml/json")
|
||||||
|
|
||||||
# Handle Cinterface
|
# Handle Cinterface
|
||||||
torqueAddSourceDirectories("cinterface")
|
torqueAddSourceDirectories("cinterface")
|
||||||
|
|
|
||||||
|
|
@ -42,17 +42,17 @@
|
||||||
#include "persistence/taml/binary/tamlBinaryReader.h"
|
#include "persistence/taml/binary/tamlBinaryReader.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*#ifndef _TAML_JSONWRITER_H_
|
#ifndef _TAML_JSONWRITER_H_
|
||||||
#include "taml/json/tamlJSONWriter.h"
|
#include "persistence/taml/json/tamlJSONWriter.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _TAML_JSONREADER_H_
|
#ifndef _TAML_JSONREADER_H_
|
||||||
#include "taml/json/tamlJSONReader.h"
|
#include "persistence/taml/json/tamlJSONReader.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _TAML_JSONPARSER_H_
|
#ifndef _TAML_JSONPARSER_H_
|
||||||
#include "taml/json/tamlJSONParser.h"
|
#include "persistence/taml/json/tamlJSONParser.h"
|
||||||
#endif*/
|
#endif
|
||||||
|
|
||||||
#ifndef _FRAMEALLOCATOR_H_
|
#ifndef _FRAMEALLOCATOR_H_
|
||||||
#include "core/frameAllocator.h"
|
#include "core/frameAllocator.h"
|
||||||
|
|
@ -94,18 +94,16 @@ StringTableEntry tamlNamedObjectName = StringTable->insert("Name");
|
||||||
|
|
||||||
typedef Taml::TamlFormatMode _TamlFormatMode;
|
typedef Taml::TamlFormatMode _TamlFormatMode;
|
||||||
ImplementEnumType(_TamlFormatMode,
|
ImplementEnumType(_TamlFormatMode,
|
||||||
"")
|
"")
|
||||||
|
{ Taml::XmlFormat, "xml" },
|
||||||
|
{ Taml::BinaryFormat, "binary" },
|
||||||
|
{ Taml::JSONFormat, "json" }
|
||||||
|
EndImplementEnumType;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Taml::TamlFormatMode Taml::getFormatModeEnum(const char* label)
|
||||||
{
|
{
|
||||||
Taml::XmlFormat, "xml"
|
|
||||||
},
|
|
||||||
{ Taml::BinaryFormat, "binary" }//,
|
|
||||||
//{ Taml::JSONFormat, "json" }
|
|
||||||
EndImplementEnumType;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Taml::TamlFormatMode Taml::getFormatModeEnum(const char* label)
|
|
||||||
{
|
|
||||||
// Search for Mnemonic.
|
// Search for Mnemonic.
|
||||||
for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++)
|
for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++)
|
||||||
{
|
{
|
||||||
|
|
@ -117,12 +115,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
Con::warnf("Taml::getFormatModeEnum() - Invalid format of '%s'.", label);
|
Con::warnf("Taml::getFormatModeEnum() - Invalid format of '%s'.", label);
|
||||||
|
|
||||||
return Taml::InvalidFormat;
|
return Taml::InvalidFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
const char* Taml::getFormatModeDescription(const Taml::TamlFormatMode formatMode)
|
const char* Taml::getFormatModeDescription(const Taml::TamlFormatMode formatMode)
|
||||||
{
|
{
|
||||||
// Search for Mnemonic.
|
// Search for Mnemonic.
|
||||||
for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++)
|
for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++)
|
||||||
{
|
{
|
||||||
|
|
@ -134,12 +132,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
Con::warnf("Taml::getFormatModeDescription() - Invalid format mode.");
|
Con::warnf("Taml::getFormatModeDescription() - Invalid format mode.");
|
||||||
|
|
||||||
return StringTable->EmptyString();
|
return StringTable->EmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// The string-table-entries are set to string literals below because Taml is used in a static scope and the string-table cannot currently be used like that.
|
// The string-table-entries are set to string literals below because Taml is used in a static scope and the string-table cannot currently be used like that.
|
||||||
Taml::Taml() :
|
Taml::Taml() :
|
||||||
mMasterNodeId(0),
|
mMasterNodeId(0),
|
||||||
mFormatMode(XmlFormat),
|
mFormatMode(XmlFormat),
|
||||||
mJSONStrict(true),
|
mJSONStrict(true),
|
||||||
|
|
@ -150,15 +148,15 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
mProgenitorUpdate(true),
|
mProgenitorUpdate(true),
|
||||||
mAutoFormatBinaryExtension("baml"),
|
mAutoFormatBinaryExtension("baml"),
|
||||||
mAutoFormatJSONExtension("json")
|
mAutoFormatJSONExtension("json")
|
||||||
{
|
{
|
||||||
// Reset the file-path buffer.
|
// Reset the file-path buffer.
|
||||||
mFilePathBuffer[0] = 0;
|
mFilePathBuffer[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::initPersistFields()
|
void Taml::initPersistFields()
|
||||||
{
|
{
|
||||||
docsURL;
|
docsURL;
|
||||||
// Call parent.
|
// Call parent.
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
|
|
@ -172,12 +170,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
addField("AutoFormatXmlExtension", TypeString, Offset(mAutoFormatXmlExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the XML format.\n");
|
addField("AutoFormatXmlExtension", TypeString, Offset(mAutoFormatXmlExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the XML format.\n");
|
||||||
addField("AutoFormatBinaryExtension", TypeString, Offset(mAutoFormatBinaryExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the BINARY format.\n");
|
addField("AutoFormatBinaryExtension", TypeString, Offset(mAutoFormatBinaryExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the BINARY format.\n");
|
||||||
addField("AutoFormatJSONExtension", TypeString, Offset(mAutoFormatJSONExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the JSON format.\n");
|
addField("AutoFormatJSONExtension", TypeString, Offset(mAutoFormatJSONExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the JSON format.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool Taml::onAdd()
|
bool Taml::onAdd()
|
||||||
{
|
{
|
||||||
// Call parent.
|
// Call parent.
|
||||||
if (!Parent::onAdd())
|
if (!Parent::onAdd())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -189,23 +187,23 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
resetCompilation();
|
resetCompilation();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::onRemove()
|
void Taml::onRemove()
|
||||||
{
|
{
|
||||||
// Reset the compilation.
|
// Reset the compilation.
|
||||||
resetCompilation();
|
resetCompilation();
|
||||||
|
|
||||||
// Call parent.
|
// Call parent.
|
||||||
Parent::onRemove();
|
Parent::onRemove();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool Taml::write(SimObject* pSimObject, const char* pFilename)
|
bool Taml::write(SimObject* pSimObject, const char* pFilename)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_Write);
|
PROFILE_SCOPE(Taml_Write);
|
||||||
|
|
||||||
|
|
@ -247,12 +245,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
resetCompilation();
|
resetCompilation();
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
SimObject* Taml::read(const char* pFilename)
|
SimObject* Taml::read(const char* pFilename)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_Read);
|
PROFILE_SCOPE(Taml_Read);
|
||||||
|
|
||||||
|
|
@ -299,12 +297,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
return pSimObject;
|
return pSimObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool Taml::write(FileStream& stream, SimObject* pSimObject, const TamlFormatMode formatMode)
|
bool Taml::write(FileStream& stream, SimObject* pSimObject, const TamlFormatMode formatMode)
|
||||||
{
|
{
|
||||||
// Sanity!
|
// Sanity!
|
||||||
AssertFatal(pSimObject != NULL, "Cannot write a NULL object.");
|
AssertFatal(pSimObject != NULL, "Cannot write a NULL object.");
|
||||||
|
|
||||||
|
|
@ -337,11 +335,10 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
case JSONFormat:
|
case JSONFormat:
|
||||||
{
|
{
|
||||||
// Create writer.
|
// Create writer.
|
||||||
//TamlJSONWriter writer( this );
|
TamlJSONWriter writer( this );
|
||||||
|
|
||||||
// Write.
|
// Write.
|
||||||
//return writer.write( stream, pRootNode );
|
return writer.write( stream, pRootNode );
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Invalid.
|
/// Invalid.
|
||||||
|
|
@ -356,12 +353,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
// Warn.
|
// Warn.
|
||||||
Con::warnf("Taml::write() - Unknown format.");
|
Con::warnf("Taml::write() - Unknown format.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
SimObject* Taml::read(FileStream& stream, const TamlFormatMode formatMode)
|
SimObject* Taml::read(FileStream& stream, const TamlFormatMode formatMode)
|
||||||
{
|
{
|
||||||
// Format appropriately.
|
// Format appropriately.
|
||||||
switch (formatMode)
|
switch (formatMode)
|
||||||
{
|
{
|
||||||
|
|
@ -389,11 +386,10 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
case JSONFormat:
|
case JSONFormat:
|
||||||
{
|
{
|
||||||
// Create reader.
|
// Create reader.
|
||||||
//TamlJSONReader reader( this );
|
TamlJSONReader reader( this );
|
||||||
|
|
||||||
// Read.
|
// Read.
|
||||||
//return reader.read( stream );
|
return reader.read( stream );
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Invalid.
|
/// Invalid.
|
||||||
|
|
@ -408,12 +404,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
// Warn.
|
// Warn.
|
||||||
Con::warnf("Taml::read() - Unknown format.");
|
Con::warnf("Taml::read() - Unknown format.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool Taml::parse(const char* pFilename, TamlVisitor& visitor)
|
bool Taml::parse(const char* pFilename, TamlVisitor& visitor)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_Parse);
|
PROFILE_SCOPE(Taml_Parse);
|
||||||
|
|
||||||
|
|
@ -445,7 +441,7 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
case JSONFormat:
|
case JSONFormat:
|
||||||
{
|
{
|
||||||
// Parse with the visitor.
|
// Parse with the visitor.
|
||||||
/*TamlJSONParser parser;
|
TamlJSONParser parser;
|
||||||
|
|
||||||
// Are property changes needed but not supported?
|
// Are property changes needed but not supported?
|
||||||
if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() )
|
if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() )
|
||||||
|
|
@ -455,8 +451,7 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return parser.accept( pFilename, visitor ); */
|
return parser.accept( pFilename, visitor );
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case BinaryFormat:
|
case BinaryFormat:
|
||||||
|
|
@ -467,12 +462,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
// Warn.
|
// Warn.
|
||||||
Con::warnf("Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a required parser is not available.", getFormatModeDescription(formatMode), pFilename);
|
Con::warnf("Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a required parser is not available.", getFormatModeDescription(formatMode), pFilename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::resetCompilation(void)
|
void Taml::resetCompilation(void)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_ResetCompilation);
|
PROFILE_SCOPE(Taml_ResetCompilation);
|
||||||
|
|
||||||
|
|
@ -495,12 +490,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
|
|
||||||
// Reset master node Id.
|
// Reset master node Id.
|
||||||
mMasterNodeId = 0;
|
mMasterNodeId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Taml::TamlFormatMode Taml::getFileAutoFormatMode(const char* pFilename)
|
Taml::TamlFormatMode Taml::getFileAutoFormatMode(const char* pFilename)
|
||||||
{
|
{
|
||||||
// Sanity!
|
// Sanity!
|
||||||
AssertFatal(pFilename != NULL, "Taml::getFileAutoFormatMode() - Cannot auto-format using a NULL filename.");
|
AssertFatal(pFilename != NULL, "Taml::getFileAutoFormatMode() - Cannot auto-format using a NULL filename.");
|
||||||
|
|
||||||
|
|
@ -533,12 +528,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
|
|
||||||
// Use the explicitly specified format mode.
|
// Use the explicitly specified format mode.
|
||||||
return mFormatMode;
|
return mFormatMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
TamlWriteNode* Taml::compileObject(SimObject* pSimObject, const bool forceId)
|
TamlWriteNode* Taml::compileObject(SimObject* pSimObject, const bool forceId)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_CompileObject);
|
PROFILE_SCOPE(Taml_CompileObject);
|
||||||
|
|
||||||
|
|
@ -622,12 +617,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
return pNewNode;
|
return pNewNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::compileStaticFields(TamlWriteNode* pTamlWriteNode)
|
void Taml::compileStaticFields(TamlWriteNode* pTamlWriteNode)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_CompileStaticFields);
|
PROFILE_SCOPE(Taml_CompileStaticFields);
|
||||||
|
|
||||||
|
|
@ -771,24 +766,24 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
// Cleanup our created default object
|
// Cleanup our created default object
|
||||||
delete defaultConObject;
|
delete defaultConObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static S32 QSORT_CALLBACK compareFieldEntries(const void* a, const void* b)
|
static S32 QSORT_CALLBACK compareFieldEntries(const void* a, const void* b)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_CompareFieldEntries);
|
PROFILE_SCOPE(Taml_CompareFieldEntries);
|
||||||
|
|
||||||
SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a);
|
SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a);
|
||||||
SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b);
|
SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b);
|
||||||
return dStricmp(fa->slotName, fb->slotName);
|
return dStricmp(fa->slotName, fb->slotName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::compileDynamicFields(TamlWriteNode* pTamlWriteNode)
|
void Taml::compileDynamicFields(TamlWriteNode* pTamlWriteNode)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_CompileDynamicFields);
|
PROFILE_SCOPE(Taml_CompileDynamicFields);
|
||||||
|
|
||||||
|
|
@ -853,12 +848,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair(pEntry->slotName, pEntry->value);
|
TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair(pEntry->slotName, pEntry->value);
|
||||||
pTamlWriteNode->mFields.push_back(pFieldValuePair);
|
pTamlWriteNode->mFields.push_back(pFieldValuePair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::compileChildren(TamlWriteNode* pTamlWriteNode)
|
void Taml::compileChildren(TamlWriteNode* pTamlWriteNode)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_CompileChildren);
|
PROFILE_SCOPE(Taml_CompileChildren);
|
||||||
|
|
||||||
|
|
@ -891,12 +886,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
// Save node.
|
// Save node.
|
||||||
pTamlWriteNode->mChildren->push_back(pChildTamlWriteNode);
|
pTamlWriteNode->mChildren->push_back(pChildTamlWriteNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::compileCustomState(TamlWriteNode* pTamlWriteNode)
|
void Taml::compileCustomState(TamlWriteNode* pTamlWriteNode)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_CompileCustomProperties);
|
PROFILE_SCOPE(Taml_CompileCustomProperties);
|
||||||
|
|
||||||
|
|
@ -930,12 +925,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
// Compile custom node state.
|
// Compile custom node state.
|
||||||
compileCustomNodeState(pCustomNode);
|
compileCustomNodeState(pCustomNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::compileCustomNodeState(TamlCustomNode* pCustomNode)
|
void Taml::compileCustomNodeState(TamlCustomNode* pCustomNode)
|
||||||
{
|
{
|
||||||
// Sanity!
|
// Sanity!
|
||||||
AssertFatal(pCustomNode != NULL, "Taml: Cannot compile NULL custom node state.");
|
AssertFatal(pCustomNode != NULL, "Taml: Cannot compile NULL custom node state.");
|
||||||
|
|
||||||
|
|
@ -972,12 +967,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
// Compile the child.
|
// Compile the child.
|
||||||
compileCustomNodeState(pChildNode);
|
compileCustomNodeState(pChildNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
SimObject* Taml::createType(StringTableEntry typeName, const Taml* pTaml, const char* pProgenitorSuffix)
|
SimObject* Taml::createType(StringTableEntry typeName, const Taml* pTaml, const char* pProgenitorSuffix)
|
||||||
{
|
{
|
||||||
// Debug Profiling.
|
// Debug Profiling.
|
||||||
PROFILE_SCOPE(Taml_CreateType);
|
PROFILE_SCOPE(Taml_CreateType);
|
||||||
|
|
||||||
|
|
@ -1059,13 +1054,13 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
return pSimObject;
|
return pSimObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
tinyxml2::XMLElement* g__write_schema_attribute_element(const AbstractClassRep::Field& field, AbstractClassRep* pType,
|
tinyxml2::XMLElement* g__write_schema_attribute_element(const AbstractClassRep::Field& field, AbstractClassRep* pType,
|
||||||
tinyxml2::XMLDocument& schemaDocument)
|
tinyxml2::XMLDocument& schemaDocument)
|
||||||
{
|
{
|
||||||
// Skip if not a data field.
|
// Skip if not a data field.
|
||||||
if (field.type == AbstractClassRep::DeprecatedFieldType ||
|
if (field.type == AbstractClassRep::DeprecatedFieldType ||
|
||||||
field.type == AbstractClassRep::StartGroupFieldType ||
|
field.type == AbstractClassRep::StartGroupFieldType ||
|
||||||
|
|
@ -1164,16 +1159,16 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
|
|
||||||
pAttributeElement->SetAttribute("use", "optional");
|
pAttributeElement->SetAttribute("use", "optional");
|
||||||
return pAttributeElement;
|
return pAttributeElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
String g_sanitize_schema_element_name(String buffer)
|
String g_sanitize_schema_element_name(String buffer)
|
||||||
{
|
{
|
||||||
return buffer.replace("(", "")
|
return buffer.replace("(", "")
|
||||||
.replace(")", "");
|
.replace(")", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Taml::generateTamlSchema()
|
bool Taml::generateTamlSchema()
|
||||||
{
|
{
|
||||||
// Fetch any TAML Schema file reference.
|
// Fetch any TAML Schema file reference.
|
||||||
const char* pTamlSchemaFile = Con::getVariable(TAML_SCHEMA_VARIABLE);
|
const char* pTamlSchemaFile = Con::getVariable(TAML_SCHEMA_VARIABLE);
|
||||||
|
|
||||||
|
|
@ -1636,12 +1631,12 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
stream.close();
|
stream.close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Taml::WriteUnrestrictedCustomTamlSchema(const char* pCustomNodeName, const AbstractClassRep* pClassRep, tinyxml2::XMLElement* pParentElement)
|
void Taml::WriteUnrestrictedCustomTamlSchema(const char* pCustomNodeName, const AbstractClassRep* pClassRep, tinyxml2::XMLElement* pParentElement)
|
||||||
{
|
{
|
||||||
// Sanity!
|
// Sanity!
|
||||||
AssertFatal(pCustomNodeName != NULL, "Taml::WriteDefaultCustomTamlSchema() - Node name cannot be NULL.");
|
AssertFatal(pCustomNodeName != NULL, "Taml::WriteDefaultCustomTamlSchema() - Node name cannot be NULL.");
|
||||||
AssertFatal(pClassRep != NULL, "Taml::WriteDefaultCustomTamlSchema() - ClassRep cannot be NULL.");
|
AssertFatal(pClassRep != NULL, "Taml::WriteDefaultCustomTamlSchema() - ClassRep cannot be NULL.");
|
||||||
|
|
@ -1677,4 +1672,4 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
tinyxml2::XMLElement* pAnyElement = doc->NewElement("xs:any");
|
tinyxml2::XMLElement* pAnyElement = doc->NewElement("xs:any");
|
||||||
pAnyElement->SetAttribute("processContents", "skip");
|
pAnyElement->SetAttribute("processContents", "skip");
|
||||||
pSequenceElement->LinkEndChild(pAnyElement);
|
pSequenceElement->LinkEndChild(pAnyElement);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,6 @@ DefineEngineFunction(TamlWrite, bool, (SimObject* simObject, const char* filenam
|
||||||
if ( simObject == NULL )
|
if ( simObject == NULL )
|
||||||
{
|
{
|
||||||
// No, so warn.
|
// No, so warn.
|
||||||
//Con::warnf( "TamlWrite() - Could not find object '%s' to write to file '%s'.", simObject->getIdString(), filename );
|
|
||||||
Con::warnf( "TamlWrite() - Could not find object to write to file '%s'.", filename );
|
Con::warnf( "TamlWrite() - Could not find object to write to file '%s'.", filename );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -256,10 +255,10 @@ DefineEngineFunction(TamlWrite, bool, (SimObject* simObject, const char* filenam
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef TORQUE_DEBUG
|
#ifdef TORQUE_DEBUG
|
||||||
// No, so warn.
|
// No, so warn.
|
||||||
Con::warnf( "TamlWrite() - Setting binary compression is only valid for XML formatting." );
|
Con::warnf( "TamlWrite() - Setting binary compression is only valid for XML formatting." );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn-off auto-formatting.
|
// Turn-off auto-formatting.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue