]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/patchmanip.cpp
Radiant:
[xonotic/netradiant.git] / radiant / patchmanip.cpp
index 4a7e72abed0c1b365f5958207e383f11f35a459b..8d7d5f99cb85bbcf0721fe44f39eba66b7fa3b8c 100644 (file)
@@ -453,12 +453,28 @@ void operator()( Patch& patch ) const {
 }
 };
 
+namespace{
+bool DoingSearch( const char *repl ){
+       return ( repl == NULL || ( strcmp( "textures/", repl ) == 0 ) );
+}
+}
 void Scene_PatchFindReplaceShader( scene::Graph& graph, const char* find, const char* replace ){
-       Scene_forEachVisiblePatch( PatchFindReplaceShader( find, replace ) );
+       if( DoingSearch( replace ) ){
+               Scene_forEachVisiblePatchInstance( PatchSelectByShader( find ) );
+       }
+       else{
+               Scene_forEachVisiblePatch( PatchFindReplaceShader( find, replace ) );
+       }
 }
 
 void Scene_PatchFindReplaceShader_Selected( scene::Graph& graph, const char* find, const char* replace ){
-       Scene_forEachVisibleSelectedPatch( PatchFindReplaceShader( find, replace ) );
+       if( DoingSearch( replace ) ){
+               //do nothing, because alternative is replacing to notex
+               //perhaps deselect ones with not matching shaders here?
+       }
+       else{
+               Scene_forEachVisibleSelectedPatch( PatchFindReplaceShader( find, replace ) );
+       }
 }
 
 
@@ -758,13 +774,15 @@ bool filter( const Patch& patch ) const {
 
 
 filter_patch_all g_filter_patch_all;
-filter_patch_shader g_filter_patch_clip( "textures/common/clip" );
+filter_patch_flags g_filter_patch_clip( QER_CLIP );
+filter_patch_shader g_filter_patch_commonclip( "textures/common/clip" );
 filter_patch_shader g_filter_patch_weapclip( "textures/common/weapclip" );
-filter_patch_flags g_filter_patch_translucent( QER_TRANS );
+filter_patch_flags g_filter_patch_translucent( QER_TRANS | QER_ALPHATEST );
 
 void PatchFilters_construct(){
        add_patch_filter( g_filter_patch_all, EXCLUDE_CURVES );
        add_patch_filter( g_filter_patch_clip, EXCLUDE_CLIP );
+       add_patch_filter( g_filter_patch_commonclip, EXCLUDE_CLIP );
        add_patch_filter( g_filter_patch_weapclip, EXCLUDE_CLIP );
        add_patch_filter( g_filter_patch_translucent, EXCLUDE_TRANSLUCENT );
 }