From: Thomas Debesse Date: Tue, 12 Feb 2019 00:43:30 +0000 (+0100) Subject: Merge commit '23d2497f12fe91a5eb0e14b71095cbb1c2ec80cb' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1730832afea74a75aeed212d19d2a1bce354c7ec;p=xonotic%2Fnetradiant.git Merge commit '23d2497f12fe91a5eb0e14b71095cbb1c2ec80cb' into garux-merge --- 1730832afea74a75aeed212d19d2a1bce354c7ec diff --cc radiant/mainframe.cpp index 23632f4c,45348b98..93edac9a --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -2922,51 -2775,70 +2922,63 @@@ void MainFrame::Create() register_shortcuts(); - GtkMenuBar* main_menu = create_main_menu( CurrentStyle() ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( main_menu ), FALSE, FALSE, 0 ); - - GtkToolbar* main_toolbar = create_main_toolbar( CurrentStyle() ); - gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( main_toolbar ), FALSE, FALSE, 0 ); - - + auto main_menu = create_main_menu( CurrentStyle() ); + vbox.pack_start( main_menu, FALSE, FALSE, 0 ); + auto main_toolbar = create_main_toolbar( CurrentStyle() ); + vbox.pack_start( main_toolbar, FALSE, FALSE, 0 ); - auto plugin_toolbar = create_plugin_toolbar(); - if ( !g_Layout_enablePluginToolbar.m_value ) { - plugin_toolbar.hide(); - } - - if ( g_Layout_enableFilterToolbar.m_value ) { - auto space = [&]() { - auto btn = gtk_separator_tool_item_new(); - gtk_widget_show(GTK_WIDGET(btn)); - gtk_container_add(GTK_CONTAINER(plugin_toolbar), GTK_WIDGET(btn)); - }; - - space(); - 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.png", "FilterPatches" ); - space(); - 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" ); - space(); - toolbar_append_toggle_button( plugin_toolbar, "Entities (ALT + 2)", "f-entities.bmp", "FilterEntities" ); - toolbar_append_toggle_button( plugin_toolbar, "Lights (ALT + 0)", "lightinspector.png", "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" ); - space(); - toolbar_append_button( plugin_toolbar, "InvertFilters", "f-invert.bmp", "InvertFilters" ); - toolbar_append_button( plugin_toolbar, "ResetFilters", "f-reset.bmp", "ResetFilters" ); + 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 ); ++ auto PFbox = ui::HBox( FALSE, 3 ); ++ vbox.pack_start( PFbox, FALSE, FALSE, 0 ); ++ PFbox.show(); + if ( g_Layout_enablePluginToolbar.m_value ){ - GtkToolbar* plugin_toolbar = create_plugin_toolbar(); ++ auto 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 ); ++ PFbox.pack_start( plugin_toolbar, FALSE, FALSE, 0 ); + } + else{ - gtk_box_pack_start( GTK_BOX( PFbox ), GTK_WIDGET( plugin_toolbar ), TRUE, TRUE, 0 ); ++ PFbox.pack_start( 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 ) ); ++ auto filter_toolbar = create_filter_toolbar(); ++ filter_toolbar.show(); ++ ++ auto space = [&]() { ++ auto btn = gtk_separator_tool_item_new(); ++ gtk_widget_show(GTK_WIDGET(btn)); ++ gtk_container_add(GTK_CONTAINER(filter_toolbar), GTK_WIDGET(btn)); ++ }; + + 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, "Patches (CTRL + P)", "patch_wireframe.png", "FilterPatches" ); ++ space(); + 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 ) ); ++ space(); + 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, "Lights (ALT + 0)", "lightinspector.png", "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 ) ); ++ space(); + 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 ); ++ PFbox.pack_start( filter_toolbar, FALSE, FALSE, 0 ); + } } - vbox.pack_start( plugin_toolbar, FALSE, FALSE, 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 ) { - } - - - - - GtkWidget* main_statusbar = create_main_statusbar( m_pStatusLabel ); - gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 ); + ui::Widget main_statusbar = create_main_statusbar(reinterpret_cast(m_pStatusLabel)); + vbox.pack_end(main_statusbar, FALSE, TRUE, 2); GroupDialog_constructWindow( window ); g_page_entity = GroupDialog_addPage( "Entities", EntityInspector_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Entities" ) ); diff --cc radiant/plugintoolbar.cpp index aea1b321,03ef2074..61f2f4a4 --- a/radiant/plugintoolbar.cpp +++ b/radiant/plugintoolbar.cpp @@@ -115,19 -117,20 +115,33 @@@ public } void PluginToolbar_clear(){ - container_remove_all( GTK_CONTAINER( g_plugin_toolbar ) ); + container_remove_all( g_plugin_toolbar ); +} + +ui::Toolbar create_plugin_toolbar(){ + + auto toolbar = ui::Toolbar::from( gtk_toolbar_new() ); + gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL ); + gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS ); + toolbar.show(); + + g_plugin_toolbar = toolbar; + + PluginToolbar_populate(); + + return toolbar; } + -GtkToolbar* create_plugin_toolbar(){ - GtkToolbar *toolbar; ++ui::Toolbar create_filter_toolbar(){ + - toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); - gtk_toolbar_set_orientation( toolbar, GTK_ORIENTATION_HORIZONTAL ); ++ auto toolbar = ui::Toolbar::from( gtk_toolbar_new() ); ++ gtk_orientable_set_orientation( GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL ); + gtk_toolbar_set_style( toolbar, GTK_TOOLBAR_ICONS ); - gtk_widget_show( GTK_WIDGET( toolbar ) ); ++ toolbar.show(); + + g_plugin_toolbar = toolbar; + + PluginToolbar_populate(); + + return toolbar; + } diff --cc radiant/plugintoolbar.h index ca35b1bc,7621cfd2..97c637f2 --- a/radiant/plugintoolbar.h +++ b/radiant/plugintoolbar.h @@@ -24,7 -22,8 +24,9 @@@ #if !defined( INCLUDED_PLUGINTOOLBAR_H ) #define INCLUDED_PLUGINTOOLBAR_H -typedef struct _GtkToolbar GtkToolbar; -GtkToolbar* create_plugin_toolbar(); +ui::Toolbar create_plugin_toolbar(); ++ui::Toolbar create_filter_toolbar(); ++ void PluginToolbar_populate(); void PluginToolbar_clear(); diff --cc radiant/texwindow.cpp index 2b4ad184,24e71a38..ef0fc6f9 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -234,33 -189,26 +234,37 @@@ enum StartupShader STARTUPSHADERS_COMMON, }; -void TextureBrowser_hideUnusedExport( const BoolImportCallback& importer ); -typedef FreeCaller1 TextureBrowserHideUnusedExport; +void TextureBrowser_hideUnusedExport( const Callback & importer ); + +typedef FreeCaller &), TextureBrowser_hideUnusedExport> TextureBrowserHideUnusedExport; + +void TextureBrowser_showShadersExport( const Callback & importer ); + +typedef FreeCaller &), TextureBrowser_showShadersExport> TextureBrowserShowShadersExport; + ++void TextureBrowser_showTexturesExport( const Callback & importer ); + -void TextureBrowser_showShadersExport( const BoolImportCallback& importer ); -typedef FreeCaller1 TextureBrowserShowShadersExport; ++typedef FreeCaller &), TextureBrowser_showTexturesExport> TextureBrowserShowTexturesExport; + -void TextureBrowser_showTexturesExport( const BoolImportCallback& importer ); -typedef FreeCaller1 TextureBrowserShowTexturesExport; +void TextureBrowser_showShaderlistOnly( const Callback & importer ); -void TextureBrowser_showShaderlistOnly( const BoolImportCallback& importer ); -typedef FreeCaller1 TextureBrowserShowShaderlistOnlyExport; +typedef FreeCaller &), TextureBrowser_showShaderlistOnly> TextureBrowserShowShaderlistOnlyExport; -void TextureBrowser_fixedSize( const BoolImportCallback& importer ); -typedef FreeCaller1 TextureBrowserFixedSizeExport; +void TextureBrowser_fixedSize( const Callback & importer ); -void TextureBrowser_filterNotex( const BoolImportCallback& importer ); -typedef FreeCaller1 TextureBrowserFilterNotexExport; +typedef FreeCaller &), TextureBrowser_fixedSize> TextureBrowserFixedSizeExport; -void TextureBrowser_enableAlpha( const BoolImportCallback& importer ); -typedef FreeCaller1 TextureBrowserEnableAlphaExport; +void TextureBrowser_filterMissing( const Callback & importer ); + +typedef FreeCaller &), TextureBrowser_filterMissing> TextureBrowserFilterMissingExport; + +void TextureBrowser_filterFallback( const Callback & importer ); + +typedef FreeCaller &), TextureBrowser_filterFallback> TextureBrowserFilterFallbackExport; + +void TextureBrowser_enableAlpha( const Callback & importer ); + +typedef FreeCaller &), TextureBrowser_enableAlpha> TextureBrowserEnableAlphaExport; class TextureBrowser { @@@ -293,8 -241,8 +297,9 @@@ std::vector m_copied_tags std::set m_found_shaders; ToggleItem m_hideunused_item; +ToggleItem m_hidenotex_item; ToggleItem m_showshaders_item; + ToggleItem m_showtextures_item; ToggleItem m_showshaderlistonly_item; ToggleItem m_fixedsize_item; ToggleItem m_filternotex_item; @@@ -400,13 -347,13 +406,14 @@@ void getTextureWH( qtexture_t* tex, in } TextureBrowser() : - m_texture_scroll( 0 ), + m_texture_scroll( ui::null ), m_hideunused_item( TextureBrowserHideUnusedExport() ), + m_hidenotex_item( TextureBrowserFilterFallbackExport() ), m_showshaders_item( TextureBrowserShowShadersExport() ), + m_showtextures_item( TextureBrowserShowTexturesExport() ), m_showshaderlistonly_item( TextureBrowserShowShaderlistOnlyExport() ), m_fixedsize_item( TextureBrowserFixedSizeExport() ), - m_filternotex_item( TextureBrowserFilterNotexExport() ), + m_filternotex_item( TextureBrowserFilterMissingExport() ), m_enablealpha_item( TextureBrowserEnableAlphaExport() ), m_heightChanged( true ), m_originInvalid( true ), @@@ -559,23 -507,14 +567,23 @@@ bool TextureSearch_IsShown( const char } } -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; + // filter missing shaders + // ugly: filter on built-in fallback name after substitution + if ( g_TextureBrowser_filterMissing ) { + if ( isMissing( shader->getTexture()->name ) ) { + return false; + } + } + // filter the fallback (notex/shadernotex) for missing shaders or editor image + if ( g_TextureBrowser_filterFallback ) { + if ( isNotex( shader->getName() ) ) { + return false; + } + if ( isNotex( shader->getTexture()->name ) ) { + return false; + } } if ( g_TextureBrowser_currentDirectory == "Untagged" ) { @@@ -702,12 -645,11 +714,13 @@@ Signal0 m_realiseCallbacks public: void realise(){ m_realiseCallbacks(); + /* texturebrowser tree update on vfs restart */ TextureBrowser_constructTreeStore(); } + void unrealise(){ } + void insert( const SignalHandler& handler ){ m_realiseCallbacks.connectLast( handler ); } @@@ -941,47 -863,40 +954,53 @@@ void TextureBrowser_ShowTagSearchResult bool TextureBrowser_hideUnused(); -void TextureBrowser_hideUnusedExport( const BoolImportCallback& importer ){ +void TextureBrowser_hideUnusedExport( const Callback & importer ){ importer( TextureBrowser_hideUnused() ); } -typedef FreeCaller1 TextureBrowserHideUnusedExport; -void TextureBrowser_showShadersExport( const BoolImportCallback& importer ){ +typedef FreeCaller &), TextureBrowser_hideUnusedExport> TextureBrowserHideUnusedExport; + +void TextureBrowser_showShadersExport( const Callback & importer ){ importer( GlobalTextureBrowser().m_showShaders ); } -typedef FreeCaller1 TextureBrowserShowShadersExport; -void TextureBrowser_showTexturesExport( const BoolImportCallback& importer ){ +typedef FreeCaller &), TextureBrowser_showShadersExport> TextureBrowserShowShadersExport; + ++void TextureBrowser_showTexturesExport( const Callback & importer ){ + importer( GlobalTextureBrowser().m_showTextures ); + } -typedef FreeCaller1 TextureBrowserShowTexturesExport; + -void TextureBrowser_showShaderlistOnly( const BoolImportCallback& importer ){ ++typedef FreeCaller &), TextureBrowser_showTexturesExport> TextureBrowserShowTexturesExport; ++ +void TextureBrowser_showShaderlistOnly( const Callback & importer ){ importer( g_TextureBrowser_shaderlistOnly ); } -typedef FreeCaller1 TextureBrowserShowShaderlistOnlyExport; -void TextureBrowser_fixedSize( const BoolImportCallback& importer ){ +typedef FreeCaller &), TextureBrowser_showShaderlistOnly> TextureBrowserShowShaderlistOnlyExport; + +void TextureBrowser_fixedSize( const Callback & importer ){ importer( g_TextureBrowser_fixedSize ); } -typedef FreeCaller1 TextureBrowser_FixedSizeExport; -void TextureBrowser_filterNotex( const BoolImportCallback& importer ){ - importer( g_TextureBrowser_filterNotex ); +typedef FreeCaller &), TextureBrowser_fixedSize> TextureBrowser_FixedSizeExport; + +void TextureBrowser_filterMissing( const Callback & importer ){ + importer( g_TextureBrowser_filterMissing ); } -typedef FreeCaller1 TextureBrowser_filterNotexExport; -void TextureBrowser_enableAlpha( const BoolImportCallback& importer ){ +typedef FreeCaller &), TextureBrowser_filterMissing> TextureBrowser_filterMissingExport; + +void TextureBrowser_filterFallback( const Callback & importer ){ + importer( g_TextureBrowser_filterFallback ); +} + +typedef FreeCaller &), TextureBrowser_filterFallback> TextureBrowser_filterFallbackExport; + +void TextureBrowser_enableAlpha( const Callback & importer ){ importer( g_TextureBrowser_enableAlpha ); } -typedef FreeCaller1 TextureBrowser_enableAlphaExport; + +typedef FreeCaller &), TextureBrowser_enableAlpha> TextureBrowser_enableAlphaExport; void TextureBrowser_SetHideUnused( TextureBrowser& textureBrowser, bool hideUnused ){ if ( hideUnused ) { @@@ -1176,6 -1091,7 +1195,8 @@@ void Texture_Draw( TextureBrowser& text glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glDisable( GL_DEPTH_TEST ); ++ + //glDisable( GL_BLEND ); if ( g_TextureBrowser_enableAlpha ) { glEnable( GL_BLEND ); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@@ -1753,16 -1726,9 +1824,15 @@@ ui::MenuItem TextureBrowser_constructVi } create_check_menu_item_with_mnemonic( menu, "Hide _Unused", "ShowInUse" ); - create_menu_item_with_mnemonic( menu, "Show All", "ShowAllTextures" ); + if ( string_empty( g_pGameDescription->getKeyValue( "show_wads" ) ) ) { + create_check_menu_item_with_mnemonic( menu, "Hide Image Missing", "FilterMissing" ); + } + + // hide notex and shadernotex on texture browser: no one wants to apply them + create_check_menu_item_with_mnemonic( menu, "Hide Fallback", "FilterFallback" ); + 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" ) ) ) { @@@ -1776,11 -1744,14 +1848,11 @@@ 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 ); - } + menu_separator( menu ); create_check_menu_item_with_mnemonic( menu, "Fixed Size", "FixedSize" ); create_check_menu_item_with_mnemonic( menu, "Transparency", "EnableAlpha" ); @@@ -2500,11 -2476,12 +2572,12 @@@ void TextureBrowser_pasteTag() BuildStoreAvailableTags( g_TextureBrowser.m_available_store, g_TextureBrowser.m_assigned_store, g_TextureBrowser.m_all_tags, &g_TextureBrowser ); } -void RefreshShaders(){ +void TextureBrowser_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); + auto selection = gtk_tree_view_get_selection(GlobalTextureBrowser().m_treeViewTree); GtkTreeModel* model = NULL; GtkTreeIter iter; if ( gtk_tree_selection_get_selected (selection, &model, &iter) ) @@@ -2521,6 -2502,12 +2599,12 @@@ TextureBrowser_ShowDirectory( GlobalTextureBrowser(), dirName ); TextureBrowser_queueDraw( GlobalTextureBrowser() ); } ++ + else{ + ScopeDisableScreenUpdates disableScreenUpdates( "Processing...", "Loading Shaders" ); + GlobalShaderSystem().refresh(); + UpdateAllWindows(); + } - } void TextureBrowser_ToggleShowShaders(){ @@@ -2712,36 -2705,47 +2814,39 @@@ void TextureBrowser_registerPreferences void TextureClipboard_textureSelected( const char* shader ); void TextureBrowser_Construct(){ - GlobalCommands_insert( "ShaderInfo", FreeCaller() ); - GlobalCommands_insert( "ShowUntagged", FreeCaller() ); - GlobalCommands_insert( "AddTag", FreeCaller() ); - GlobalCommands_insert( "RenameTag", FreeCaller() ); - GlobalCommands_insert( "DeleteTag", FreeCaller() ); - GlobalCommands_insert( "CopyTag", FreeCaller() ); - GlobalCommands_insert( "PasteTag", FreeCaller() ); - GlobalCommands_insert( "RefreshShaders", FreeCaller() ); - GlobalToggles_insert( "ShowInUse", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_hideunused_item ), Accelerator( 'U' ) ); - GlobalCommands_insert( "ShowAllTextures", FreeCaller(), Accelerator( 'A', (GdkModifierType)GDK_CONTROL_MASK ) ); - GlobalCommands_insert( "ToggleTextures", FreeCaller(), Accelerator( 'T' ) ); - GlobalToggles_insert( "ToggleShowShaders", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaders_item ) ); - GlobalToggles_insert( "ToggleShowTextures", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showtextures_item ) ); - GlobalToggles_insert( "ToggleShowShaderlistOnly", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) ); - GlobalToggles_insert( "FixedSize", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_fixedsize_item ) ); - GlobalToggles_insert( "FilterNotex", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_filternotex_item ) ); - GlobalToggles_insert( "EnableAlpha", FreeCaller(), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_enablealpha_item ) ); - - GlobalPreferenceSystem().registerPreference( "TextureScale", - makeSizeStringImportCallback( TextureBrowserSetScaleCaller( g_TextureBrowser ) ), - SizeExportStringCaller( g_TextureBrowser.m_textureScale ) - ); - GlobalPreferenceSystem().registerPreference( "UniformTextureSize", - makeIntStringImportCallback(UniformTextureSizeImportCaller(g_TextureBrowser)), - IntExportStringCaller(g_TextureBrowser.m_uniformTextureSize) ); - GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize", - makeIntStringImportCallback(UniformTextureMinSizeImportCaller(g_TextureBrowser)), - IntExportStringCaller(g_TextureBrowser.m_uniformTextureMinSize) ); - GlobalPreferenceSystem().registerPreference( "TextureScrollbar", - makeBoolStringImportCallback( TextureBrowserImportShowScrollbarCaller( g_TextureBrowser ) ), - 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( GlobalTextureBrowser().m_startupShaders ) ), IntExportStringCaller( reinterpret_cast( 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 ) ); + GlobalCommands_insert( "ShaderInfo", makeCallbackF(TextureBrowser_shaderInfo) ); + GlobalCommands_insert( "ShowUntagged", makeCallbackF(TextureBrowser_showUntagged) ); + GlobalCommands_insert( "AddTag", makeCallbackF(TextureBrowser_addTag) ); + GlobalCommands_insert( "RenameTag", makeCallbackF(TextureBrowser_renameTag) ); + GlobalCommands_insert( "DeleteTag", makeCallbackF(TextureBrowser_deleteTag) ); + 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' ) ); + 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( g_TextureBrowser.m_showshaders_item ) ); - GlobalToggles_insert( "ToggleShowShaderlistOnly", makeCallbackF(TextureBrowser_ToggleShowShaderListOnly), ToggleItem::AddCallbackCaller( g_TextureBrowser.m_showshaderlistonly_item ) ); ++ GlobalToggles_insert( "ToggleShowTextures", makeCallbackF(TextureBrowser_ToggleShowTextures), ToggleItem::AddCallbackCaller( g_TextureBrowser.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 ) ); ++ 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 ) ); + GlobalPreferenceSystem().registerPreference( "EnableAlpha", make_property_string( g_TextureBrowser_enableAlpha ) ); + GlobalPreferenceSystem().registerPreference( "LoadShaders", make_property_string( reinterpret_cast( GlobalTextureBrowser().m_startupShaders ) ) ); + GlobalPreferenceSystem().registerPreference( "WheelMouseInc", make_property_string( GlobalTextureBrowser().m_mouseWheelScrollIncrement ) ); + GlobalPreferenceSystem().registerPreference( "SI_Colors0", make_property_string( GlobalTextureBrowser().color_textureback ) ); g_TextureBrowser.shader = texdef_name_default();