diff --git a/include/qertypes.h b/include/qertypes.h index 50dec5f2..b3631d88 100644 --- a/include/qertypes.h +++ b/include/qertypes.h @@ -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_ diff --git a/install/bitmaps/toggle_detail.png b/install/bitmaps/toggle_detail.png new file mode 100644 index 00000000..e91acc51 Binary files /dev/null and b/install/bitmaps/toggle_detail.png differ diff --git a/install/bitmaps/toggle_struct.png b/install/bitmaps/toggle_struct.png new file mode 100644 index 00000000..c773aa5c Binary files /dev/null and b/install/bitmaps/toggle_struct.png differ diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 805bc6e8..72c9e028 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -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" ); diff --git a/radiant/mainframe.h b/radiant/mainframe.h index f0b14d17..73f8ccee 100644 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@ -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 ); diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index d0d2e6fd..560eb8fe 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -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] );