From: Thomas Debesse Date: Mon, 20 Jun 2022 02:44:41 +0000 (+0200) Subject: Merge commit 'b243946c9ffd022cd5d82f2cf474ebfb125929b9' into master-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2f3b74eff8ba0ca83d3f7d14fe11f93483d22c89;p=xonotic%2Fnetradiant.git Merge commit 'b243946c9ffd022cd5d82f2cf474ebfb125929b9' into master-merge --- 2f3b74eff8ba0ca83d3f7d14fe11f93483d22c89 diff --cc radiant/texwindow.cpp index edfe4bc7,1d766aea..81d1edc0 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -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 } } } + 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_getComonShadersDir(), "Loading Textures" ); - TextureBrowser_ShowDirectory( *textureBrowser, TextureBrowser_getComonShadersDir() ); ++ 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(){ + TextureBrowser &textureBrowser = GlobalTextureBrowser(); - 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. */ + auto selection = gtk_tree_view_get_selection(GlobalTextureBrowser().m_treeViewTree); GtkTreeModel* model = NULL; GtkTreeIter iter; @@@ -2712,9 -2611,25 +2799,25 @@@ } 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(){ @@@ -2726,8 -2641,10 +2829,10 @@@ 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(g_TextureBrowser) ); - GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string(g_TextureBrowser) ); - GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string(g_TextureBrowser) ); - GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string(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(textureBrowser) ); + GlobalPreferenceSystem().registerPreference( "UniformTextureSize", make_property_string(textureBrowser) ); + GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", make_property_string(textureBrowser) ); + GlobalPreferenceSystem().registerPreference( "TextureScrollbar", make_property_string(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 ) ); diff --cc tools/quake3/common/vfs.c index 3c09ba2a,48a1f86f..345846e6 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@@ -50,10 -50,10 +50,10 @@@ #include "mathlib.h" #include "inout.h" #include "vfs.h" -#include +#include #include - #define BAD_MINIZ - #ifndef BAD_MINIZ + #define GARUX_DISABLE_BAD_MINIZ + #ifndef GARUX_DISABLE_BAD_MINIZ #include "miniz.h" #endif