From 26d33ce5c892ef586f3199cf314836602976ccbe Mon Sep 17 00:00:00 2001 From: Garux Date: Fri, 20 Dec 2019 17:37:10 +0300 Subject: [PATCH] brushexport plugin: make t_limitmatnames, t_objects options available with t_exportmaterials off --- contrib/brushexport/callbacks.cpp | 36 ++++++------------------------- contrib/brushexport/callbacks.h | 1 - contrib/brushexport/interface.cpp | 1 - 3 files changed, 7 insertions(+), 31 deletions(-) diff --git a/contrib/brushexport/callbacks.cpp b/contrib/brushexport/callbacks.cpp index daa020cf..379a21a8 100644 --- a/contrib/brushexport/callbacks.cpp +++ b/contrib/brushexport/callbacks.cpp @@ -11,7 +11,6 @@ void DestroyWindow(); //! TODO add tooltip for ignore: shader name after last slash, case sensitive // or make insensitive -//! TODO make togglebuttons inactive on !exportmat //! TODO add ignore mat on ENTER, del on del //! TODO add entry with path to save to (to resave faster) //! TODO ignore case in mat name comparison materials_comparator @@ -79,27 +78,20 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){ } } + GtkWidget* toggle; // export materials? - GtkWidget* toggle = lookup_widget( GTK_WIDGET( button ), "t_exportmaterials" ); - ASSERT_NOTNULL( toggle ); - + ASSERT_NOTNULL( ( toggle = lookup_widget( GTK_WIDGET( button ), "t_exportmaterials" ) ) ); const bool exportmat = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ); // limit material names? - toggle = lookup_widget( GTK_WIDGET( button ), "t_limitmatnames" ); - ASSERT_NOTNULL( toggle ); - - const bool limitMatNames = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ) && exportmat; + ASSERT_NOTNULL( ( toggle = lookup_widget( GTK_WIDGET( button ), "t_limitmatnames" ) ) ); + const bool limitMatNames = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ); // create objects instead of groups? - toggle = lookup_widget( GTK_WIDGET( button ), "t_objects" ); - ASSERT_NOTNULL( toggle ); - - const bool objects = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ) && exportmat; - - toggle = lookup_widget( GTK_WIDGET( button ), "t_weld" ); - ASSERT_NOTNULL( toggle ); + ASSERT_NOTNULL( ( toggle = lookup_widget( GTK_WIDGET( button ), "t_objects" ) ) ); + const bool objects = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ); + ASSERT_NOTNULL( ( toggle = lookup_widget( GTK_WIDGET( button ), "t_weld" ) ) ); const bool weld = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ); // export @@ -131,18 +123,4 @@ void OnRemoveMaterial( GtkButton* button, gpointer user_data ){ } } -void OnExportMatClicked( GtkButton* button, gpointer user_data ){ - GtkWidget* toggleLimit = lookup_widget( GTK_WIDGET( button ), "t_limitmatnames" ); - GtkWidget* toggleObject = lookup_widget( GTK_WIDGET( button ), "t_objects" ); - - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ) ) ) { - gtk_widget_set_sensitive( GTK_WIDGET( toggleLimit ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( toggleObject ), TRUE ); - } - else { - gtk_widget_set_sensitive( GTK_WIDGET( toggleLimit ), FALSE ); - gtk_widget_set_sensitive( GTK_WIDGET( toggleObject ), FALSE ); - } -} - } // callbacks diff --git a/contrib/brushexport/callbacks.h b/contrib/brushexport/callbacks.h index eea5aa8b..2aa885fc 100644 --- a/contrib/brushexport/callbacks.h +++ b/contrib/brushexport/callbacks.h @@ -7,6 +7,5 @@ void OnDestroy( GtkWidget *, gpointer ); void OnExportClicked( GtkButton *, gpointer ); void OnAddMaterial( GtkButton *, gpointer ); void OnRemoveMaterial( GtkButton *, gpointer ); -void OnExportMatClicked( GtkButton * button, gpointer ); } // callbacks diff --git a/contrib/brushexport/interface.cpp b/contrib/brushexport/interface.cpp index 3addaa10..bbdab214 100644 --- a/contrib/brushexport/interface.cpp +++ b/contrib/brushexport/interface.cpp @@ -159,7 +159,6 @@ create_w_plugplug2( void ){ g_signal_connect( ( gpointer )b_export, "clicked", G_CALLBACK( OnExportClicked ), NULL ); g_signal_connect( ( gpointer )b_addmaterial, "clicked", G_CALLBACK( OnAddMaterial ), NULL ); g_signal_connect( ( gpointer )b_removematerial, "clicked", G_CALLBACK( OnRemoveMaterial ), NULL ); - g_signal_connect( ( gpointer )t_exportmaterials, "clicked", G_CALLBACK( OnExportMatClicked ), NULL ); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF( w_plugplug2, w_plugplug2, "w_plugplug2" );