brushexport plugin: make t_limitmatnames, t_objects options available with t_exportmaterials off

This commit is contained in:
Garux 2019-12-20 17:37:10 +03:00
parent 234f50f58d
commit 26d33ce5c8
3 changed files with 7 additions and 31 deletions

View File

@ -11,7 +11,6 @@
void DestroyWindow(); void DestroyWindow();
//! TODO add tooltip for ignore: shader name after last slash, case sensitive // or make insensitive //! 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 ignore mat on ENTER, del on del
//! TODO add entry with path to save to (to resave faster) //! TODO add entry with path to save to (to resave faster)
//! TODO ignore case in mat name comparison materials_comparator //! TODO ignore case in mat name comparison materials_comparator
@ -79,27 +78,20 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){
} }
} }
GtkWidget* toggle;
// export materials? // export materials?
GtkWidget* toggle = lookup_widget( GTK_WIDGET( button ), "t_exportmaterials" ); ASSERT_NOTNULL( ( toggle = lookup_widget( GTK_WIDGET( button ), "t_exportmaterials" ) ) );
ASSERT_NOTNULL( toggle );
const bool exportmat = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ); const bool exportmat = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) );
// limit material names? // limit material names?
toggle = lookup_widget( GTK_WIDGET( button ), "t_limitmatnames" ); ASSERT_NOTNULL( ( toggle = lookup_widget( GTK_WIDGET( button ), "t_limitmatnames" ) ) );
ASSERT_NOTNULL( toggle ); const bool limitMatNames = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) );
const bool limitMatNames = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ) && exportmat;
// create objects instead of groups? // create objects instead of groups?
toggle = lookup_widget( GTK_WIDGET( button ), "t_objects" ); ASSERT_NOTNULL( ( toggle = lookup_widget( GTK_WIDGET( button ), "t_objects" ) ) );
ASSERT_NOTNULL( toggle ); const bool objects = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( 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_weld" ) ) );
const bool weld = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) ); const bool weld = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggle ) );
// export // 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 } // callbacks

View File

@ -7,6 +7,5 @@ void OnDestroy( GtkWidget *, gpointer );
void OnExportClicked( GtkButton *, gpointer ); void OnExportClicked( GtkButton *, gpointer );
void OnAddMaterial( GtkButton *, gpointer ); void OnAddMaterial( GtkButton *, gpointer );
void OnRemoveMaterial( GtkButton *, gpointer ); void OnRemoveMaterial( GtkButton *, gpointer );
void OnExportMatClicked( GtkButton * button, gpointer );
} // callbacks } // callbacks

View File

@ -159,7 +159,6 @@ create_w_plugplug2( void ){
g_signal_connect( ( gpointer )b_export, "clicked", G_CALLBACK( OnExportClicked ), NULL ); 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_addmaterial, "clicked", G_CALLBACK( OnAddMaterial ), NULL );
g_signal_connect( ( gpointer )b_removematerial, "clicked", G_CALLBACK( OnRemoveMaterial ), 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(). */ /* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF( w_plugplug2, w_plugplug2, "w_plugplug2" ); GLADE_HOOKUP_OBJECT_NO_REF( w_plugplug2, w_plugplug2, "w_plugplug2" );