X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=radiant%2Ftexwindow.cpp;h=c0f2eab6f620216098342ead25cb623479619fed;hb=b9b9429a0af5ac07140c7b7f53dd1d535006c44f;hp=be8a14405da27bbd6122d5040c72d7a61d282972;hpb=25bc3d37006d81690d21a510888cef745a79dcdf;p=xonotic%2Fnetradiant.git diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index be8a1440..c0f2eab6 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -685,17 +685,35 @@ NOTE: for texture window layout: ( the GL textures are not flushed though) ============== */ + +bool endswith(const char *haystack, const char *needle) +{ + size_t lh = strlen(haystack); + size_t ln = strlen(needle); + if(lh < ln) + return false; + return !memcmp(haystack + (lh - ln), needle, ln); +} + bool texture_name_ignore(const char* name) { StringOutputStream strTemp(string_length(name)); strTemp << LowerCase(name); - return strstr(strTemp.c_str(), ".specular") != 0 || - strstr(strTemp.c_str(), ".glow") != 0 || - strstr(strTemp.c_str(), ".bump") != 0 || - strstr(strTemp.c_str(), ".diffuse") != 0 || - strstr(strTemp.c_str(), ".blend") != 0 || - strstr(strTemp.c_str(), ".alpha") != 0; + return + endswith(strTemp.c_str(), ".specular") || + endswith(strTemp.c_str(), ".glow") || + endswith(strTemp.c_str(), ".bump") || + endswith(strTemp.c_str(), ".diffuse") || + endswith(strTemp.c_str(), ".blend") || + endswith(strTemp.c_str(), ".alpha") || + endswith(strTemp.c_str(), "_norm") || + endswith(strTemp.c_str(), "_bump") || + endswith(strTemp.c_str(), "_glow") || + endswith(strTemp.c_str(), "_gloss") || + endswith(strTemp.c_str(), "_pants") || + endswith(strTemp.c_str(), "_shirt") || + 0; } class LoadShaderVisitor : public Archive::Visitor @@ -2085,7 +2103,7 @@ GtkWidget* TextureBrowser_constructWindow(GtkWindow* toplevel) gtk_widget_show(GTK_WIDGET(g_TextureBrowser.m_treeViewTree)); } { // gl_widget scrollbar - GtkWidget* w = gtk_vscrollbar_new(GTK_ADJUSTMENT(gtk_adjustment_new (0,0,0,1,1,1))); + GtkWidget* w = gtk_vscrollbar_new(GTK_ADJUSTMENT(gtk_adjustment_new (0,0,0,1,1,0))); gtk_table_attach(GTK_TABLE (table), w, 2, 3, 1, 2, GTK_SHRINK, GTK_FILL, 0, 0); gtk_widget_show(w); g_TextureBrowser.m_texture_scroll = w;