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:
marauder2k7 2025-10-10 10:28:46 +01:00
parent 6c9263b625
commit 7d497383da
3 changed files with 1479 additions and 1484 deletions

View file

@ -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")

View file

@ -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"
@ -95,11 +95,9 @@ StringTableEntry tamlNamedObjectName = StringTable->insert("Name");
typedef Taml::TamlFormatMode _TamlFormatMode; typedef Taml::TamlFormatMode _TamlFormatMode;
ImplementEnumType(_TamlFormatMode, ImplementEnumType(_TamlFormatMode,
"") "")
{ { Taml::XmlFormat, "xml" },
Taml::XmlFormat, "xml" { Taml::BinaryFormat, "binary" },
}, { Taml::JSONFormat, "json" }
{ Taml::BinaryFormat, "binary" }//,
//{ Taml::JSONFormat, "json" }
EndImplementEnumType; EndImplementEnumType;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -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.
@ -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.
@ -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:

View file

@ -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;
} }