]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'b243946c9ffd022cd5d82f2cf474ebfb125929b9' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 02:44:41 +0000 (04:44 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 02:44:41 +0000 (04:44 +0200)
1  2 
radiant/mainframe.cpp
radiant/plugintoolbar.cpp
radiant/texwindow.cpp
tools/quake3/common/vfs.c

Simple merge
Simple merge
index edfe4bc7562ee7e96501b38a3321f629bd0c99ff,1d766aea237eb16877f37e8fdc43af63df1cb009..81d1edc08bdefe15412af379515cd96a3dbb38d0
@@@ -1298,39 -1299,24 +1353,24 @@@ void Texture_Draw( TextureBrowser& text
                                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
 +                              // highlight in-use textures
-                               if ( !textureBrowser.m_hideUnused && shader->IsInUse() ) {
+                       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 );
 +                                      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 ) );
+                               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 );
 -                      }
 +                                      glEnd();
 +                                      glEnable( GL_TEXTURE_2D );
 +                              }
-                       }
  
                        // draw checkerboard for transparent textures
 -                      if ( g_TextureBrowser_enableAlpha )
 +                      if ( g_TextureBrowser_enableAlpha )
                        {
                                glDisable( GL_TEXTURE_2D );
                                glBegin( GL_QUADS );
@@@ -1529,6 -1525,30 +1579,30 @@@ gboolean TextureBrowser_button_press( u
                        }
                }
        }
 -              ScopeDisableScreenUpdates disableScreenUpdates( TextureBrowser_getComonShadersDir(), "Loading Textures" );
 -              TextureBrowser_ShowDirectory( *textureBrowser, TextureBrowser_getComonShadersDir() );
+       else if ( event->type == GDK_2BUTTON_PRESS ) {
+               #define GARUX_DISABLE_2BUTTON
+               #ifndef GARUX_DISABLE_2BUTTON
+               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 );
+                               }
+                       }
+               }
+               #endif
+       }
+       else if ( event->type == GDK_3BUTTON_PRESS ) {
++              ScopeDisableScreenUpdates disableScreenUpdates( TextureBrowser_getCommonShadersDir(), "Loading Textures" );
++              TextureBrowser_ShowDirectory( *textureBrowser, TextureBrowser_getCommonShadersDir() );
+               TextureBrowser_queueDraw( *textureBrowser );
+       }
        return FALSE;
  }
  
@@@ -1838,23 -1836,24 +1912,24 @@@ ui::MenuItem TextureBrowser_constructVi
  
        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" ) ) ) {
 -              g_TextureBrowser.m_showShaders = true;
 +      if ( g_pGameDescription->mGameType == "doom3" || TextureBrowser_showWads() ) {
 +              textureBrowser.m_showShaders = true;
        }
        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 ) {
 +      if ( 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" );
+       }
  
        menu_separator( menu );
        create_check_menu_item_with_mnemonic( menu, "Fixed Size", "FixedSize" );
@@@ -2688,10 -2576,10 +2763,11 @@@ void TextureBrowser_pasteTag()
  }
  
  void TextureBrowser_RefreshShaders(){
-       ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" );
-       GlobalShaderSystem().refresh();
-       UpdateAllWindows();
 +      TextureBrowser &textureBrowser = GlobalTextureBrowser();
+       /* 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. */
      auto selection = gtk_tree_view_get_selection(GlobalTextureBrowser().m_treeViewTree);
        GtkTreeModel* model = NULL;
        GtkTreeIter iter;
  }
  
  void TextureBrowser_ToggleShowShaders(){
 -      g_TextureBrowser.m_showShaders ^= 1;
 -      g_TextureBrowser.m_showshaders_item.update();
 +      GlobalTextureBrowser().m_showShaders ^= 1;
 +      GlobalTextureBrowser().m_showshaders_item.update();
 -      g_TextureBrowser.m_heightChanged = true;
 -      g_TextureBrowser.m_originInvalid = true;
++      GlobalTextureBrowser().m_heightChanged = true;
++      GlobalTextureBrowser().m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
 -      TextureBrowser_queueDraw( g_TextureBrowser );
++      TextureBrowser_queueDraw( GlobalTextureBrowser() );
+ }
+ void TextureBrowser_ToggleShowTextures(){
 -      g_TextureBrowser.m_showTextures ^= 1;
 -      g_TextureBrowser.m_showtextures_item.update();
++      GlobalTextureBrowser().m_showTextures ^= 1;
++      GlobalTextureBrowser().m_showtextures_item.update();
 -      g_TextureBrowser.m_heightChanged = true;
 -      g_TextureBrowser.m_originInvalid = true;
++      GlobalTextureBrowser().m_heightChanged = true;
++      GlobalTextureBrowser().m_originInvalid = true;
+       g_activeShadersChangedCallbacks();
 -      TextureBrowser_queueDraw( g_TextureBrowser );
 +      TextureBrowser_queueDraw( GlobalTextureBrowser() );
  }
  
  void TextureBrowser_ToggleShowShaderListOnly(){
  
  void TextureBrowser_showAll(){
        g_TextureBrowser_currentDirectory = "";
 -      g_TextureBrowser.m_searchedTags = false;
 -//    TextureBrowser_SetHideUnused( g_TextureBrowser, false );
 +      GlobalTextureBrowser().m_searchedTags = false;
-       TextureBrowser_heightChanged( GlobalTextureBrowser() );
++//    TextureBrowser_SetHideUnused( GlobalTextureBrowser(), false );
+       TextureBrowser_ToggleHideUnused();
 -      //TextureBrowser_heightChanged( g_TextureBrowser );
++      //TextureBrowser_heightChanged( GlobalTextureBrowser() );
        TextureBrowser_updateTitle();
  }
  
@@@ -2911,21 -2825,24 +3016,24 @@@ void TextureBrowser_Construct()
        GlobalCommands_insert( "CopyTag", makeCallbackF(TextureBrowser_copyTag) );
        GlobalCommands_insert( "PasteTag", makeCallbackF(TextureBrowser_pasteTag) );
        GlobalCommands_insert( "RefreshShaders", makeCallbackF(VFS_Refresh) );
 -      GlobalToggles_insert( "ShowInUse", makeCallbackF(TextureBrowser_ToggleHideUnused), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hideunused_item ), Accelerator( 'U' ) );
 +      GlobalToggles_insert( "ShowInUse", makeCallbackF(TextureBrowser_ToggleHideUnused), ToggleItem::AddCallbackCaller( textureBrowser.m_hideunused_item ), Accelerator( 'U' ) );
        GlobalCommands_insert( "ShowAllTextures", makeCallbackF(TextureBrowser_showAll), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) );
        GlobalCommands_insert( "ToggleTextures", makeCallbackF(TextureBrowser_toggleShow), Accelerator( 'T' ) );
-       GlobalToggles_insert( "ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders), ToggleItem::AddCallbackCaller( textureBrowser.m_showshaders_item ) );
-       GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly), ToggleItem::AddCallbackCaller( textureBrowser.m_showshaderlistonly_item ) );
-       GlobalToggles_insert( "FixedSize", makeCallbackF(TextureBrowser_FixedSize), ToggleItem::AddCallbackCaller( textureBrowser.m_fixedsize_item ) );
-       GlobalToggles_insert( "FilterMissing", makeCallbackF(TextureBrowser_FilterMissing), ToggleItem::AddCallbackCaller( textureBrowser.m_filternotex_item ) );
-       GlobalToggles_insert( "FilterFallback", makeCallbackF(TextureBrowser_FilterFallback), ToggleItem::AddCallbackCaller( textureBrowser.m_hidenotex_item ) );
-       GlobalToggles_insert( "EnableAlpha", makeCallbackF(TextureBrowser_EnableAlpha), ToggleItem::AddCallbackCaller( textureBrowser.m_enablealpha_item ) );
 -      GlobalToggles_insert( "ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) );
 -      GlobalToggles_insert( "ToggleShowTextures", makeCallbackF(TextureBrowser_ToggleShowTextures), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showtextures_item ) );
++      GlobalToggles_insert( "ToggleShowShaders", makeCallbackF(TextureBrowser_ToggleShowShaders), ToggleItem::AddCallbackCaller( GlobalTextureBrowser().m_showshaders_item ) );
++      GlobalToggles_insert( "ToggleShowTextures", makeCallbackF(TextureBrowser_ToggleShowTextures), ToggleItem::AddCallbackCaller( GlobalTextureBrowser().m_showtextures_item ) );
+       GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly),
 - ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) );
 -      GlobalToggles_insert( "FixedSize", makeCallbackF(TextureBrowser_FixedSize), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) );
 -      GlobalToggles_insert( "FilterMissing", makeCallbackF(TextureBrowser_FilterMissing), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) );
 -      GlobalToggles_insert( "FilterFallback", makeCallbackF(TextureBrowser_FilterFallback), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hidenotex_item ) );
 -      GlobalToggles_insert( "EnableAlpha", makeCallbackF(TextureBrowser_EnableAlpha), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_enablealpha_item ) );
 -
 -      GlobalPreferenceSystem().registerPreference( "TextureScale", make_property_string<TextureScale>(g_TextureBrowser) );
 -      GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string<UniformTextureSize>(g_TextureBrowser) );
 -      GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string<UniformTextureMinSize>(g_TextureBrowser) );
 -      GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string<TextureBrowser_ShowScrollbar>(GlobalTextureBrowser()));
 -      GlobalPreferenceSystem().registerPreference( "ShowShaders", make_property_string( GlobalTextureBrowser().m_showShaders ) );
++ ToggleItem::AddCallbackCaller( GlobalTextureBrowser().m_showshaderlistonly_item ) );
++      GlobalToggles_insert( "FixedSize", makeCallbackF(TextureBrowser_FixedSize), ToggleItem::AddCallbackCaller( GlobalTextureBrowser().m_fixedsize_item ) );
++      GlobalToggles_insert( "FilterMissing", makeCallbackF(TextureBrowser_FilterMissing), ToggleItem::AddCallbackCaller( GlobalTextureBrowser().m_filternotex_item ) );
++      GlobalToggles_insert( "FilterFallback", makeCallbackF(TextureBrowser_FilterFallback), ToggleItem::AddCallbackCaller( GlobalTextureBrowser().m_hidenotex_item ) );
++      GlobalToggles_insert( "EnableAlpha", makeCallbackF(TextureBrowser_EnableAlpha), ToggleItem::AddCallbackCaller( GlobalTextureBrowser().m_enablealpha_item ) );
 +
 +      GlobalPreferenceSystem().registerPreference( "TextureScale", make_property_string<TextureScale>(textureBrowser) );
 +      GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string<UniformTextureSize>(textureBrowser) );
 +      GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string<UniformTextureMinSize>(textureBrowser) );
 +      GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string<TextureBrowser_ShowScrollbar>(textureBrowser));
 +      GlobalPreferenceSystem().registerPreference( "ShowShaders", make_property_string( textureBrowser.m_showShaders ) );
+       GlobalPreferenceSystem().registerPreference( "ShowTextures", make_property_string( GlobalTextureBrowser().m_showTextures ) );
        GlobalPreferenceSystem().registerPreference( "ShowShaderlistOnly", make_property_string( g_TextureBrowser_shaderlistOnly ) );
        GlobalPreferenceSystem().registerPreference( "FixedSize", make_property_string( g_TextureBrowser_fixedSize ) );
        GlobalPreferenceSystem().registerPreference( "FilterMissing", make_property_string( g_TextureBrowser_filterMissing ) );
index 3c09ba2acb5f4fb7af5da4faa899dd4c7b9b7c7d,48a1f86fbde046b5b81b411cb15f18167991125e..345846e67045436c0a7a45acae85fe0df3b8aa1c
  #include "mathlib.h"
  #include "inout.h"
  #include "vfs.h"
 -#include <minizip/unzip.h>
 +#include <unzip.h>
  #include <glib.h>
- #define BAD_MINIZ
- #ifndef BAD_MINIZ
+ #define GARUX_DISABLE_BAD_MINIZ
+ #ifndef GARUX_DISABLE_BAD_MINIZ
  #include "miniz.h"
  #endif