misc...
	* entities converting: also create group entities from world primitives instead of "do not want to convert worldspawn entity" error
	* fix: group dialog: prevent focusing on texbro->filter entry and console, if switching to ones by click on tabs (was blocking hotkeys)
This commit is contained in:
Garux 2017-08-02 09:51:08 +03:00
parent c3d11bca70
commit 6a85a08c18
5 changed files with 48 additions and 6 deletions

View File

@ -106,6 +106,8 @@ gboolean destroy_set_null( GtkWindow* widget, GtkWidget** p ){
WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" );
#include <gtk/gtkvbox.h>
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

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;
}