diff --git a/radiant/console.cpp b/radiant/console.cpp index 0192f4e4..2e08e3a5 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -106,6 +106,8 @@ gboolean destroy_set_null( GtkWindow* widget, GtkWidget** p ){ WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" ); +#include + GtkWidget* Console_constructWindow( GtkWindow* toplevel ){ GtkWidget* scr = gtk_scrolled_window_new( 0, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); @@ -131,9 +133,13 @@ GtkWidget* Console_constructWindow( GtkWindow* toplevel ){ g_signal_connect( G_OBJECT( g_console ), "destroy", G_CALLBACK( destroy_set_null ), &g_console ); } - gtk_container_set_focus_chain( GTK_CONTAINER( scr ), NULL ); + //prevent focusing on text view after click on tab of floating group dialog (np, if called via hotkey) + GtkWidget* vbox = gtk_vbox_new( FALSE, 0 ); + gtk_widget_show( vbox ); + gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 ); + gtk_container_set_focus_chain( GTK_CONTAINER( vbox ), NULL ); - return scr; + return vbox; } //#pragma GCC push_options diff --git a/radiant/entity.cpp b/radiant/entity.cpp index 78b433f7..2e9fb161 100644 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@ -47,6 +47,8 @@ #include "brushmanip.h" #include "patchmanip.h" +#include "filterbar.h" + struct entity_globals_t { @@ -91,10 +93,37 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const { } void post( const scene::Path& path, scene::Instance& instance ) const { Entity* entity = Node_getEntity( path.top() ); - if ( entity != 0 - && ( instance.childSelected() || Instance_getSelectable( instance )->isSelected() ) ) { + if ( entity != 0 && ( instance.childSelected() || Instance_getSelectable( instance )->isSelected() ) ) { if( string_equal( entity->getKeyValue( "classname" ), "worldspawn" ) ){ - globalErrorStream() << "do not want to convert worldspawn entity\n"; + //globalErrorStream() << "do not want to convert worldspawn entity\n"; + + if( instance.childSelected() ){ + EntityClass* entityClass = GlobalEntityClassManager().findOrInsert( m_classname, true ); + if( entityClass->fixedsize ) + return; + + //is important to have retexturing here; if doing in the end, undo doesn't succeed; +// if ( string_compare_nocase_n( m_classname, "trigger_", 8 ) == 0 ){ +// Scene_PatchSetShader_Selected( GlobalSceneGraph(), GetCommonShader( "trigger" ).c_str() ); +// Scene_BrushSetShader_Selected( GlobalSceneGraph(), GetCommonShader( "trigger" ).c_str() ); +// } + + NodeSmartReference node( GlobalEntityCreator().createEntity( entityClass ) ); + + Node_getTraversable( GlobalSceneGraph().root() )->insert( node ); + + scene::Path entitypath( makeReference( GlobalSceneGraph().root() ) ); + entitypath.push( makeReference( node.get() ) ); + scene::Instance& entityInstance = findInstance( entitypath ); + + if ( g_pGameDescription->mGameType == "doom3" ) { + Node_getEntity( node )->setKeyValue( "model", Node_getEntity( node )->getKeyValue( "name" ) ); + } + + //Scene_parentSelectedBrushesToEntity( GlobalSceneGraph(), node ); + Scene_parentSubgraphSelectedBrushesToEntity( GlobalSceneGraph(), node, path ); + Scene_forEachChildSelectable( SelectableSetSelected( true ), entityInstance.path() ); + } return; } @@ -327,7 +356,6 @@ AABB Doom3Light_getBounds( const AABB& workzone ){ return AABB( Vector3( 0, 0, 0 ), Vector3( 64, 64, 64 ) ); } -#include "filterbar.h" int g_iLastLightIntensity; diff --git a/radiant/map.cpp b/radiant/map.cpp index 90c7f9b5..4cad6ccb 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -1832,6 +1832,10 @@ void Scene_parentSelectedBrushesToEntity( scene::Graph& graph, scene::Node& pare graph.traverse( ParentSelectedBrushesToEntityWalker( parent ) ); } +void Scene_parentSubgraphSelectedBrushesToEntity( scene::Graph& graph, scene::Node& parent, const scene::Path& start ){ + graph.traverse_subgraph( ParentSelectedBrushesToEntityWalker( parent ), start ); +} + class CountSelectedBrushes : public scene::Graph::Walker { std::size_t& m_count; diff --git a/radiant/map.h b/radiant/map.h index 10f81d59..f38ee97f 100644 --- a/radiant/map.h +++ b/radiant/map.h @@ -130,6 +130,7 @@ scene::Node& Node_Clone_Selected( scene::Node& node ); void DoMapInfo(); void Scene_parentSelectedBrushesToEntity( scene::Graph& graph, scene::Node& parent ); +void Scene_parentSubgraphSelectedBrushesToEntity( scene::Graph& graph, scene::Node& parent, const scene::Path& start ); std::size_t Scene_countSelectedBrushes( scene::Graph& graph ); void Scene_parentSelected(); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 5902d806..2df0c50f 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -2441,6 +2441,9 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){ // TODO do we need this? //gtk_container_set_focus_chain(GTK_CONTAINER(hbox_table), NULL); + //prevent focusing on filter entry or tex dirs treeview after click on tab of floating group dialog (np, if called via hotkey) + gtk_container_set_focus_chain( GTK_CONTAINER( table ), NULL ); + return table; }