|
|
@@ -226,7 +226,7 @@ DefineEngineMethod(Taml, read, SimObject*, (const char* filename), , "(filena
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
DefineEngineFunction(TamlWrite, bool, (SimObject* simObject, const char* filename, const char* format, bool compressed),
|
|
|
- ("xml", true),
|
|
|
+ ("xml", false),
|
|
|
"(object, filename, [format], [compressed]) - Writes an object to a file using Taml.\n"
|
|
|
"@param object The object to write.\n"
|
|
|
"@param filename The filename to write to.\n"
|
|
|
@@ -245,25 +245,29 @@ DefineEngineFunction(TamlWrite, bool, (SimObject* simObject, const char* filenam
|
|
|
|
|
|
Taml taml;
|
|
|
|
|
|
- taml.setFormatMode( Taml::getFormatModeEnum(format) );
|
|
|
-
|
|
|
- // Yes, so is the format mode binary?
|
|
|
- if ( taml.getFormatMode() == Taml::BinaryFormat )
|
|
|
+ if (filename != NULL && filename[0] != '\0')
|
|
|
{
|
|
|
- // Yes, so set binary compression.
|
|
|
- taml.setBinaryCompression( compressed );
|
|
|
+ taml.setFormatMode(Taml::getFormatModeEnum(format));
|
|
|
+ // Turn-off auto-formatting.
|
|
|
+ taml.setAutoFormat(false);
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ // should only be checking if compression if compressed is true.
|
|
|
+ if (compressed)
|
|
|
{
|
|
|
- #ifdef TORQUE_DEBUG
|
|
|
- // No, so warn.
|
|
|
- Con::warnf( "TamlWrite() - Setting binary compression is only valid for XML formatting." );
|
|
|
- #endif
|
|
|
+ // Yes, so is the format mode binary?
|
|
|
+ if (taml.getFormatMode() == Taml::BinaryFormat)
|
|
|
+ {
|
|
|
+ // Yes, so set binary compression.
|
|
|
+ taml.setBinaryCompression(compressed);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // No, so warn.
|
|
|
+ Con::warnf("TamlWrite() - Setting binary compression is only valid for BINARY format.");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- // Turn-off auto-formatting.
|
|
|
- taml.setAutoFormat( false );
|
|
|
-
|
|
|
// Write.
|
|
|
return taml.write( simObject, filename );
|
|
|
}
|