mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 22:22:05 +00:00
Always strip file extensions from image names internally. Close #963
This commit is contained in:
parent
f5cb915356
commit
95336f49b8
1 changed files with 15 additions and 4 deletions
|
@ -356,7 +356,11 @@ idImage* idImageManager::ImageFromFunction( const char* _name, ImageGeneratorFun
|
|||
{
|
||||
// strip any .tga file extensions from anywhere in the _name
|
||||
idStr name = _name;
|
||||
name.Replace( ".tga", "" );
|
||||
idStrList imageFormats = { ".tga", ".jpg", ".png", ".exr", ".hdr" };
|
||||
for( auto& ext : imageFormats )
|
||||
{
|
||||
name.Replace( ext, "" );
|
||||
}
|
||||
name.BackSlashesToSlashes();
|
||||
|
||||
// see if the image already exists
|
||||
|
@ -413,7 +417,11 @@ idImage* idImageManager::ImageFromFile( const char* _name, textureFilter_t filte
|
|||
|
||||
// strip any .tga file extensions from anywhere in the _name, including image program parameters
|
||||
idStrStatic< MAX_OSPATH > name = _name;
|
||||
name.Replace( ".tga", "" );
|
||||
idStrList imageFormats = { ".tga", ".jpg", ".png", ".exr", ".hdr" };
|
||||
for( auto& ext : imageFormats )
|
||||
{
|
||||
name.Replace( ext, "" );
|
||||
}
|
||||
name.BackSlashesToSlashes();
|
||||
|
||||
//
|
||||
|
@ -598,7 +606,6 @@ idImageManager::GetImage
|
|||
*/
|
||||
idImage* idImageManager::GetImage( const char* _name ) const
|
||||
{
|
||||
|
||||
if( !_name || !_name[0] || idStr::Icmp( _name, "default" ) == 0 || idStr::Icmp( _name, "_default" ) == 0 )
|
||||
{
|
||||
declManager->MediaPrint( "DEFAULTED\n" );
|
||||
|
@ -607,7 +614,11 @@ idImage* idImageManager::GetImage( const char* _name ) const
|
|||
|
||||
// strip any .tga file extensions from anywhere in the _name, including image program parameters
|
||||
idStr name = _name;
|
||||
name.Replace( ".tga", "" );
|
||||
idStrList imageFormats = { ".tga", ".jpg", ".png", ".exr", ".hdr" };
|
||||
for( auto& ext : imageFormats )
|
||||
{
|
||||
name.Replace( ext, "" );
|
||||
}
|
||||
name.BackSlashesToSlashes();
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue