From efe8c184d4b06f7f52940fc43c64ff2974b2b3ae Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Sun, 12 Oct 2025 17:15:33 +0100 Subject: [PATCH] Update taml_ScriptBinding.h fix spam on saving, we only care about compression when baml is being written out. set it to false for all apart from where specified as binary, if the format is specified then turn off auto format. This warning was also wrong its binary format --- .../persistence/taml/taml_ScriptBinding.h | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/Engine/source/persistence/taml/taml_ScriptBinding.h b/Engine/source/persistence/taml/taml_ScriptBinding.h index 65ffd7313..7316ff712 100644 --- a/Engine/source/persistence/taml/taml_ScriptBinding.h +++ b/Engine/source/persistence/taml/taml_ScriptBinding.h @@ -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,24 +245,28 @@ 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 ); - } - else - { - #ifdef TORQUE_DEBUG - // No, so warn. - Con::warnf( "TamlWrite() - Setting binary compression is only valid for XML formatting." ); - #endif + taml.setFormatMode(Taml::getFormatModeEnum(format)); + // Turn-off auto-formatting. + taml.setAutoFormat(false); } - // Turn-off auto-formatting. - taml.setAutoFormat( false ); + // should only be checking if compression if compressed is true. + if (compressed) + { + // 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."); + } + } // Write. return taml.write( simObject, filename );