]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '2ab47003e0b34d7ca43d4ac5b9ae18d3413a4f4c' into garux-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 22 Feb 2021 23:24:05 +0000 (00:24 +0100)
committerThomas Debesse <dev@illwieckz.net>
Mon, 22 Feb 2021 23:24:05 +0000 (00:24 +0100)
radiant/entity.cpp
radiant/entityinspector.cpp
radiant/select.cpp

index 9f36b89c0f4e2c11495c7436b00542e73518fd69..728307a66f4f3f1fdc2ab83c98e57b56fde5599f 100644 (file)
@@ -103,17 +103,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 );
        }
 }
 };
@@ -487,6 +490,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 ) ) {
@@ -514,6 +521,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 a2291f8fd59fdeb04a449887a1336a0460686dc5..349d5d09b5fd34d47f3bf14f3a807121bbd6cd24 100644 (file)
@@ -140,7 +140,7 @@ void release(){
        delete this;
 }
 void apply(){
-       Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_check.active() ? "1" : "0" );
+       Scene_EntitySetKeyValue_Selected_Undoable( m_key.c_str(), m_check.active() ? "1" : "" );
 }
 typedef MemberCaller<BooleanAttribute, void(), &BooleanAttribute::apply> ApplyCaller;
 
@@ -1157,16 +1157,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;
@@ -1208,14 +1199,14 @@ static gint EntityClassList_button_press( ui::Widget widget, GdkEventButton *eve
 }
 
 static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpointer data ){
-       unsigned int code = gdk_keyval_to_upper( event->keyval );
-
        if ( event->keyval == GDK_KEY_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 ) {
                auto view = ui::TreeView(g_entityClassList);
                GtkTreeModel* model;
@@ -1249,6 +1240,7 @@ static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpo
 
                return TRUE;
        }
+*/
        return FALSE;
 }
 
@@ -1278,7 +1270,7 @@ static void SpawnflagCheck_toggled( ui::Widget widget, gpointer data ){
 static gint EntityEntry_keypress( ui::Entry widget, GdkEventKey* event, gpointer data ){
        if ( event->keyval == GDK_KEY_Return ) {
                if ( widget._handle == g_entityKeyEntry._handle ) {
-                       g_entityValueEntry.text( "" );
+                       // g_entityValueEntry.text( "" );
                        gtk_window_set_focus( widget.window(), g_entityValueEntry  );
                }
                else
@@ -1364,7 +1356,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){
                                        ui::ListStore store = ui::ListStore::from(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER ));
 
                                        auto view = ui::TreeView( ui::TreeModel::from( store._handle ));
-                                       gtk_tree_view_set_enable_search(view, FALSE );
+                                       // gtk_tree_view_set_enable_search(view, FALSE );
                                        gtk_tree_view_set_headers_visible( view, FALSE );
                                        view.connect( "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 );
                                        view.connect( "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 );
index bca6f2ccddb7f249e7538212b8bb050f812ef99c..f6546bd8cb44fc9411a25cd54bbde9fc0e931927 100644 (file)
@@ -405,7 +405,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 );