bind * shift + n: brush texture reset + patch texture cap

This commit is contained in:
Garux 2018-03-04 17:37:28 +03:00
parent 2859ea7e9c
commit 552d0ac083
5 changed files with 50 additions and 44 deletions

View File

@ -1593,9 +1593,10 @@ void Brush_constructMenu( GtkMenu* menu ){
create_menu_item_with_mnemonic( menu, "Make structural", "MakeStructural" ); create_menu_item_with_mnemonic( menu, "Make structural", "MakeStructural" );
// create_menu_item_with_mnemonic( menu, "Snap selection to _grid", "SnapToGrid" ); // 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 Lock", "TogTexLock" );
create_check_menu_item_with_mnemonic( menu, "Texture Vertex Lock", "TogTexVertexLock" ); 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, "Copy Face Texture", "Copy" );
create_menu_item_with_mnemonic( menu, "Paste Face Texture", "Paste" ); create_menu_item_with_mnemonic( menu, "Paste Face Texture", "Paste" );

View File

@ -375,20 +375,20 @@ void Scene_PatchTileTexture_Selected( scene::Graph& graph, float s, float t ){
SceneChangeNotify(); SceneChangeNotify();
} }
static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){ static void OnBtnPatchCap( GtkWidget *widget, gpointer data ){
Patch_CapTexture(); Patch_CapTexture();
} }
static void OnBtnPatchfit( GtkWidget *widget, gpointer data ){ static void OnBtnPatchFit11( GtkWidget *widget, gpointer data ){
Patch_FitTexture(); Patch_FitTexture11();
} }
static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){ static void OnBtnPatchNatural( GtkWidget *widget, gpointer data ){
Patch_NaturalTexture(); Patch_NaturalTexture();
} }
static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){ static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){
Patch_ResetTexture(); Patch_FitTexture();
} }
static void OnBtnPatchFlipX( GtkWidget *widget, gpointer data ){ static void OnBtnPatchFlipX( GtkWidget *widget, gpointer data ){
@ -1002,28 +1002,28 @@ GtkWindow* PatchInspector::BuildDialog(){
GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "CAP" ) ); GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "CAP" ) );
gtk_widget_show( GTK_WIDGET( button ) ); gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); 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 ); gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
} }
{ {
GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Set..." ) ); GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Set..." ) );
gtk_widget_show( GTK_WIDGET( button ) ); gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); 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 ); gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
} }
{ {
GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Natural" ) ); GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Natural" ) );
gtk_widget_show( GTK_WIDGET( button ) ); gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); 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 ); gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
} }
{ {
GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Fit" ) ); GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Fit" ) );
gtk_widget_show( GTK_WIDGET( button ) ); gtk_widget_show( GTK_WIDGET( button ) );
gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 ); 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 ); gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
} }
} }

View File

@ -740,7 +740,7 @@ void Patch_CapTexture(){
Scene_PatchCapTexture_Selected( GlobalSceneGraph() ); Scene_PatchCapTexture_Selected( GlobalSceneGraph() );
} }
void Patch_ResetTexture(){ void Patch_FitTexture(){
float fx, fy; float fx, fy;
if ( DoTextureLayout( &fx, &fy ) == eIDOK ) { if ( DoTextureLayout( &fx, &fy ) == eIDOK ) {
UndoableCommand command( "patchTileTexture" ); UndoableCommand command( "patchTileTexture" );
@ -748,7 +748,7 @@ void Patch_ResetTexture(){
} }
} }
void Patch_FitTexture(){ void Patch_FitTexture11(){
UndoableCommand command( "patchFitTexture" ); UndoableCommand command( "patchFitTexture" );
Scene_PatchTileTexture_Selected( GlobalSceneGraph(), 1, 1 ); Scene_PatchTileTexture_Selected( GlobalSceneGraph(), 1, 1 );
} }
@ -878,7 +878,6 @@ void Patch_registerCommands(){
GlobalCommands_insert( "SmoothCols", FreeCaller<Patch_SmoothCols>(), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalCommands_insert( "SmoothCols", FreeCaller<Patch_SmoothCols>(), Accelerator( 'W', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalCommands_insert( "MatrixTranspose", FreeCaller<Patch_Transpose>(), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalCommands_insert( "MatrixTranspose", FreeCaller<Patch_Transpose>(), Accelerator( 'M', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalCommands_insert( "CapCurrentCurve", FreeCaller<Patch_Cap>(), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) ); GlobalCommands_insert( "CapCurrentCurve", FreeCaller<Patch_Cap>(), Accelerator( 'C', (GdkModifierType)GDK_SHIFT_MASK ) );
GlobalCommands_insert( "PatchCapTexture", FreeCaller<Patch_CapTexture>(), Accelerator( 'N', (GdkModifierType)GDK_SHIFT_MASK ) );
// GlobalCommands_insert( "MakeOverlayPatch", FreeCaller<Patch_OverlayOn>(), Accelerator( 'Y' ) ); // GlobalCommands_insert( "MakeOverlayPatch", FreeCaller<Patch_OverlayOn>(), Accelerator( 'Y' ) );
// GlobalCommands_insert( "ClearPatchOverlays", FreeCaller<Patch_OverlayOff>(), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) ); // GlobalCommands_insert( "ClearPatchOverlays", FreeCaller<Patch_OverlayOff>(), Accelerator( 'L', (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "PatchDeform", FreeCaller<Patch_Deform>() ); GlobalCommands_insert( "PatchDeform", FreeCaller<Patch_Deform>() );
@ -957,7 +956,7 @@ void Patch_constructMenu( GtkMenu* menu ){
if ( g_Layout_enableDetachableMenus.m_value ) { if ( g_Layout_enableDetachableMenus.m_value ) {
menu_tearoff( menu_in_menu ); 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, "Naturalize", "NaturalizePatch" );
create_menu_item_with_mnemonic( menu_in_menu, "Invert X", "InvertCurveTextureX" ); create_menu_item_with_mnemonic( menu_in_menu, "Invert X", "InvertCurveTextureX" );
create_menu_item_with_mnemonic( menu_in_menu, "Invert Y", "InvertCurveTextureY" ); create_menu_item_with_mnemonic( menu_in_menu, "Invert Y", "InvertCurveTextureY" );

View File

@ -59,8 +59,8 @@ void Patch_registerPreferencesPage();
void Patch_NaturalTexture(); void Patch_NaturalTexture();
void Patch_CapTexture(); void Patch_CapTexture();
void Patch_ResetTexture();
void Patch_FitTexture(); void Patch_FitTexture();
void Patch_FitTexture11();
void Patch_FlipTextureX(); void Patch_FlipTextureX();
void Patch_FlipTextureY(); void Patch_FlipTextureY();

View File

@ -485,30 +485,8 @@ void SurfaceInspector_ProjectTexture( EProjectTexture type ){
Select_ProjectTexture( texdef, &direction ); Select_ProjectTexture( texdef, &direction );
} }
void SurfaceInspector_FitTexture(){ void SurfaceInspector_ResetTexture(){
UndoableCommand undo( "textureAutoFit" ); UndoableCommand undo( "textureReset/Cap" );
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" );
TextureProjection projection; TextureProjection projection;
TexDef_Construct_Default( projection ); TexDef_Construct_Default( projection );
@ -531,6 +509,33 @@ static void OnBtnReset( GtkWidget *widget, gpointer data ){
#endif #endif
Select_SetTexdef( projection, false, true ); 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 ){ static void OnBtnProject( GtkWidget *widget, EProjectTexture type ){
@ -1032,7 +1037,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchdetails ), 0 ); G_CALLBACK( OnBtnPatchCap ), 0 );
gtk_widget_set_usize( button, 60, -2 ); gtk_widget_set_usize( button, 60, -2 );
} }
{ {
@ -1042,7 +1047,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchreset ), 0 ); G_CALLBACK( OnBtnPatchFit ), 0 );
gtk_widget_set_usize( button, 60, -2 ); gtk_widget_set_usize( button, 60, -2 );
} }
{ {
@ -1052,7 +1057,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchnatural ), 0 ); G_CALLBACK( OnBtnPatchNatural ), 0 );
gtk_widget_set_usize( button, 60, -2 ); gtk_widget_set_usize( button, 60, -2 );
} }
{ {
@ -1062,7 +1067,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchFit ), 0 ); G_CALLBACK( OnBtnPatchFit11 ), 0 );
gtk_widget_set_usize( button, 60, -2 ); gtk_widget_set_usize( button, 60, -2 );
} }
{ {
@ -1767,6 +1772,7 @@ void SurfaceInspector_registerPreferencesPage(){
} }
void SurfaceInspector_registerCommands(){ void SurfaceInspector_registerCommands(){
GlobalCommands_insert( "TextureReset/Cap", FreeCaller<SurfaceInspector_ResetTexture>(), Accelerator( 'N', (GdkModifierType)GDK_SHIFT_MASK ) );
GlobalCommands_insert( "FitTexture", FreeCaller<SurfaceInspector_FitTexture>(), Accelerator( 'F', (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "FitTexture", FreeCaller<SurfaceInspector_FitTexture>(), Accelerator( 'F', (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "SurfaceInspector", FreeCaller<SurfaceInspector_toggleShown>(), Accelerator( 'S' ) ); GlobalCommands_insert( "SurfaceInspector", FreeCaller<SurfaceInspector_toggleShown>(), Accelerator( 'S' ) );