From: Thomas Debesse Date: Fri, 22 May 2020 16:06:50 +0000 (+0200) Subject: radiant/texwindow: only show per-wad textures, update texture window title with wad... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e6d072e212b9fa0417b7c4290b545d5c26220556;p=xonotic%2Fnetradiant.git radiant/texwindow: only show per-wad textures, update texture window title with wad name --- diff --git a/include/ishaders.h b/include/ishaders.h index f588c287..e1ce6261 100644 --- a/include/ishaders.h +++ b/include/ishaders.h @@ -108,6 +108,8 @@ virtual qtexture_t* getBump() const = 0; virtual qtexture_t* getSpecular() const = 0; // get shader name virtual const char* getName() const = 0; +virtual const char* getWadName() const = 0; +virtual void setWadName( const char* name ) = 0; virtual bool IsInUse() const = 0; virtual void SetInUse( bool bInUse ) = 0; // get the editor flags (QER_NOCARVE QER_TRANS) diff --git a/plugins/shaders/shaders.cpp b/plugins/shaders/shaders.cpp index f982605e..fe545564 100644 --- a/plugins/shaders/shaders.cpp +++ b/plugins/shaders/shaders.cpp @@ -273,6 +273,7 @@ class ShaderTemplate { std::size_t m_refcount; CopiedString m_Name; +CopiedString m_WadName; public: ShaderParameters m_params; @@ -844,6 +845,7 @@ const ShaderArguments& m_args; const char* m_filename; // name is shader-name, otherwise texture-name ( if not a real shader ) CopiedString m_Name; +CopiedString m_WadName; qtexture_t* m_pTexture; qtexture_t* m_notfound; @@ -921,6 +923,10 @@ const char* getName() const { return m_Name.c_str(); } +const char* getWadName() const { + return m_WadName.c_str(); +} + bool IsInUse() const { return m_bInUse; } @@ -1056,6 +1062,10 @@ void setName( const char* name ){ m_Name = name; } +void setWadName( const char* name ){ + m_WadName = name; +} + class MapLayer : public ShaderLayer { qtexture_t* m_texture; diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index a8d7af65..62b7460c 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -569,7 +569,15 @@ bool Texture_IsShown( IShader* shader, bool show_shaders, bool hideUnused ){ } } else { - if ( !shader_equal_prefix( shader_get_textureName( shader->getName() ), g_TextureBrowser_currentDirectory.c_str() ) ) { + if ( TextureBrowser_showWads() ) + { + if ( g_TextureBrowser_currentDirectory != "" + && !string_equal( shader->getWadName(), g_TextureBrowser_currentDirectory.c_str() ) ) + { + return false; + } + } + else if ( !shader_equal_prefix( shader_get_textureName( shader->getName() ), g_TextureBrowser_currentDirectory.c_str() ) ) { return false; } } @@ -764,6 +772,7 @@ public: void visit( const char* name ){ IShader* shader = QERApp_Shader_ForName( CopiedString( StringRange( name, path_get_filename_base_end( name ) ) ).c_str() ); shader->DecRef(); + shader->setWadName( g_TextureBrowser_currentDirectory.c_str() ); } }; @@ -840,6 +849,9 @@ void visit( const char* minor, const _QERPlugImageTable& table ) const { void TextureBrowser_ShowDirectory( TextureBrowser& textureBrowser, const char* directory ){ if ( TextureBrowser_showWads() ) { + g_TextureBrowser_currentDirectory = directory; + TextureBrowser_heightChanged( textureBrowser ); + Archive* archive = GlobalFileSystem().getArchive( directory ); if ( archive != nullptr ) {