diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index 96210799..53184c1b 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -1593,9 +1593,10 @@ void Brush_constructMenu( GtkMenu* menu ){ create_menu_item_with_mnemonic( menu, "Make structural", "MakeStructural" ); // create_menu_item_with_mnemonic( menu, "Snap selection to _grid", "SnapToGrid" ); + menu_separator( menu ); create_check_menu_item_with_mnemonic( menu, "Texture Lock", "TogTexLock" ); create_check_menu_item_with_mnemonic( menu, "Texture Vertex Lock", "TogTexVertexLock" ); - menu_separator( menu ); + create_menu_item_with_mnemonic( menu, "Reset Texture", "TextureReset/Cap" ); create_menu_item_with_mnemonic( menu, "Copy Face Texture", "Copy" ); create_menu_item_with_mnemonic( menu, "Paste Face Texture", "Paste" ); diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index ef6728a3..bbfaec7e 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -375,20 +375,20 @@ void Scene_PatchTileTexture_Selected( scene::Graph& graph, float s, float t ){ SceneChangeNotify(); } -static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){ +static void OnBtnPatchCap( GtkWidget *widget, gpointer data ){ Patch_CapTexture(); } -static void OnBtnPatchfit( GtkWidget *widget, gpointer data ){ - Patch_FitTexture(); +static void OnBtnPatchFit11( GtkWidget *widget, gpointer data ){ + Patch_FitTexture11(); } -static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){ +static void OnBtnPatchNatural( GtkWidget *widget, gpointer data ){ Patch_NaturalTexture(); } -static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){ - Patch_ResetTexture(); +static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){ + Patch_FitTexture(); } static void OnBtnPatchFlipX( GtkWidget *widget, gpointer data ){ @@ -1002,28 +1002,28 @@ GtkWindow* PatchInspector::BuildDialog(){ GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "CAP" ) ); gtk_widget_show( GTK_WIDGET( button ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), 0 ); + g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchCap ), 0 ); gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 ); } { GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Set..." ) ); gtk_widget_show( GTK_WIDGET( button ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), 0 ); + g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFit ), 0 ); gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 ); } { GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Natural" ) ); gtk_widget_show( GTK_WIDGET( button ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), 0 ); + g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchNatural ), 0 ); gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 ); } { GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Fit" ) ); gtk_widget_show( GTK_WIDGET( button ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchfit ), 0 ); + g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFit11 ), 0 ); gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 ); } } diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index 099541b1..d6e5fe94 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -740,7 +740,7 @@ void Patch_CapTexture(){ Scene_PatchCapTexture_Selected( GlobalSceneGraph() ); } -void Patch_ResetTexture(){ +void Patch_FitTexture(){ float fx, fy; if ( DoTextureLayout( &fx, &fy ) == eIDOK ) { UndoableCommand command( "patchTileTexture" ); @@ -748,7 +748,7 @@ void Patch_ResetTexture(){ } } -void Patch_FitTexture(){ +void Patch_FitTexture11(){ UndoableCommand command( "patchFitTexture" ); Scene_PatchTileTexture_Selected( GlobalSceneGraph(), 1, 1 ); } @@ -878,7 +878,6 @@ void Patch_registerCommands(){ GlobalCommands_insert( "SmoothCols", FreeCaller(), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalCommands_insert( "MatrixTranspose", FreeCaller(), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalCommands_insert( "CapCurrentCurve", FreeCaller(), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) ); - GlobalCommands_insert( "PatchCapTexture", FreeCaller(), Accelerator( 'N', (GdkModifierType)GDK_SHIFT_MASK ) ); // GlobalCommands_insert( "MakeOverlayPatch", FreeCaller(), Accelerator( 'Y' ) ); // GlobalCommands_insert( "ClearPatchOverlays", FreeCaller(), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "PatchDeform", FreeCaller() ); @@ -957,7 +956,7 @@ void Patch_constructMenu( GtkMenu* menu ){ if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu_in_menu ); } - create_menu_item_with_mnemonic( menu_in_menu, "Project", "PatchCapTexture" ); + create_menu_item_with_mnemonic( menu_in_menu, "Project", "TextureReset/Cap" ); create_menu_item_with_mnemonic( menu_in_menu, "Naturalize", "NaturalizePatch" ); create_menu_item_with_mnemonic( menu_in_menu, "Invert X", "InvertCurveTextureX" ); create_menu_item_with_mnemonic( menu_in_menu, "Invert Y", "InvertCurveTextureY" ); diff --git a/radiant/patchmanip.h b/radiant/patchmanip.h index 7493fc7d..1e3a998e 100644 --- a/radiant/patchmanip.h +++ b/radiant/patchmanip.h @@ -59,8 +59,8 @@ void Patch_registerPreferencesPage(); void Patch_NaturalTexture(); void Patch_CapTexture(); -void Patch_ResetTexture(); void Patch_FitTexture(); +void Patch_FitTexture11(); void Patch_FlipTextureX(); void Patch_FlipTextureY(); diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 86a3e39d..b41ef088 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -485,30 +485,8 @@ void SurfaceInspector_ProjectTexture( EProjectTexture type ){ Select_ProjectTexture( texdef, &direction ); } -void SurfaceInspector_FitTexture(){ - UndoableCommand undo( "textureAutoFit" ); - getSurfaceInspector().exportData(); - Select_FitTexture( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical ); -} - -static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){ - Patch_CapTexture(); -} - -static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){ - Patch_NaturalTexture(); -} - -static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){ - Patch_ResetTexture(); -} - -static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){ - Patch_FitTexture(); -} - -static void OnBtnReset( GtkWidget *widget, gpointer data ){ - UndoableCommand undo( "textureDefault" ); +void SurfaceInspector_ResetTexture(){ + UndoableCommand undo( "textureReset/Cap" ); TextureProjection projection; TexDef_Construct_Default( projection ); @@ -531,6 +509,33 @@ static void OnBtnReset( GtkWidget *widget, gpointer data ){ #endif Select_SetTexdef( projection, false, true ); + Scene_PatchCapTexture_Selected( GlobalSceneGraph() ); +} + +void SurfaceInspector_FitTexture(){ + UndoableCommand undo( "textureAutoFit" ); + getSurfaceInspector().exportData(); + Select_FitTexture( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical ); +} + +static void OnBtnPatchCap( GtkWidget *widget, gpointer data ){ + Patch_CapTexture(); +} + +static void OnBtnPatchNatural( GtkWidget *widget, gpointer data ){ + Patch_NaturalTexture(); +} + +static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){ + Patch_FitTexture(); +} + +static void OnBtnPatchFit11( GtkWidget *widget, gpointer data ){ + Patch_FitTexture11(); +} + +static void OnBtnReset( GtkWidget *widget, gpointer data ){ + SurfaceInspector_ResetTexture(); } static void OnBtnProject( GtkWidget *widget, EProjectTexture type ){ @@ -1032,7 +1037,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( OnBtnPatchdetails ), 0 ); + G_CALLBACK( OnBtnPatchCap ), 0 ); gtk_widget_set_usize( button, 60, -2 ); } { @@ -1042,7 +1047,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( OnBtnPatchreset ), 0 ); + G_CALLBACK( OnBtnPatchFit ), 0 ); gtk_widget_set_usize( button, 60, -2 ); } { @@ -1052,7 +1057,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( OnBtnPatchnatural ), 0 ); + G_CALLBACK( OnBtnPatchNatural ), 0 ); gtk_widget_set_usize( button, 60, -2 ); } { @@ -1062,7 +1067,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( OnBtnPatchFit ), 0 ); + G_CALLBACK( OnBtnPatchFit11 ), 0 ); gtk_widget_set_usize( button, 60, -2 ); } { @@ -1767,6 +1772,7 @@ void SurfaceInspector_registerPreferencesPage(){ } void SurfaceInspector_registerCommands(){ + GlobalCommands_insert( "TextureReset/Cap", FreeCaller(), Accelerator( 'N', (GdkModifierType)GDK_SHIFT_MASK ) ); GlobalCommands_insert( "FitTexture", FreeCaller(), Accelerator( 'F', (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "SurfaceInspector", FreeCaller(), Accelerator( 'S' ) );