]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Radiant:
authorGarux <garux@mail.ru>
Tue, 1 Aug 2017 11:00:58 +0000 (14:00 +0300)
committerGarux <garux@mail.ru>
Tue, 1 Aug 2017 11:00:58 +0000 (14:00 +0300)
binds...
* texbro: left double click loads directory, containing active shader
* texbro: left triple click loads 'common' directory
misc...
* updating texture browser height after thumbnail scale, min/max size, show shaders options changed
* tex bro: show textures option (to leave only shaders)
* tex bro: Show all (ctrl + a) toggles 'Hide unused' (typically: ctrl+a: get all used, once more ctrl+a: get all loaded)
* tex bro: 'flush and reload shaders' autoloads last selected dir
* tex bro: show alpha transparency option; def = yes
* tex bro: white+black stipple around shader thumbnails + is visible, while being selected
* filter toobar is not part of plugin one

radiant/mainframe.cpp
radiant/texwindow.cpp

index 6cce87d0b917942a0e85ce85a5365da9219f528b..45348b98a24b403bdc84b026bc63799c1fdbb744 100644 (file)
@@ -2781,37 +2781,61 @@ void MainFrame::Create(){
        GtkToolbar* main_toolbar = create_main_toolbar( CurrentStyle() );
        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( main_toolbar ), FALSE, FALSE, 0 );
 
-       GtkToolbar* plugin_toolbar = create_plugin_toolbar();
+
+
+
+       if ( g_Layout_enablePluginToolbar.m_value || g_Layout_enableFilterToolbar.m_value ){
+               GtkWidget* PFbox = gtk_hbox_new( FALSE, 3 );
+               gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( PFbox ), FALSE, FALSE, 0 );
+               gtk_widget_show( PFbox );
+               if ( g_Layout_enablePluginToolbar.m_value ){
+                       GtkToolbar* plugin_toolbar = create_plugin_toolbar();
+                       if ( g_Layout_enableFilterToolbar.m_value ){
+                               gtk_box_pack_start( GTK_BOX( PFbox ), GTK_WIDGET( plugin_toolbar ), FALSE, FALSE, 0 );
+                       }
+                       else{
+                               gtk_box_pack_start( GTK_BOX( PFbox ), GTK_WIDGET( plugin_toolbar ), TRUE, TRUE, 0 );
+                       }
+               }
+               if ( g_Layout_enableFilterToolbar.m_value ){
+                       GtkToolbar* filter_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
+                       gtk_widget_show( GTK_WIDGET( filter_toolbar ) );
+
+                       toolbar_append_toggle_button( filter_toolbar, "World (ALT + 1)", "f-world.bmp", "FilterWorldBrushes" );
+                       toolbar_append_toggle_button( filter_toolbar, "Details (CTRL + D)", "f-details.bmp", "FilterDetails" );
+                       toolbar_append_toggle_button( filter_toolbar, "Structural (CTRL + SHIFT + D)", "f-structural.bmp", "FilterStructural" );
+                       toolbar_append_toggle_button( filter_toolbar, "Patches (CTRL + P)", "patch_wireframe.bmp", "FilterPatches" );
+                       gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) );
+                       toolbar_append_toggle_button( filter_toolbar, "Areaportals (ALT + 3)", "f-areaportal.bmp", "FilterAreaportals" );
+                       toolbar_append_toggle_button( filter_toolbar, "Translucent (ALT + 4)", "f-translucent.bmp", "FilterTranslucent" );
+                       toolbar_append_toggle_button( filter_toolbar, "Liquids (ALT + 5)", "f-liquids.bmp", "FilterLiquids" );
+                       toolbar_append_toggle_button( filter_toolbar, "Caulk (ALT + 6)", "f-caulk.bmp", "FilterCaulk" );
+                       toolbar_append_toggle_button( filter_toolbar, "Clips (ALT + 7)", "f-clip.bmp", "FilterClips" );
+                       toolbar_append_toggle_button( filter_toolbar, "HintsSkips (CTRL + H)", "f-hint.bmp", "FilterHintsSkips" );
+                       //toolbar_append_toggle_button( filter_toolbar, "Paths (ALT + 8)", "texture_lock.bmp", "FilterPaths" );
+                       gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) );
+                       toolbar_append_toggle_button( filter_toolbar, "Entities (ALT + 2)", "f-entities.bmp", "FilterEntities" );
+                       toolbar_append_toggle_button( filter_toolbar, "Lights (ALT + 0)", "lightinspector.bmp", "FilterLights" );
+                       toolbar_append_toggle_button( filter_toolbar, "Models (SHIFT + M)", "f-models.bmp", "FilterModels" );
+                       toolbar_append_toggle_button( filter_toolbar, "Triggers (CTRL + SHIFT + T)", "f-triggers.bmp", "FilterTriggers" );
+                       //toolbar_append_toggle_button( filter_toolbar, "Decals (SHIFT + D)", "f-decals.bmp", "FilterDecals" );
+                       gtk_toolbar_append_space( GTK_TOOLBAR( filter_toolbar ) );
+                       toolbar_append_button( filter_toolbar, "InvertFilters", "f-invert.bmp", "InvertFilters" );
+                       toolbar_append_button( filter_toolbar, "ResetFilters", "f-reset.bmp", "ResetFilters" );
+
+                       gtk_box_pack_start( GTK_BOX( PFbox ), GTK_WIDGET( filter_toolbar ), TRUE, TRUE, 0 );
+               }
+       }
+
+       /*GtkToolbar* plugin_toolbar = create_plugin_toolbar();
        if ( !g_Layout_enablePluginToolbar.m_value ) {
                gtk_widget_hide( GTK_WIDGET( plugin_toolbar ) );
+       }*/
+       if ( g_Layout_enableFilterToolbar.m_value ) {
        }
 
-       if ( g_Layout_enableFilterToolbar.m_value ) {
-               gtk_toolbar_append_space( GTK_TOOLBAR( plugin_toolbar ) );
-               gtk_toolbar_append_space( GTK_TOOLBAR( plugin_toolbar ) );
-               toolbar_append_toggle_button( plugin_toolbar, "World (ALT + 1)", "f-world.bmp", "FilterWorldBrushes" );
-               toolbar_append_toggle_button( plugin_toolbar, "Details (CTRL + D)", "f-details.bmp", "FilterDetails" );
-               toolbar_append_toggle_button( plugin_toolbar, "Structural (CTRL + SHIFT + D)", "f-structural.bmp", "FilterStructural" );
-               toolbar_append_toggle_button( plugin_toolbar, "Patches (CTRL + P)", "patch_wireframe.bmp", "FilterPatches" );
-               gtk_toolbar_append_space( GTK_TOOLBAR( plugin_toolbar ) );
-               toolbar_append_toggle_button( plugin_toolbar, "Areaportals (ALT + 3)", "f-areaportal.bmp", "FilterAreaportals" );
-               toolbar_append_toggle_button( plugin_toolbar, "Translucent (ALT + 4)", "f-translucent.bmp", "FilterTranslucent" );
-               toolbar_append_toggle_button( plugin_toolbar, "Liquids (ALT + 5)", "f-liquids.bmp", "FilterLiquids" );
-               toolbar_append_toggle_button( plugin_toolbar, "Caulk (ALT + 6)", "f-caulk.bmp", "FilterCaulk" );
-               toolbar_append_toggle_button( plugin_toolbar, "Clips (ALT + 7)", "f-clip.bmp", "FilterClips" );
-               toolbar_append_toggle_button( plugin_toolbar, "HintsSkips (CTRL + H)", "f-hint.bmp", "FilterHintsSkips" );
-               //toolbar_append_toggle_button( plugin_toolbar, "Paths (ALT + 8)", "texture_lock.bmp", "FilterPaths" );
-               gtk_toolbar_append_space( GTK_TOOLBAR( plugin_toolbar ) );
-               toolbar_append_toggle_button( plugin_toolbar, "Entities (ALT + 2)", "f-entities.bmp", "FilterEntities" );
-               toolbar_append_toggle_button( plugin_toolbar, "Lights (ALT + 0)", "lightinspector.bmp", "FilterLights" );
-               toolbar_append_toggle_button( plugin_toolbar, "Models (SHIFT + M)", "f-models.bmp", "FilterModels" );
-               toolbar_append_toggle_button( plugin_toolbar, "Triggers (CTRL + SHIFT + T)", "f-triggers.bmp", "FilterTriggers" );
-//             toolbar_append_toggle_button( plugin_toolbar, "Decals (SHIFT + D)", "f-decals.bmp", "FilterDecals" );
-               gtk_toolbar_append_space( GTK_TOOLBAR( plugin_toolbar ) );
-               toolbar_append_button( plugin_toolbar, "InvertFilters", "f-invert.bmp", "InvertFilters" );
-               toolbar_append_button( plugin_toolbar, "ResetFilters", "f-reset.bmp", "ResetFilters" );
-       }
-       gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( plugin_toolbar ), FALSE, FALSE, 0 );
+
+
 
        GtkWidget* main_statusbar = create_main_statusbar( m_pStatusLabel );
        gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 );
index 14dfab422bafd618d75be502b46402e47cdb8cbd..24e71a38cc3795453f89b550de671683ebabd7a5 100644 (file)
@@ -134,6 +134,7 @@ namespace
 bool g_TextureBrowser_shaderlistOnly = false;
 bool g_TextureBrowser_fixedSize = true;
 bool g_TextureBrowser_filterNotex = false;
+bool g_TextureBrowser_enableAlpha = true;
 }
 
 class DeferredAdjustment
@@ -194,6 +195,9 @@ typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_hideUnusedExport>
 void TextureBrowser_showShadersExport( const BoolImportCallback& importer );
 typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_showShadersExport> TextureBrowserShowShadersExport;
 
+void TextureBrowser_showTexturesExport( const BoolImportCallback& importer );
+typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_showTexturesExport> TextureBrowserShowTexturesExport;
+
 void TextureBrowser_showShaderlistOnly( const BoolImportCallback& importer );
 typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_showShaderlistOnly> TextureBrowserShowShaderlistOnlyExport;
 
@@ -203,6 +207,9 @@ typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_fixedSize> Texture
 void TextureBrowser_filterNotex( const BoolImportCallback& importer );
 typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_filterNotex> TextureBrowserFilterNotexExport;
 
+void TextureBrowser_enableAlpha( const BoolImportCallback& importer );
+typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_enableAlpha> TextureBrowserEnableAlphaExport;
+
 class TextureBrowser
 {
 public:
@@ -235,9 +242,11 @@ std::set<CopiedString> m_found_shaders;
 
 ToggleItem m_hideunused_item;
 ToggleItem m_showshaders_item;
+ToggleItem m_showtextures_item;
 ToggleItem m_showshaderlistonly_item;
 ToggleItem m_fixedsize_item;
 ToggleItem m_filternotex_item;
+ToggleItem m_enablealpha_item;
 
 guint m_sizeHandler;
 guint m_exposeHandler;
@@ -254,6 +263,7 @@ std::size_t m_mouseWheelScrollIncrement;
 std::size_t m_textureScale;
 // make the texture increments match the grid changes
 bool m_showShaders;
+bool m_showTextures;
 bool m_showTextureScrollbar;
 StartupShaders m_startupShaders;
 // if true, the texture window will only display in-use shaders
@@ -340,9 +350,11 @@ TextureBrowser() :
        m_texture_scroll( 0 ),
        m_hideunused_item( TextureBrowserHideUnusedExport() ),
        m_showshaders_item( TextureBrowserShowShadersExport() ),
+       m_showtextures_item( TextureBrowserShowTexturesExport() ),
        m_showshaderlistonly_item( TextureBrowserShowShaderlistOnlyExport() ),
        m_fixedsize_item( TextureBrowserFixedSizeExport() ),
        m_filternotex_item( TextureBrowserFilterNotexExport() ),
+       m_enablealpha_item( TextureBrowserEnableAlphaExport() ),
        m_heightChanged( true ),
        m_originInvalid( true ),
        m_scrollAdjustment( TextureBrowser_scrollChanged, this ),
@@ -350,6 +362,7 @@ TextureBrowser() :
        m_mouseWheelScrollIncrement( 64 ),
        m_textureScale( 50 ),
        m_showShaders( true ),
+       m_showTextures( true ),
        m_showTextureScrollbar( true ),
        m_startupShaders( STARTUPSHADERS_NONE ),
        m_hideUnused( false ),
@@ -498,7 +511,7 @@ CopiedString g_notex;
 CopiedString g_shadernotex;
 
 // if texture_showinuse jump over non in-use textures
-bool Texture_IsShown( IShader* shader, bool show_shaders, bool hideUnused ){
+bool Texture_IsShown( IShader* shader, bool show_shaders, bool show_textures, bool hideUnused ){
        // filter notex / shadernotex images
        if ( g_TextureBrowser_filterNotex && ( string_equal( g_notex.c_str(), shader->getTexture()->name ) || string_equal( g_shadernotex.c_str(), shader->getTexture()->name ) ) ) {
                return false;
@@ -525,6 +538,10 @@ bool Texture_IsShown( IShader* shader, bool show_shaders, bool hideUnused ){
                return false;
        }
 
+       if ( !show_textures && shader->IsDefault() ) {
+               return false;
+       }
+
        if ( hideUnused && !shader->IsInUse() ) {
                return false;
        }
@@ -565,7 +582,7 @@ void TextureBrowser_evaluateHeight( TextureBrowser& textureBrowser ){
                {
                        IShader* shader = QERApp_ActiveShaders_IteratorCurrent();
 
-                       if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_hideUnused ) ) {
+                       if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_showTextures, textureBrowser.m_hideUnused ) ) {
                                continue;
                        }
 
@@ -628,6 +645,7 @@ Signal0 m_realiseCallbacks;
 public:
 void realise(){
        m_realiseCallbacks();
+       /* texturebrowser tree update on vfs restart */
        TextureBrowser_constructTreeStore();
 }
 void unrealise(){
@@ -855,6 +873,11 @@ void TextureBrowser_showShadersExport( const BoolImportCallback& importer ){
 }
 typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_showShadersExport> TextureBrowserShowShadersExport;
 
+void TextureBrowser_showTexturesExport( const BoolImportCallback& importer ){
+       importer( GlobalTextureBrowser().m_showTextures );
+}
+typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_showTexturesExport> TextureBrowserShowTexturesExport;
+
 void TextureBrowser_showShaderlistOnly( const BoolImportCallback& importer ){
        importer( g_TextureBrowser_shaderlistOnly );
 }
@@ -870,6 +893,11 @@ void TextureBrowser_filterNotex( const BoolImportCallback& importer ){
 }
 typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_filterNotex> TextureBrowser_filterNotexExport;
 
+void TextureBrowser_enableAlpha( const BoolImportCallback& importer ){
+       importer( g_TextureBrowser_enableAlpha );
+}
+typedef FreeCaller1<const BoolImportCallback&, TextureBrowser_enableAlpha> TextureBrowser_enableAlphaExport;
+
 void TextureBrowser_SetHideUnused( TextureBrowser& textureBrowser, bool hideUnused ){
        if ( hideUnused ) {
                textureBrowser.m_hideUnused = true;
@@ -905,7 +933,7 @@ void TextureBrowser_Focus( TextureBrowser& textureBrowser, const char* name ){
        {
                IShader* shader = QERApp_ActiveShaders_IteratorCurrent();
 
-               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_hideUnused ) ) {
+               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_showTextures, textureBrowser.m_hideUnused ) ) {
                        continue;
                }
 
@@ -946,7 +974,7 @@ IShader* Texture_At( TextureBrowser& textureBrowser, int mx, int my ){
        {
                IShader* shader = QERApp_ActiveShaders_IteratorCurrent();
 
-               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_hideUnused ) ) {
+               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_showTextures, textureBrowser.m_hideUnused ) ) {
                        continue;
                }
 
@@ -1063,7 +1091,15 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
 
        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
        glDisable( GL_DEPTH_TEST );
-       glDisable( GL_BLEND );
+       //glDisable( GL_BLEND );
+       if ( g_TextureBrowser_enableAlpha ) {
+               glEnable( GL_BLEND );
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+       }
+       else {
+               glDisable( GL_BLEND );
+       }
+
        glOrtho( 0, textureBrowser.width, originy - textureBrowser.height, originy, -100, 100 );
        glEnable( GL_TEXTURE_2D );
 
@@ -1077,7 +1113,7 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
        {
                IShader* shader = QERApp_ActiveShaders_IteratorCurrent();
 
-               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_hideUnused ) ) {
+               if ( !Texture_IsShown( shader, textureBrowser.m_showShaders, textureBrowser.m_showTextures, textureBrowser.m_hideUnused ) ) {
                        continue;
                }
 
@@ -1105,8 +1141,41 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                        // shaders have a white border, simple textures don't
                        // if !texture_showinuse: (some textures displayed may not be in use)
                        // draw an additional square around with 0.5 1 0.5 color
+                       glLineWidth( 1 );
+                       // shader border:
+                       if ( !shader->IsDefault() ) {
+                       //real 1px white/black stipple
+                               glColor3f( 0, 0, 0 );
+                               glDisable( GL_TEXTURE_2D );
+
+                               float xf = (float)x;
+                               float yf = (float)( y - TextureBrowser_fontHeight( textureBrowser ) );
+                               glBegin( GL_LINE_LOOP );
+                               glVertex2f( xf - 1.5,yf + 1.5 );
+                               glVertex2f( xf - 1.5,yf - nHeight - 1.5 );
+                               glVertex2f( xf + 1.5 + nWidth,yf - nHeight - 1.5 );
+                               glVertex2f( xf + 1.5 + nWidth,yf + 1.5 );
+
+                               glEnd();
+
+                               glEnable( GL_LINE_STIPPLE );
+                               glLineStipple( 1, 0x0FFF );
+
+                               glBegin( GL_LINE_LOOP );
+                               glColor3f( 1, 1, 1 );
+
+                               glVertex2f( xf - 1.5,yf + 1.5 );
+                               glVertex2f( xf - 1.5,yf - nHeight - 1.5 );
+                               glVertex2f( xf + 1.5 + nWidth,yf - nHeight - 1.5 );
+                               glVertex2f( xf + 1.5 + nWidth,yf + 1.5 );
+
+                               glEnd();
+                               glDisable( GL_LINE_STIPPLE );
+                               glEnable( GL_TEXTURE_2D );
+
+                       }
                        if ( shader_equal( TextureBrowser_GetSelectedShader( textureBrowser ), shader->getName() ) ) {
-                               glLineWidth( 3 );
+                               glLineWidth( 2 );
                                if ( textureBrowser.m_rmbSelected ) {
                                        glColor3f( 0,0,1 );
                                }
@@ -1125,35 +1194,44 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
                                glEnable( GL_TEXTURE_2D );
                                glLineWidth( 1 );
                        }
-                       else
-                       {
-                               glLineWidth( 1 );
-                               // shader border:
-                               if ( !shader->IsDefault() ) {
-                                       glColor3f( 1,1,1 );
-                                       glDisable( GL_TEXTURE_2D );
-
-                                       glBegin( GL_LINE_LOOP );
-                                       glVertex2i( x - 1,y + 1 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x - 1,y - nHeight - 1 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x + 1 + nWidth,y - nHeight - 1 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x + 1 + nWidth,y + 1 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glEnd();
-                                       glEnable( GL_TEXTURE_2D );
-                               }
+                       // highlight in-use textures
+                       else if ( !textureBrowser.m_hideUnused && shader->IsInUse() ) {
+                       //1px with float
+                               float xf = (float)x;
+                               float yf = (float)( y - TextureBrowser_fontHeight( textureBrowser ) );
+                               glColor3f( 0.5,1,0.5 );
+                               glDisable( GL_TEXTURE_2D );
+                               glBegin( GL_LINE_LOOP );
+                               glVertex2f( xf - 3.5,yf + 3.5 );
+                               glVertex2f( xf - 3.5,yf - nHeight - 3.5 );
+                               glVertex2f( xf + 3.5 + nWidth,yf - nHeight - 3.5 );
+                               glVertex2f( xf + 3.5 + nWidth,yf + 3.5 );
+                               glEnd();
+                               glEnable( GL_TEXTURE_2D );
+                       }
 
-                               // highlight in-use textures
-                               if ( !textureBrowser.m_hideUnused && shader->IsInUse() ) {
-                                       glColor3f( 0.5,1,0.5 );
-                                       glDisable( GL_TEXTURE_2D );
-                                       glBegin( GL_LINE_LOOP );
-                                       glVertex2i( x - 3,y + 3 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x - 3,y - nHeight - 3 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x + 3 + nWidth,y - nHeight - 3 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glVertex2i( x + 3 + nWidth,y + 3 - TextureBrowser_fontHeight( textureBrowser ) );
-                                       glEnd();
-                                       glEnable( GL_TEXTURE_2D );
-                               }
+                       // draw checkerboard for transparent textures
+                       if ( g_TextureBrowser_enableAlpha )
+                       {
+                               glDisable( GL_TEXTURE_2D );
+                               glBegin( GL_QUADS );
+                               int font_height = TextureBrowser_fontHeight( textureBrowser );
+                               for ( int i = 0; i < nHeight; i += 8 )
+                                       for ( int j = 0; j < nWidth; j += 8 )
+                                       {
+                                               unsigned char color = (i + j) / 8 % 2 ? 0x66 : 0x99;
+                                               glColor3ub( color, color, color );
+                                               int left = j;
+                                               int right = std::min(j+8, nWidth);
+                                               int top = i;
+                                               int bottom = std::min(i+8, nHeight);
+                                               glVertex2i(x + right, y - nHeight - font_height + top);
+                                               glVertex2i(x + left,  y - nHeight - font_height + top);
+                                               glVertex2i(x + left,  y - nHeight - font_height + bottom);
+                                               glVertex2i(x + right, y - nHeight - font_height + bottom);
+                                       }
+                               glEnd();
+                               glEnable( GL_TEXTURE_2D );
                        }
 
                        // Draw the texture
@@ -1206,16 +1284,30 @@ void TextureBrowser_queueDraw( TextureBrowser& textureBrowser ){
 void TextureBrowser_setScale( TextureBrowser& textureBrowser, std::size_t scale ){
        textureBrowser.m_textureScale = scale;
 
+       textureBrowser.m_heightChanged = true;
+       textureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
        TextureBrowser_queueDraw( textureBrowser );
 }
 
 void TextureBrowser_setUniformSize( TextureBrowser& textureBrowser, std::size_t scale ){
        textureBrowser.m_uniformTextureSize = scale;
+
+       textureBrowser.m_heightChanged = true;
+       textureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
        TextureBrowser_queueDraw( textureBrowser );
 }
 
 void TextureBrowser_setUniformMinSize( TextureBrowser& textureBrowser, std::size_t scale ){
        textureBrowser.m_uniformTextureMinSize = scale;
+
+       textureBrowser.m_heightChanged = true;
+       textureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
        TextureBrowser_queueDraw( textureBrowser );
 }
 
@@ -1331,6 +1423,27 @@ gboolean TextureBrowser_button_press( GtkWidget* widget, GdkEventButton* event,
                        }
                }
        }
+       else if ( event->type == GDK_2BUTTON_PRESS ) {
+               const char* sh = textureBrowser->shader.c_str();
+               char* dir = strrchr( sh, '/' );
+               if( dir != NULL ){
+                       *(dir + 1) = '\0';
+                       dir = strchr( sh, '/' );
+                       if( dir != NULL ){
+                               dir++;
+                               if( *dir != '\0'){
+                                       ScopeDisableScreenUpdates disableScreenUpdates( dir, "Loading Textures" );
+                                       TextureBrowser_ShowDirectory( *textureBrowser, dir );
+                                       TextureBrowser_queueDraw( *textureBrowser );
+                               }
+                       }
+               }
+       }
+       else if ( event->type == GDK_3BUTTON_PRESS ) {
+               ScopeDisableScreenUpdates disableScreenUpdates( TextureBrowser_getComonShadersDir(), "Loading Textures" );
+               TextureBrowser_ShowDirectory( *textureBrowser, TextureBrowser_getComonShadersDir() );
+               TextureBrowser_queueDraw( *textureBrowser );
+       }
        return FALSE;
 }
 
@@ -1613,12 +1726,9 @@ GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
        }
 
        create_check_menu_item_with_mnemonic( menu, "Hide _Unused", "ShowInUse" );
-       if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
-               create_check_menu_item_with_mnemonic( menu, "Hide Image Missing", "FilterNotex" );
-       }
+       create_menu_item_with_mnemonic( menu, "Show All", "ShowAllTextures" );
        menu_separator( menu );
 
-       create_menu_item_with_mnemonic( menu, "Show All", "ShowAllTextures" );
 
        // we always want to show shaders but don't want a "Show Shaders" menu for doom3 and .wad file games
        if ( g_pGameDescription->mGameType == "doom3" || !string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
@@ -1627,16 +1737,23 @@ GtkMenuItem* TextureBrowser_constructViewMenu( GtkMenu* menu ){
        else
        {
                create_check_menu_item_with_mnemonic( menu, "Show shaders", "ToggleShowShaders" );
+               create_check_menu_item_with_mnemonic( menu, "Show textures", "ToggleShowTextures" );
+               menu_separator( menu );
        }
 
-       if ( g_pGameDescription->mGameType != "doom3" && string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
-               create_check_menu_item_with_mnemonic( menu, "Shaders Only", "ToggleShowShaderlistOnly" );
-       }
        if ( g_TextureBrowser.m_tags ) {
                create_menu_item_with_mnemonic( menu, "Show Untagged", "ShowUntagged" );
        }
+       if ( g_pGameDescription->mGameType != "doom3" && string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
+               create_check_menu_item_with_mnemonic( menu, "ShaderList Only", "ToggleShowShaderlistOnly" );
+       }
+       if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
+               create_check_menu_item_with_mnemonic( menu, "Hide Image Missing", "FilterNotex" );
+               menu_separator( menu );
+       }
 
        create_check_menu_item_with_mnemonic( menu, "Fixed Size", "FixedSize" );
+       create_check_menu_item_with_mnemonic( menu, "Transparency", "EnableAlpha" );
 
        if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) {
                menu_separator( menu );
@@ -2360,14 +2477,58 @@ void TextureBrowser_pasteTag(){
 }
 
 void RefreshShaders(){
-       ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
-       GlobalShaderSystem().refresh();
-       UpdateAllWindows();
+
+       /* When shaders are refreshed, forces reloading the textures as well.
+       Previously it would at best only display shaders, at worst mess up some textured objects. */
+
+       GtkTreeSelection* selection = gtk_tree_view_get_selection((GtkTreeView*)GlobalTextureBrowser().m_treeViewTree);
+       GtkTreeModel* model = NULL;
+       GtkTreeIter iter;
+       if ( gtk_tree_selection_get_selected (selection, &model, &iter) )
+       {
+               gchar dirName[1024];
+               gchar* buffer;
+               gtk_tree_model_get( model, &iter, 0, &buffer, -1 );
+               strcpy( dirName, buffer );
+               g_free( buffer );
+               if ( !TextureBrowser_showWads() ) {
+                       strcat( dirName, "/" );
+               }
+
+               ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
+               GlobalShaderSystem().refresh();
+               UpdateAllWindows();
+
+               TextureBrowser_ShowDirectory( GlobalTextureBrowser(), dirName );
+               TextureBrowser_queueDraw( GlobalTextureBrowser() );
+       }
+       else{
+               ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
+               GlobalShaderSystem().refresh();
+               UpdateAllWindows();
+       }
+
 }
 
 void TextureBrowser_ToggleShowShaders(){
        g_TextureBrowser.m_showShaders ^= 1;
        g_TextureBrowser.m_showshaders_item.update();
+
+       g_TextureBrowser.m_heightChanged = true;
+       g_TextureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
+       TextureBrowser_queueDraw( g_TextureBrowser );
+}
+
+void TextureBrowser_ToggleShowTextures(){
+       g_TextureBrowser.m_showTextures ^= 1;
+       g_TextureBrowser.m_showtextures_item.update();
+
+       g_TextureBrowser.m_heightChanged = true;
+       g_TextureBrowser.m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
+
        TextureBrowser_queueDraw( g_TextureBrowser );
 }
 
@@ -2381,7 +2542,9 @@ void TextureBrowser_ToggleShowShaderListOnly(){
 void TextureBrowser_showAll(){
        g_TextureBrowser_currentDirectory = "";
        g_TextureBrowser.m_searchedTags = false;
-       TextureBrowser_heightChanged( g_TextureBrowser );
+//     TextureBrowser_SetHideUnused( g_TextureBrowser, false );
+       TextureBrowser_ToggleHideUnused();
+       //TextureBrowser_heightChanged( g_TextureBrowser );
        TextureBrowser_updateTitle();
 }
 
@@ -2424,6 +2587,12 @@ void TextureBrowser_FilterNotex(){
        TextureBrowser_activeShadersChanged( GlobalTextureBrowser() );
 }
 
+void TextureBrowser_EnableAlpha(){
+       g_TextureBrowser_enableAlpha ^= 1;
+       GlobalTextureBrowser().m_enablealpha_item.update();
+       TextureBrowser_activeShadersChanged( GlobalTextureBrowser() );
+}
+
 void TextureBrowser_exportTitle( const StringImportCallback& importer ){
        StringOutputStream buffer( 64 );
        buffer << "Textures: ";
@@ -2548,9 +2717,11 @@ void TextureBrowser_Construct(){
        GlobalCommands_insert( "ShowAllTextures", FreeCaller<TextureBrowser_showAll>(), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "ToggleTextures", FreeCaller<TextureBrowser_toggleShow>(), Accelerator( 'T' ) );
        GlobalToggles_insert( "ToggleShowShaders", FreeCaller<TextureBrowser_ToggleShowShaders>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) );
+       GlobalToggles_insert( "ToggleShowTextures", FreeCaller<TextureBrowser_ToggleShowTextures>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showtextures_item ) );
        GlobalToggles_insert( "ToggleShowShaderlistOnly", FreeCaller<TextureBrowser_ToggleShowShaderListOnly>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) );
        GlobalToggles_insert( "FixedSize", FreeCaller<TextureBrowser_FixedSize>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) );
        GlobalToggles_insert( "FilterNotex", FreeCaller<TextureBrowser_FilterNotex>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) );
+       GlobalToggles_insert( "EnableAlpha", FreeCaller<TextureBrowser_EnableAlpha>(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_enablealpha_item ) );
 
        GlobalPreferenceSystem().registerPreference( "TextureScale",
                                                                                                 makeSizeStringImportCallback( TextureBrowserSetScaleCaller( g_TextureBrowser ) ),
@@ -2567,9 +2738,11 @@ void TextureBrowser_Construct(){
                                                                                                 BoolExportStringCaller( GlobalTextureBrowser().m_showTextureScrollbar )
                                                                                                 );
        GlobalPreferenceSystem().registerPreference( "ShowShaders", BoolImportStringCaller( GlobalTextureBrowser().m_showShaders ), BoolExportStringCaller( GlobalTextureBrowser().m_showShaders ) );
+       GlobalPreferenceSystem().registerPreference( "ShowTextures", BoolImportStringCaller( GlobalTextureBrowser().m_showTextures ), BoolExportStringCaller( GlobalTextureBrowser().m_showTextures ) );
        GlobalPreferenceSystem().registerPreference( "ShowShaderlistOnly", BoolImportStringCaller( g_TextureBrowser_shaderlistOnly ), BoolExportStringCaller( g_TextureBrowser_shaderlistOnly ) );
        GlobalPreferenceSystem().registerPreference( "FixedSize", BoolImportStringCaller( g_TextureBrowser_fixedSize ), BoolExportStringCaller( g_TextureBrowser_fixedSize ) );
        GlobalPreferenceSystem().registerPreference( "FilterNotex", BoolImportStringCaller( g_TextureBrowser_filterNotex ), BoolExportStringCaller( g_TextureBrowser_filterNotex ) );
+       GlobalPreferenceSystem().registerPreference( "EnableAlpha", BoolImportStringCaller( g_TextureBrowser_enableAlpha ), BoolExportStringCaller( g_TextureBrowser_enableAlpha ) );
        GlobalPreferenceSystem().registerPreference( "LoadShaders", IntImportStringCaller( reinterpret_cast<int&>( GlobalTextureBrowser().m_startupShaders ) ), IntExportStringCaller( reinterpret_cast<int&>( GlobalTextureBrowser().m_startupShaders ) ) );
        GlobalPreferenceSystem().registerPreference( "WheelMouseInc", SizeImportStringCaller( GlobalTextureBrowser().m_mouseWheelScrollIncrement ), SizeExportStringCaller( GlobalTextureBrowser().m_mouseWheelScrollIncrement ) );
        GlobalPreferenceSystem().registerPreference( "SI_Colors0", Vector3ImportStringCaller( GlobalTextureBrowser().color_textureback ), Vector3ExportStringCaller( GlobalTextureBrowser().color_textureback ) );