diff --git a/OgreMain/include/OgreHlmsJson.h b/OgreMain/include/OgreHlmsJson.h index fbd4e83a139..7f15892477e 100644 --- a/OgreMain/include/OgreHlmsJson.h +++ b/OgreMain/include/OgreHlmsJson.h @@ -168,6 +168,9 @@ namespace Ogre if texture name is "mytex.png" and additionalTextureExtension = ".dds" then the actual texture saved will be "mytex.png.dds" Leave it blank if you don't know what to put + @param sortByName + Use true if output JSON should have materials sorted alphabetically + by name (case sensitive). */ void saveMaterials( const Hlms *hlms, String &outString, const String &additionalTextureExtension, bool sortByName = false ); diff --git a/OgreMain/include/OgreHlmsManager.h b/OgreMain/include/OgreHlmsManager.h index ff4e5a26aa5..ba055b8424f 100644 --- a/OgreMain/include/OgreHlmsManager.h +++ b/OgreMain/include/OgreHlmsManager.h @@ -354,9 +354,12 @@ namespace Ogre Hlms type. The type must be registered, otherwise it may crash. @param filename Valid file path. + @param sortByName + Use true if output JSON should have materials sorted alphabetically + by name (case sensitive). */ void saveMaterials( HlmsTypes hlmsType, const String &filename, HlmsJsonListener *listener, - const String &additionalTextureExtension ); + const String &additionalTextureExtension, bool sortByName = false ); /** Saves a specific Hlms material at the given file location. @param datablock diff --git a/OgreMain/src/OgreHlmsManager.cpp b/OgreMain/src/OgreHlmsManager.cpp index 17eee44f53a..3bab0f5975e 100644 --- a/OgreMain/src/OgreHlmsManager.cpp +++ b/OgreMain/src/OgreHlmsManager.cpp @@ -874,14 +874,16 @@ namespace Ogre //----------------------------------------------------------------------------------- void HlmsManager::saveMaterials( HlmsTypes hlmsType, const String &filename, HlmsJsonListener *listener, - const String &additionalTextureExtension ) + const String &additionalTextureExtension, + bool sortByName ) { assert( hlmsType != HLMS_MAX ); assert( hlmsType != HLMS_LOW_LEVEL ); String jsonString; HlmsJson hlmsJson( this, listener ); - hlmsJson.saveMaterials( mRegisteredHlms[hlmsType], jsonString, additionalTextureExtension ); + hlmsJson.saveMaterials( mRegisteredHlms[hlmsType], jsonString, + additionalTextureExtension, sortByName ); std::ofstream file( filename.c_str(), std::ios::binary | std::ios::out ); if( file.is_open() )