]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Radiant:
authorGarux <garux@mail.ru>
Wed, 2 Aug 2017 06:19:53 +0000 (09:19 +0300)
committerGarux <garux@mail.ru>
Wed, 2 Aug 2017 06:19:53 +0000 (09:19 +0300)
misc...
* regular gtk search in entity inspector -> entity class list
* fix: entities, converted to ( targeted + having model + not loaded b4 ) ones weren't selectable normally + rendered only while 0 0 0 was visible
* ExpandSelectionToEntities works, if only parent node is selected, too (via entity list)
* Select & normalize color commands work for group ents, if contained primitive is selected
* remove boolean key, if set via entity inspector checkbox to 0 (ex: light - sun checkbox: was _sun 0, if off)

radiant/entity.cpp
radiant/entityinspector.cpp
radiant/select.cpp

index ff82b7ab087469b2b3a2542db14e08aa17a869a0..e1fa526039421762ea819a7326e26f0b39c8741c 100644 (file)
@@ -97,17 +97,20 @@ void post( const scene::Path& path, scene::Instance& instance ) const {
 
                EntityCopyingVisitor visitor( *Node_getEntity( node ) );
 
-               entity->forEachKeyValue( visitor );
+               //entity->forEachKeyValue( visitor );
 
                NodeSmartReference child( path.top().get() );
                NodeSmartReference parent( path.parent().get() );
-               Node_getTraversable( parent )->erase( child );
+               //Node_getTraversable( parent )->erase( child );
                if ( Node_getTraversable( child ) != 0
                         && Node_getTraversable( node ) != 0
                         && node_is_group( node ) ) {
                        parentBrushes( child, node );
                }
                Node_getTraversable( parent )->insert( node );
+               /* must do this after inserting node, otherwise problem: targeted + having model + not loaded b4 new entities aren't selectable normally + rendered only while 0 0 0 is rendered */
+               entity->forEachKeyValue( visitor );
+               Node_getTraversable( parent )->erase( child );
        }
 }
 };
@@ -477,6 +480,10 @@ void Entity_normalizeColor(){
                const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path();
                Entity* entity = Node_getEntity( path.top() );
 
+               if( entity == 0 && path.size() == 3 ){
+                       entity = Node_getEntity( path.parent() );
+               }
+
                if ( entity != 0 ) {
                        const char* strColor = entity->getKeyValue( "_color" );
                        if ( !string_empty( strColor ) ) {
@@ -504,6 +511,11 @@ void Entity_setColour(){
        if ( GlobalSelectionSystem().countSelected() != 0 ) {
                const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path();
                Entity* entity = Node_getEntity( path.top() );
+
+               if( entity == 0 && path.size() == 3 ){
+                       entity = Node_getEntity( path.parent() );
+               }
+
                if ( entity != 0 ) {
                        const char* strColor = entity->getKeyValue( "_color" );
                        if ( !string_empty( strColor ) ) {
index 45232943f18d2002bd873768e3af46394ca3947d..9ebeec4e0d8de471c7929eaa5f9ff7fb38f396f3 100644 (file)
@@ -153,7 +153,7 @@ void release(){
        delete this;
 }
 void apply(){
-       Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( m_check ) ) ? "1" : "0" );
+       Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( m_check ) ) ? "1" : "" );
 }
 typedef MemberCaller<BooleanAttribute, &BooleanAttribute::apply> ApplyCaller;
 
@@ -1174,16 +1174,7 @@ void EntityInspector_clearKeyValue(){
 
 static gint EntityInspector_clearKeyValueKB( GtkEntry* widget, GdkEventKey* event, gpointer data ){
        if ( event->keyval == GDK_Delete ) {
-               // Get current selection text
-               StringOutputStream key( 64 );
-               key << gtk_entry_get_text( g_entityKeyEntry );
-
-               if ( strcmp( key.c_str(), "classname" ) != 0 ) {
-                       StringOutputStream command;
-                       command << "entityDeleteKey -key " << key.c_str();
-                       UndoableCommand undo( command.c_str() );
-                       Scene_EntitySetKeyValue_Selected( key.c_str(), "" );
-               }
+               EntityInspector_clearKeyValue();
                return TRUE;
        }
        return FALSE;
@@ -1225,14 +1216,14 @@ static gint EntityClassList_button_press( GtkWidget *widget, GdkEventButton *eve
 }
 
 static gint EntityClassList_keypress( GtkWidget* widget, GdkEventKey* event, gpointer data ){
-       unsigned int code = gdk_keyval_to_upper( event->keyval );
-
        if ( event->keyval == GDK_Return ) {
                EntityClassList_createEntity();
                return TRUE;
        }
 
        // select the entity that starts with the key pressed
+/*
+       unsigned int code = gdk_keyval_to_upper( event->keyval );
        if ( code <= 'Z' && code >= 'A' && event->state == 0 ) {
                GtkTreeView* view = g_entityClassList;
                GtkTreeModel* model;
@@ -1266,6 +1257,7 @@ static gint EntityClassList_keypress( GtkWidget* widget, GdkEventKey* event, gpo
 
                return TRUE;
        }
+*/
        return FALSE;
 }
 
@@ -1295,7 +1287,7 @@ static void SpawnflagCheck_toggled( GtkWidget *widget, gpointer data ){
 static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer data ){
        if ( event->keyval == GDK_Return ) {
                if ( widget == g_entityKeyEntry ) {
-                       gtk_entry_set_text( g_entityValueEntry, "" );
+                       //gtk_entry_set_text( g_entityValueEntry, "" );
                        gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) );
                }
                else
@@ -1382,7 +1374,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
                                        GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
 
                                        GtkTreeView* view = GTK_TREE_VIEW( gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ) );
-                                       gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
+                                       //gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
                                        gtk_tree_view_set_headers_visible( view, FALSE );
                                        g_signal_connect( G_OBJECT( view ), "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 );
                                        g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 );
index 67986fc606cf23710db4915982c759e3750f0164..1de2c1d07d12d77031903368fa75174db1e40a0b 100644 (file)
@@ -403,7 +403,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const {
        if ( m_depth == 2 ) { // entity depth
                // traverse and select children if any one is selected
                bool beselected = false;
-               if ( instance.childSelected() ) {
+               if ( instance.childSelected() || instance.isSelected() ) {
                        beselected = true;
                        if( path.top().get() != worldspawn ){
                                Instance_setSelected( instance, true );