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 );
bool g_TextureBrowser_shaderlistOnly = false;
bool g_TextureBrowser_fixedSize = true;
bool g_TextureBrowser_filterNotex = false;
+bool g_TextureBrowser_enableAlpha = true;
}
class DeferredAdjustment
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;
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:
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;
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
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 ),
m_mouseWheelScrollIncrement( 64 ),
m_textureScale( 50 ),
m_showShaders( true ),
+ m_showTextures( true ),
m_showTextureScrollbar( true ),
m_startupShaders( STARTUPSHADERS_NONE ),
m_hideUnused( false ),
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;
return false;
}
+ if ( !show_textures && shader->IsDefault() ) {
+ return false;
+ }
+
if ( hideUnused && !shader->IsInUse() ) {
return false;
}
{
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;
}
public:
void realise(){
m_realiseCallbacks();
+ /* texturebrowser tree update on vfs restart */
TextureBrowser_constructTreeStore();
}
void unrealise(){
}
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 );
}
}
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;
{
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;
}
{
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;
}
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 );
{
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;
}
// 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 );
}
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
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 );
}
}
}
}
+ 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;
}
}
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" ) ) ) {
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 );
}
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 );
}
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();
}
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: ";
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 ) ),
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 ) );