* brushexport plugin: add Save button to reexport to recently specified file directly
This commit is contained in:
parent
26d33ce5c8
commit
f893b9a789
|
|
@ -12,7 +12,6 @@ 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 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 ignore case in mat name comparison materials_comparator
|
//! TODO ignore case in mat name comparison materials_comparator
|
||||||
namespace callbacks {
|
namespace callbacks {
|
||||||
|
|
||||||
|
|
@ -20,15 +19,29 @@ void OnDestroy( GtkWidget* w, gpointer data ){
|
||||||
DestroyWindow();
|
DestroyWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnExportClicked( GtkButton* button, gpointer user_data ){
|
static std::string s_export_path;
|
||||||
|
|
||||||
|
void OnExportClicked( GtkButton* button, gpointer choose_path ){
|
||||||
GtkWidget* window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" );
|
GtkWidget* window = lookup_widget( GTK_WIDGET( button ), "w_plugplug2" );
|
||||||
ASSERT_NOTNULL( window );
|
ASSERT_NOTNULL( window );
|
||||||
|
if( choose_path ){
|
||||||
const char* cpath = GlobalRadiant().m_pfnFileDialog( window, false, "Save as Obj", 0, 0, false, false, true );
|
const char* cpath = GlobalRadiant().m_pfnFileDialog( window, false, "Save as Obj", 0, 0, false, false, true );
|
||||||
if ( !cpath ) {
|
if ( !cpath ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
s_export_path = cpath;
|
||||||
std::string path( cpath );
|
// enable button to reexport with the selected name
|
||||||
|
GtkWidget* b_export = lookup_widget( GTK_WIDGET( button ), "b_export" );
|
||||||
|
ASSERT_NOTNULL( b_export );
|
||||||
|
gtk_widget_set_sensitive( b_export, TRUE );
|
||||||
|
// add tooltip
|
||||||
|
std::string tip( "ReExport to " );
|
||||||
|
tip.append( s_export_path );
|
||||||
|
gtk_widget_set_tooltip_text( b_export, tip.c_str() );
|
||||||
|
}
|
||||||
|
else if( s_export_path.empty() ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// get ignore list from ui
|
// get ignore list from ui
|
||||||
std::set<std::string> ignore;
|
std::set<std::string> ignore;
|
||||||
|
|
@ -95,7 +108,7 @@ void OnExportClicked( GtkButton* button, gpointer user_data ){
|
||||||
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
|
||||||
ExportSelection( ignore, mode, exportmat, path, limitMatNames, objects, weld );
|
ExportSelection( ignore, mode, exportmat, s_export_path, limitMatNames, objects, weld );
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnAddMaterial( GtkButton* button, gpointer user_data ){
|
void OnAddMaterial( GtkButton* button, gpointer user_data ){
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ create_w_plugplug2( void ){
|
||||||
GtkWidget *r_nocollapse;
|
GtkWidget *r_nocollapse;
|
||||||
GtkWidget *vbox3;
|
GtkWidget *vbox3;
|
||||||
GtkWidget *b_export;
|
GtkWidget *b_export;
|
||||||
|
GtkWidget *b_exportAs;
|
||||||
GtkWidget *b_close;
|
GtkWidget *b_close;
|
||||||
GtkWidget *vbox2;
|
GtkWidget *vbox2;
|
||||||
GtkWidget *label1;
|
GtkWidget *label1;
|
||||||
|
|
@ -90,6 +91,12 @@ create_w_plugplug2( void ){
|
||||||
gtk_widget_show( b_export );
|
gtk_widget_show( b_export );
|
||||||
gtk_box_pack_start( GTK_BOX( vbox3 ), b_export, TRUE, FALSE, 0 );
|
gtk_box_pack_start( GTK_BOX( vbox3 ), b_export, TRUE, FALSE, 0 );
|
||||||
gtk_container_set_border_width( GTK_CONTAINER( b_export ), 5 );
|
gtk_container_set_border_width( GTK_CONTAINER( b_export ), 5 );
|
||||||
|
gtk_widget_set_sensitive( b_export, FALSE );
|
||||||
|
|
||||||
|
b_exportAs = gtk_button_new_from_stock( "gtk-save-as" );
|
||||||
|
gtk_widget_show( b_exportAs );
|
||||||
|
gtk_box_pack_start( GTK_BOX( vbox3 ), b_exportAs, TRUE, FALSE, 0 );
|
||||||
|
gtk_container_set_border_width( GTK_CONTAINER( b_exportAs ), 5 );
|
||||||
|
|
||||||
b_close = gtk_button_new_from_stock( "gtk-cancel" );
|
b_close = gtk_button_new_from_stock( "gtk-cancel" );
|
||||||
gtk_widget_show( b_close );
|
gtk_widget_show( b_close );
|
||||||
|
|
@ -150,13 +157,14 @@ create_w_plugplug2( void ){
|
||||||
t_exportmaterials = gtk_check_button_new_with_mnemonic( "Create material information (.mtl file)" );
|
t_exportmaterials = gtk_check_button_new_with_mnemonic( "Create material information (.mtl file)" );
|
||||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( t_exportmaterials ), TRUE );
|
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( t_exportmaterials ), TRUE );
|
||||||
gtk_widget_show( t_exportmaterials );
|
gtk_widget_show( t_exportmaterials );
|
||||||
gtk_box_pack_end( GTK_BOX( vbox2 ), t_exportmaterials, FALSE, FALSE, 10 );
|
gtk_box_pack_end( GTK_BOX( vbox2 ), t_exportmaterials, FALSE, FALSE, 0 );
|
||||||
|
|
||||||
using namespace callbacks;
|
using namespace callbacks;
|
||||||
g_signal_connect( G_OBJECT( w_plugplug2 ), "destroy", G_CALLBACK( OnDestroy ), NULL );
|
g_signal_connect( G_OBJECT( w_plugplug2 ), "destroy", G_CALLBACK( OnDestroy ), NULL );
|
||||||
g_signal_connect_swapped( G_OBJECT( b_close ), "clicked", G_CALLBACK( OnDestroy ), NULL );
|
g_signal_connect_swapped( G_OBJECT( b_close ), "clicked", G_CALLBACK( OnDestroy ), NULL );
|
||||||
|
|
||||||
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_exportAs, "clicked", G_CALLBACK( OnExportClicked ), gpointer( 1 ) );
|
||||||
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 );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user