* bindable commands FitTextureWidth, FitTextureHeight, FitTextureWidthOnly, FitTextureHeightOnly

This commit is contained in:
Garux 2018-06-10 01:27:49 +03:00
parent 59c05fa390
commit f0057a86f4
4 changed files with 43 additions and 25 deletions

View File

@ -1583,7 +1583,6 @@ void Brush_constructMenu( GtkMenu* menu ){
menu_separator( menu ); menu_separator( menu );
create_menu_item_with_mnemonic( menu, "Make detail", "MakeDetail" ); create_menu_item_with_mnemonic( menu, "Make detail", "MakeDetail" );
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" );
menu_separator( menu ); menu_separator( menu );
create_check_menu_item_with_mnemonic( menu, "Texture Lock", "TogTexLock" ); create_check_menu_item_with_mnemonic( menu, "Texture Lock", "TogTexLock" );

View File

@ -2400,6 +2400,10 @@ void SelectByType_registerShortcuts(){
void SurfaceInspector_registerShortcuts(){ void SurfaceInspector_registerShortcuts(){
command_connect_accelerator( "FitTexture" ); command_connect_accelerator( "FitTexture" );
command_connect_accelerator( "FitTextureWidth" );
command_connect_accelerator( "FitTextureHeight" );
command_connect_accelerator( "FitTextureWidthOnly" );
command_connect_accelerator( "FitTextureHeightOnly" );
} }
void TexBro_registerShortcuts(){ void TexBro_registerShortcuts(){
@ -2409,8 +2413,7 @@ void TexBro_registerShortcuts(){
} }
void Misc_registerShortcuts(){ void Misc_registerShortcuts(){
//refresh models command_connect_accelerator( "RefreshReferences" ); //refresh models
command_connect_accelerator( "RefreshReferences" );
command_connect_accelerator( "MouseRotateOrScale" ); command_connect_accelerator( "MouseRotateOrScale" );
command_connect_accelerator( "MouseDragOrTransform" ); command_connect_accelerator( "MouseDragOrTransform" );
} }
@ -3497,11 +3500,9 @@ void MainFrame_Construct(){
GlobalCommands_insert( "MoveToCamera", FreeCaller<MoveToCamera>(), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) ); GlobalCommands_insert( "MoveToCamera", FreeCaller<MoveToCamera>(), Accelerator( 'V', (GdkModifierType)( GDK_SHIFT_MASK | GDK_CONTROL_MASK ) ) );
GlobalCommands_insert( "CloneSelection", FreeCaller<Selection_Clone>(), Accelerator( GDK_space ) ); GlobalCommands_insert( "CloneSelection", FreeCaller<Selection_Clone>(), Accelerator( GDK_space ) );
GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller<Selection_Clone_MakeUnique>(), Accelerator( GDK_space, (GdkModifierType)GDK_SHIFT_MASK ) ); GlobalCommands_insert( "CloneSelectionAndMakeUnique", FreeCaller<Selection_Clone_MakeUnique>(), Accelerator( GDK_space, (GdkModifierType)GDK_SHIFT_MASK ) );
// GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
GlobalCommands_insert( "DeleteSelection2", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) ); GlobalCommands_insert( "DeleteSelection2", FreeCaller<deleteSelection>(), Accelerator( GDK_BackSpace ) );
GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( 'Z' ) ); GlobalCommands_insert( "DeleteSelection", FreeCaller<deleteSelection>(), Accelerator( 'Z' ) );
GlobalCommands_insert( "ParentSelection", FreeCaller<Scene_parentSelected>() ); GlobalCommands_insert( "ParentSelection", FreeCaller<Scene_parentSelected>() );
// GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) );
GlobalCommands_insert( "UnSelectSelection2", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) ); GlobalCommands_insert( "UnSelectSelection2", FreeCaller<Selection_Deselect>(), Accelerator( GDK_Escape ) );
GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( 'C' ) ); GlobalCommands_insert( "UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator( 'C' ) );
GlobalCommands_insert( "InvertSelection", FreeCaller<Select_Invert>(), Accelerator( 'I' ) ); GlobalCommands_insert( "InvertSelection", FreeCaller<Select_Invert>(), Accelerator( 'I' ) );

View File

@ -512,12 +512,6 @@ void SurfaceInspector_ResetTexture(){
Scene_PatchCapTexture_Selected( GlobalSceneGraph() ); 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 ){ static void OnBtnPatchCap( GtkWidget *widget, gpointer data ){
Patch_CapTexture(); Patch_CapTexture();
} }
@ -546,27 +540,53 @@ static void OnBtnProject( GtkWidget *widget, EProjectTexture type ){
SurfaceInspector_ProjectTexture( type ); SurfaceInspector_ProjectTexture( type );
} }
static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){
SurfaceInspector_FitTexture(); void SurfaceInspector_FitTexture(){
UndoableCommand undo( "textureAutoFit" );
getSurfaceInspector().exportData();
Select_FitTexture( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
} }
static void OnBtnFaceFitWidth( GtkWidget *widget, gpointer data ){ void SurfaceInspector_FaceFitWidth(){
UndoableCommand undo( "textureAutoFitWidth" ); UndoableCommand undo( "textureAutoFitWidth" );
getSurfaceInspector().exportData(); getSurfaceInspector().exportData();
Select_FitTexture( getSurfaceInspector().m_fitHorizontal, 0 ); Select_FitTexture( getSurfaceInspector().m_fitHorizontal, 0 );
} }
static void OnBtnFaceFitHeight( GtkWidget *widget, gpointer data ){ void SurfaceInspector_FaceFitHeight(){
UndoableCommand undo( "textureAutoFitHeight" ); UndoableCommand undo( "textureAutoFitHeight" );
getSurfaceInspector().exportData(); getSurfaceInspector().exportData();
Select_FitTexture( 0, getSurfaceInspector().m_fitVertical ); Select_FitTexture( 0, getSurfaceInspector().m_fitVertical );
} }
void SurfaceInspector_FaceFitWidthOnly(){
UndoableCommand undo( "textureAutoFitWidthOnly" );
getSurfaceInspector().exportData();
Select_FitTexture( getSurfaceInspector().m_fitHorizontal, 0, true );
}
void SurfaceInspector_FaceFitHeightOnly(){
UndoableCommand undo( "textureAutoFitHeightOnly" );
getSurfaceInspector().exportData();
Select_FitTexture( 0, getSurfaceInspector().m_fitVertical, true );
}
static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){
SurfaceInspector_FitTexture();
}
static void OnBtnFaceFitWidth( GtkWidget *widget, gpointer data ){
SurfaceInspector_FaceFitWidth();
}
static void OnBtnFaceFitHeight( GtkWidget *widget, gpointer data ){
SurfaceInspector_FaceFitHeight();
}
static gboolean OnBtnFaceFitWidthOnly( GtkWidget *widget, GdkEventButton *event, gpointer data ){ static gboolean OnBtnFaceFitWidthOnly( GtkWidget *widget, GdkEventButton *event, gpointer data ){
if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) { if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
UndoableCommand undo( "textureAutoFitWidthOnly" ); SurfaceInspector_FaceFitWidthOnly();
getSurfaceInspector().exportData();
Select_FitTexture( getSurfaceInspector().m_fitHorizontal, 0, true );
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -574,9 +594,7 @@ static gboolean OnBtnFaceFitWidthOnly( GtkWidget *widget, GdkEventButton *event,
static gboolean OnBtnFaceFitHeightOnly( GtkWidget *widget, GdkEventButton *event, gpointer data ){ static gboolean OnBtnFaceFitHeightOnly( GtkWidget *widget, GdkEventButton *event, gpointer data ){
if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) { if ( event->button == 3 && event->type == GDK_BUTTON_PRESS ) {
UndoableCommand undo( "textureAutoFitHeightOnly" ); SurfaceInspector_FaceFitHeightOnly();
getSurfaceInspector().exportData();
Select_FitTexture( 0, getSurfaceInspector().m_fitVertical, true );
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -1752,6 +1770,10 @@ void SurfaceInspector_registerPreferencesPage(){
void SurfaceInspector_registerCommands(){ void SurfaceInspector_registerCommands(){
GlobalCommands_insert( "TextureReset/Cap", FreeCaller<SurfaceInspector_ResetTexture>(), Accelerator( 'N', (GdkModifierType)GDK_SHIFT_MASK ) ); 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( "FitTextureWidth", FreeCaller<SurfaceInspector_FaceFitWidth>() );
GlobalCommands_insert( "FitTextureHeight", FreeCaller<SurfaceInspector_FaceFitHeight>() );
GlobalCommands_insert( "FitTextureWidthOnly", FreeCaller<SurfaceInspector_FaceFitWidthOnly>() );
GlobalCommands_insert( "FitTextureHeightOnly", FreeCaller<SurfaceInspector_FaceFitHeightOnly>() );
GlobalCommands_insert( "SurfaceInspector", FreeCaller<SurfaceInspector_toggleShown>(), Accelerator( 'S' ) ); GlobalCommands_insert( "SurfaceInspector", FreeCaller<SurfaceInspector_toggleShown>(), Accelerator( 'S' ) );
// GlobalCommands_insert( "FaceCopyTexture", FreeCaller<SelectedFaces_copyTexture>() ); // GlobalCommands_insert( "FaceCopyTexture", FreeCaller<SelectedFaces_copyTexture>() );

View File

@ -2929,10 +2929,6 @@ void Orthographic_registerPreferencesPage(){
void XYWindow_Construct(){ void XYWindow_Construct(){
// GlobalCommands_insert( "ToggleCrosshairs", FreeCaller<ToggleShowCrosshair>(), Accelerator( 'X', (GdkModifierType)GDK_SHIFT_MASK ) );
// GlobalCommands_insert( "ToggleSizePaint", FreeCaller<ToggleShowSizeInfo>(), Accelerator( 'J' ) );
// GlobalCommands_insert( "ToggleGrid", FreeCaller<ToggleShowGrid>(), Accelerator( '0' ) );
GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ) ); GlobalToggles_insert( "ToggleView", ToggleShown::ToggleCaller( g_xy_top_shown ), ToggleItem::AddCallbackCaller( g_xy_top_shown.m_item ) );
GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) ); GlobalToggles_insert( "ToggleSideView", ToggleShown::ToggleCaller( g_yz_side_shown ), ToggleItem::AddCallbackCaller( g_yz_side_shown.m_item ) );
GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) ); GlobalToggles_insert( "ToggleFrontView", ToggleShown::ToggleCaller( g_xz_front_shown ), ToggleItem::AddCallbackCaller( g_xz_front_shown.m_item ) );