Added a toggle button to the main toolbar for creating Structural/Detail brushes

This commit is contained in:
Chris Brooke 2013-07-26 22:25:56 +01:00
parent 449340a95e
commit 949547b125
6 changed files with 51 additions and 3 deletions

View file

@ -874,6 +874,8 @@ typedef struct
// set to true after OpenGL has been initialized and extensions have been tested
bool m_bOpenGLReady;
// set this to true and any new brushes will be detail by default (else they are structural)
bool m_bMakeDetail;
} QEGlobals_t;
#endif // _QERTYPES_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -690,6 +690,7 @@ gint HandleCommand( GtkWidget *widget, gpointer data ){
case ID_SELECT_SNAPTOGRID: g_pParentWnd->OnSnapToGrid(); break;
case ID_SELECT_ALL: g_pParentWnd->OnSelectAll(); break;
case ID_SELECTION_INVERT: g_pParentWnd->OnSelectionInvert(); break;
case ID_TOGGLE_DETAIL: g_pParentWnd->OnToggleDetail(); break;
}}
return TRUE;
@ -1756,6 +1757,11 @@ void MainFrame::create_main_toolbar( GtkWidget *window, GtkWidget *vbox ){
g_object_set_data( G_OBJECT( window ), "tb_view_clipper", w );
}
w = gtk_toolbar_append_element( GTK_TOOLBAR( toolbar ), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL,
"", _( "Make Detail Brushes" ), "", new_image_icon("toggle_struct.png"),
GTK_SIGNAL_FUNC( HandleCommand ), GINT_TO_POINTER( ID_TOGGLE_DETAIL ) );
g_object_set_data( G_OBJECT( window ), "tb_toggle_detail", w );
gtk_toolbar_append_space( GTK_TOOLBAR( toolbar ) );
w = gtk_toolbar_append_item( GTK_TOOLBAR( toolbar ), "", _( "Change views" ), "",
@ -5454,6 +5460,31 @@ void MainFrame::OnClipSelected(){
}
}
void MainFrame::OnToggleDetail(){
GtkWidget *w = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "tb_toggle_detail" ) );
g_bIgnoreCommands++;
if ( g_qeglobals.m_bMakeDetail == TRUE ) {
g_qeglobals.m_bMakeDetail = FALSE;
Sys_Printf( "Structural Brush mode activated\n" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( w ), FALSE );
gtk_button_set_image( GTK_BUTTON( w ),new_image_icon( "toggle_struct.png" ) );
}
else
{
g_qeglobals.m_bMakeDetail = TRUE;
Sys_Printf( "Detail Brush mode activated\n" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( w ), TRUE );
gtk_button_set_image( GTK_BUTTON( w ), new_image_icon( "toggle_detail.png" ) );
}
g_bIgnoreCommands--;
}
void MainFrame::OnSplitSelected(){
if ( m_pActiveXY ) {
Undo_Start( "split selected" );

View file

@ -427,6 +427,8 @@ struct SKeyInfo
#define ID_TEXTUREWINDOW_SCALEUP 40321
#define ID_TEXTUREWINDOW_SCALEDOWN 40322
#define ID_TOGGLE_DETAIL 40323
class CSynapseClientRadiant : public CSynapseClient
{
public:
@ -695,6 +697,7 @@ void OnHelp();
void OnHelpLinks();
void OnHelpBugreport();
void OnViewClipper();
void OnToggleDetail();
void OnCameraAngledown();
void OnCameraAngleup();
void OnCameraBack( bool keydown );

View file

@ -1595,7 +1595,7 @@ void XYWnd::NewBrushDrag( int x, int y ){
maxs[i] = temp;
}
}
// Caulk the new brush
if ( g_PrefsDlg.m_bCaulkNewBrushes == TRUE ) {
texdef_t tex;
@ -1605,16 +1605,28 @@ void XYWnd::NewBrushDrag( int x, int y ){
tex.scale[0] = g_PrefsDlg.m_fDefTextureScale;
tex.scale[1] = g_PrefsDlg.m_fDefTextureScale;
tex.flags = shad->getFlags();
n = Brush_Create( mins, maxs, &tex );
} else {
n = Brush_Create( mins, maxs, &g_qeglobals.d_texturewin.texdef );
}
if ( !n ) {
return;
}
// structural or detail?
face_t *f;
for ( f = n->brush_faces ; f ; f = f->next ) {
if ( g_qeglobals.m_bMakeDetail == TRUE ) {
f->texdef.contents |= CONTENTS_DETAIL;
} else {
f->texdef.contents &= ~CONTENTS_DETAIL;
}
}
//
vec3_t vSize;
VectorSubtract( maxs, mins, vSize );
g_strStatus.Format( "Size X:: %.1f Y:: %.1f Z:: %.1f", vSize[0], vSize[1], vSize[2] );