* turn SI->project texture radiobuttons to label and 3 buttons to save clicks

This commit is contained in:
Garux 2018-02-18 18:52:44 +03:00
parent 6ac153f2f0
commit 86a8aec283

View File

@ -175,8 +175,6 @@ WindowPositionTrackerExportStringCaller m_exportPosition;
float m_fitHorizontal; float m_fitHorizontal;
float m_fitVertical; float m_fitVertical;
int m_projectRadio;
Increment m_hshiftIncrement; Increment m_hshiftIncrement;
Increment m_vshiftIncrement; Increment m_vshiftIncrement;
Increment m_hscaleIncrement; Increment m_hscaleIncrement;
@ -207,7 +205,6 @@ SurfaceInspector() :
m_rotateIncrement( g_si_globals.rotate ){ m_rotateIncrement( g_si_globals.rotate ){
m_fitVertical = 1; m_fitVertical = 1;
m_fitHorizontal = 1; m_fitHorizontal = 1;
m_projectRadio = 0;
m_positionTracker.setPosition( c_default_window_pos ); m_positionTracker.setPosition( c_default_window_pos );
} }
@ -453,7 +450,14 @@ void SurfaceInspector_toggleShown(){
#include "camwindow.h" #include "camwindow.h"
void SurfaceInspector_ProjectTexture(){ enum EProjectTexture
{
eProjectAxial = 0,
eProjectOrtho = 1,
eProjectCam = 2,
};
void SurfaceInspector_ProjectTexture( EProjectTexture type ){
UndoableCommand undo( "textureProject" ); UndoableCommand undo( "textureProject" );
texdef_t texdef; texdef_t texdef;
@ -465,23 +469,17 @@ void SurfaceInspector_ProjectTexture(){
Vector3 direction; Vector3 direction;
if( getSurfaceInspector().m_projectRadio == 0 ){ //axial switch ( type )
return Select_ProjectTexture( texdef, NULL ); {
} case eProjectAxial:
else if( getSurfaceInspector().m_projectRadio == 1 ){ //ortho return Select_ProjectTexture( texdef, 0 );
if( GlobalXYWnd_getCurrentViewType() == YZ ){ case eProjectOrtho:
direction = Vector3( 1, 0, 0 ); direction = g_vector3_axes[GlobalXYWnd_getCurrentViewType()];
} break;
else if( GlobalXYWnd_getCurrentViewType() == XZ ){ case eProjectCam:
direction = Vector3( 0, 1, 0 );
}
else if( GlobalXYWnd_getCurrentViewType() == XY ){
direction = Vector3( 0, 0, 1 );
}
}
else if( getSurfaceInspector().m_projectRadio == 2 ){ //cam
//direction = -g_pParentWnd->GetCamWnd()->getCamera().vpn ; //direction = -g_pParentWnd->GetCamWnd()->getCamera().vpn ;
direction = -Camera_getViewVector( *g_pParentWnd->GetCamWnd() ); direction = -Camera_getViewVector( *g_pParentWnd->GetCamWnd() );
break;
} }
Select_ProjectTexture( texdef, &direction ); Select_ProjectTexture( texdef, &direction );
@ -535,13 +533,12 @@ static void OnBtnReset( GtkWidget *widget, gpointer data ){
Select_SetTexdef( projection, false, true ); Select_SetTexdef( projection, false, true );
} }
static void OnBtnProject( GtkWidget *widget, gpointer data ){ static void OnBtnProject( GtkWidget *widget, EProjectTexture type ){
if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_QUAKE ) { if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_QUAKE ) {
globalErrorStream() << "function doesn't work for *brushes*, having Axial Projection type\n"; globalErrorStream() << "function doesn't work for *brushes*, having Axial Projection type\n"; //works for patches
//return;
} }
getSurfaceInspector().exportData(); getSurfaceInspector().exportData();
SurfaceInspector_ProjectTexture(); SurfaceInspector_ProjectTexture( type );
} }
static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){ static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){
@ -960,36 +957,50 @@ GtkWindow* SurfaceInspector::BuildDialog(){
gtk_widget_set_usize( button, 60, -2 ); gtk_widget_set_usize( button, 60, -2 );
} }
{ {
GtkWidget* button = gtk_button_new_with_label( "Project" ); GtkWidget* label = gtk_label_new( "Project:" );
gtk_widget_show( button ); gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 2, 3, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnProject ), 0 );
gtk_widget_set_usize( button, 60, -2 );
} }
{ {
//radio button group for choosing projection style GtkWidget* button = gtk_button_new_with_label( "Axial" );
GtkWidget* radAxial = gtk_radio_button_new_with_label( NULL, "Axial" ); gtk_widget_set_tooltip_text( button, "Axial projection (along nearest axis)" );
gtk_widget_set_tooltip_text( radAxial, "Axial projection (along nearest axis)" ); gtk_widget_show( button );
gtk_widget_show( radAxial ); gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 2, 3,
gtk_table_attach( GTK_TABLE( table ), radAxial, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
( GtkAttachOptions )( 0 ), 0, 0 ); (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 5 );
GtkWidget* rad = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radAxial ), "Ortho" ); g_signal_connect( G_OBJECT( button ), "clicked",
gtk_widget_set_tooltip_text( rad, "Project along active ortho view" ); G_CALLBACK( OnBtnProject ), (gpointer)eProjectAxial );
gtk_widget_show( rad ); GtkRequisition req;
gtk_table_attach( GTK_TABLE( table ), rad, 2, 3, 2, 3, gtk_widget_size_request( button, &req );
gtk_widget_set_usize( button, 60, req.height * 3 / 4 );
}
{
GtkWidget* button = gtk_button_new_with_label( "Ortho" );
gtk_widget_set_tooltip_text( button, "Project along active ortho view" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
( GtkAttachOptions )( 0 ), 0, 0 ); (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 5 );
rad = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radAxial ), "Cam" ); g_signal_connect( G_OBJECT( button ), "clicked",
gtk_widget_set_tooltip_text( rad, "Project along camera view direction" ); G_CALLBACK( OnBtnProject ), (gpointer)eProjectOrtho );
gtk_widget_show( rad ); GtkRequisition req;
gtk_table_attach( GTK_TABLE( table ), rad, 3, 4, 2, 3, gtk_widget_size_request( button, &req );
gtk_widget_set_usize( button, 60, req.height * 3 / 4 );
}
{
GtkWidget* button = gtk_button_new_with_label( "Cam" );
gtk_widget_set_tooltip_text( button, "Project along camera view direction" );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
( GtkAttachOptions )( 0 ), 0, 0 ); (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 5 );
AddDialogData( *GTK_RADIO_BUTTON( radAxial ), m_projectRadio ); g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnProject ), (gpointer)eProjectCam );
GtkRequisition req;
gtk_widget_size_request( button, &req );
gtk_widget_set_usize( button, 60, req.height * 3 / 4 );
} }
{ {
GtkWidget* button = gtk_button_new_with_label( "CAP" ); GtkWidget* button = gtk_button_new_with_label( "CAP" );