]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/entity.cpp
Merge commit '4ee1a6ee1ae75d52984e54e689ef1e587b384bcb' into master-merge
[xonotic/netradiant.git] / radiant / entity.cpp
index f7579e5e6573ff80300d56510e2c8fbcd18391f4..c555715cc2fccf995b03214518fa4fa83fe907e1 100644 (file)
@@ -47,6 +47,9 @@
 #include "qe3.h"
 #include "commands.h"
 
+#include "brushmanip.h"
+#include "patchmanip.h"
+
 #include "uilib/uilib.h"
 
 struct entity_globals_t
@@ -306,7 +309,7 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
 
        bool isModel = ( string_compare_nocase_n( name, "misc_", 5 ) == 0 && string_equal_nocase( name + string_length( name ) - 5, "model" ) ) // misc_*model (also misc_model)
                                   || string_equal_nocase( name, "model_static" )
-                                  || ( GlobalSelectionSystem().countSelected() == 0 && string_equal_nocase( name, "func_static" ) );
+                                  || ( GlobalSelectionSystem().countSelected() == 0 && string_equal_nocase( name, "func_static" ) && g_pGameDescription->mGameType == "doom3" );
 
        bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
 
@@ -396,6 +399,18 @@ void Entity_createFromSelection( const char* name, const Vector3& origin ){
                        Node_getEntity( node )->setKeyValue( "model", model );
                }
        }
+
+       if ( string_compare_nocase_n( name, "trigger_", 8 ) == 0 && brushesSelected ){
+               const char* shader = g_pGameDescription->getKeyValue( "shader_trigger" );
+               if ( shader && *shader ){
+                       Scene_PatchSetShader_Selected( GlobalSceneGraph(), shader );
+                       Scene_BrushSetShader_Selected( GlobalSceneGraph(), shader );
+               }
+               else{
+                       Scene_PatchSetShader_Selected( GlobalSceneGraph(), "textures/common/trigger" );
+                       Scene_BrushSetShader_Selected( GlobalSceneGraph(), "textures/common/trigger" );
+               }
+       }
 }
 
 #if 0