]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/entity.cpp
menus...
[xonotic/netradiant.git] / radiant / entity.cpp
index ab3243b0a8f8ea3465ebfe85a8cde0c31e6ea9ab..6926b76d2387991f0db98d3e4fd9c3fa8b65426a 100644 (file)
@@ -45,6 +45,9 @@
 #include "qe3.h"
 #include "commands.h"
 
+#include "brushmanip.h"
+#include "patchmanip.h"
+
 struct entity_globals_t
 {
        Vector3 color_entity;
@@ -296,7 +299,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;
 
@@ -386,6 +389,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
@@ -539,7 +554,7 @@ const char* misc_model_dialog( GtkWidget* parent ){
        }
        return 0;
 }
-
+/*
 void LightRadiiImport( EntityCreator& self, bool value ){
        self.setLightRadii( value );
 }
@@ -564,16 +579,29 @@ void Entity_constructPage( PreferenceGroup& group ){
 void Entity_registerPreferencesPage(){
        PreferencesDialog_addDisplayPage( FreeCaller1<PreferenceGroup&, Entity_constructPage>() );
 }
+*/
 
-
+void ShowLightRadiiExport( const BoolImportCallback& importer ){
+       importer( GlobalEntityCreator().getLightRadii() );
+}
+typedef FreeCaller1<const BoolImportCallback&, ShowLightRadiiExport> ShowLightRadiiExportCaller;
+ShowLightRadiiExportCaller g_show_lightradii_caller;
+ToggleItem g_show_lightradii_item( g_show_lightradii_caller );
+void ToggleShowLightRadii(){
+       GlobalEntityCreator().setLightRadii( !GlobalEntityCreator().getLightRadii() );
+       g_show_lightradii_item.update();
+       UpdateAllWindows();
+}
 
 void Entity_constructMenu( GtkMenu* menu ){
        create_menu_item_with_mnemonic( menu, "_Regroup", "GroupSelection" );
        create_menu_item_with_mnemonic( menu, "_Ungroup", "UngroupSelection" );
        create_menu_item_with_mnemonic( menu, "_Connect", "ConnectSelection" );
-       create_menu_item_with_mnemonic( menu, "_KillConnect", "KillConnectSelection" );
+       if ( g_pGameDescription->mGameType == "nexuiz" ) {
+               create_menu_item_with_mnemonic( menu, "_KillConnect", "KillConnectSelection" );
+       }
        create_menu_item_with_mnemonic( menu, "_Select Color...", "EntityColor" );
-       create_menu_item_with_mnemonic( menu, "_Normalize Color...", "NormalizeColor" );
+       create_menu_item_with_mnemonic( menu, "_Normalize Color", "NormalizeColor" );
 }
 
 
@@ -589,10 +617,12 @@ void Entity_Construct(){
        GlobalCommands_insert( "GroupSelection", FreeCaller<Entity_groupSelected>() );
        GlobalCommands_insert( "UngroupSelection", FreeCaller<Entity_ungroupSelected>() );
 
+       GlobalToggles_insert( "ShowLightRadiuses", FreeCaller<ToggleShowLightRadii>(), ToggleItem::AddCallbackCaller( g_show_lightradii_item ) );
+
        GlobalPreferenceSystem().registerPreference( "SI_Colors5", Vector3ImportStringCaller( g_entity_globals.color_entity ), Vector3ExportStringCaller( g_entity_globals.color_entity ) );
        GlobalPreferenceSystem().registerPreference( "LastLightIntensity", IntImportStringCaller( g_iLastLightIntensity ), IntExportStringCaller( g_iLastLightIntensity ) );
 
-       Entity_registerPreferencesPage();
+//     Entity_registerPreferencesPage();
 }
 
 void Entity_Destroy(){