Feature: Make Hollow Touch/Overlap

This commit is contained in:
Pan7 2015-08-30 05:39:31 +02:00
parent 967b493e50
commit 621c43a618
6 changed files with 36 additions and 3 deletions

View file

@ -564,6 +564,7 @@ typedef void ( *PFN_QERAPP_POINTFILECLEAR )();
typedef void ( *PFN_QERAPP_SYSSETTITLE )( const char *text );
typedef void ( *PFN_QERAPP_CSGMAKEHOLLOW )();
typedef void ( *PFN_QERAPP_CSGMAKEHOLLOWMODE )( int mode );
typedef void ( *PFN_QERAPP_REGIONSPAWNPOINT )( FILE *f );
@ -740,6 +741,7 @@ struct _QERFuncTable_1
// FIXME TTimo prolly want to move that somewhere else
PFN_QERAPP_CSGMAKEHOLLOW m_pfnCSG_MakeHollow;
PFN_QERAPP_CSGMAKEHOLLOWMODE m_pfnCSG_MakeHollowMode;
PFN_QERAPP_REGIONSPAWNPOINT m_pfnRegionSpawnPoint;
PFN_QERAPP_GETTICKCOUNT m_pfnQGetTickCount;
@ -761,6 +763,7 @@ struct _QERFuncTable_1
#define __QERTABLENAME g_FuncTable
#endif
#define CSG_MakeHollow __QERTABLENAME.m_pfnCSG_MakeHollow
#define CSG_MakeHollowMode __QERTABLENAME.m_pfnCSG_MakeHollowMode
#define Sys_Beep __QERTABLENAME.m_pfnSysBeep
#define Sys_Printf __QERTABLENAME.m_pfnSysPrintf
#define Sys_FPrintf __QERTABLENAME.m_pfnSysFPrintf

View file

@ -39,7 +39,10 @@ void Brush_Scale( brush_t* b ){
}
}
void CSG_MakeHollow( void ){
void CSG_MakeHollow(){
CSG_MakeHollowMode( CSG_HOLLOW_MODE_OVERLAP );
}
void CSG_MakeHollowMode( int mode ){
brush_t *b, *front, *back, *next;
face_t *f;
face_t split;
@ -66,6 +69,9 @@ void CSG_MakeHollow( void ){
Brush_Free( back );
}
if ( front ) {
if( mode == CSG_HOLLOW_MODE_TOUCH ) {
Brush_Move( front, move, true );
}
Brush_AddToList( front, &selected_brushes );
}
}

View file

@ -496,6 +496,7 @@ gint HandleCommand( GtkWidget *widget, gpointer data ){
case ID_SELECTION_ARBITRARYROTATION: g_pParentWnd->OnSelectionArbitraryrotation(); break;
case ID_SELECT_SCALE: g_pParentWnd->OnSelectScale(); break;
case ID_SELECTION_MAKEHOLLOW: g_pParentWnd->OnSelectionMakehollow(); break;
case ID_SELECTION_MAKEHOLLOW_TOUCH: g_pParentWnd->OnSelectionMakehollowTouch(); break;
case ID_SELECTION_CSGSUBTRACT: g_pParentWnd->OnSelectionCsgsubtract(); break;
case ID_SELECTION_CSGMERGE: g_pParentWnd->OnSelectionCsgmerge(); break;
case ID_SELECTION_NOOUTLINE: g_pParentWnd->OnSelectionNoOutline(); break;
@ -1192,8 +1193,10 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){
menu_separator( menu );
create_menu_item_with_mnemonic( menu, _( "Scale..." ), G_CALLBACK( HandleCommand ), ID_SELECT_SCALE );
menu_in_menu = create_menu_in_menu_with_mnemonic( menu, _( "CSG" ) );
create_menu_item_with_mnemonic( menu_in_menu, _( "Make _Hollow" ),
create_menu_item_with_mnemonic( menu_in_menu, _( "Make _Hollow Overlap" ),
G_CALLBACK( HandleCommand ), ID_SELECTION_MAKEHOLLOW );
create_menu_item_with_mnemonic( menu_in_menu, _( "Make _Hollow Touch" ),
G_CALLBACK( HandleCommand ), ID_SELECTION_MAKEHOLLOW_TOUCH );
create_menu_item_with_mnemonic( menu_in_menu, _( "CSG _Subtract" ),
G_CALLBACK( HandleCommand ), ID_SELECTION_CSGSUBTRACT );
create_menu_item_with_mnemonic( menu_in_menu, _( "CSG _Merge" ),
@ -1784,11 +1787,16 @@ void MainFrame::create_main_toolbar( GtkWidget *window, GtkWidget *vbox ){
g_object_set_data( G_OBJECT( window ), "tb_selection_csgmerge", w );
}
w = toolbar_append_item( GTK_TOOLBAR( toolbar ), "", _( "Hollow" ), "",
w = toolbar_append_item( GTK_TOOLBAR( toolbar ), "", _( "Hollow Overlap" ), "",
new_image_icon("selection_makehollow.png"),
G_CALLBACK( HandleCommand ), GINT_TO_POINTER( ID_SELECTION_MAKEHOLLOW ) );
g_object_set_data( G_OBJECT( window ), "tb_selection_makehollow", w );
w = toolbar_append_item( GTK_TOOLBAR( toolbar ), "", _( "Hollow Touch" ), "",
new_image_icon("selection_makehollow.png"),
G_CALLBACK( HandleCommand ), GINT_TO_POINTER( ID_SELECTION_MAKEHOLLOW_TOUCH ) );
g_object_set_data( G_OBJECT( window ), "tb_selection_makehollow_touch", w );
if ( g_PrefsDlg.m_bWideToolbar ) {
w = toolbar_append_element( GTK_TOOLBAR( toolbar ), TOOLBAR_CHILD_TOGGLEBUTTON, NULL,
"", _( "Clipper" ), "", new_image_icon("view_clipper.png"),
@ -5346,6 +5354,16 @@ void MainFrame::OnSelectionMakehollow(){
Undo_End();
}
void MainFrame::OnSelectionMakehollowTouch(){
//if (ActiveXY())
// ActiveXY()->UndoCopy();
Undo_Start( "hollow" );
Undo_AddBrushList( &selected_brushes );
CSG_MakeHollowMode( CSG_HOLLOW_MODE_TOUCH );
Undo_EndBrushList( &selected_brushes );
Undo_End();
}
void MainFrame::OnSelectionCsgsubtract(){
Undo_Start( "CSG subtract" );
CSG_Subtract();

View file

@ -267,6 +267,7 @@ struct SKeyInfo
#define ID_SELECTION_SELECTCOMPLETETALL 40048
#define ID_SELECTION_CSGSUBTRACT 40049
#define ID_SELECTION_SELECTTOUCHING 40050
#define ID_SELECTION_MAKEHOLLOW_TOUCH 40051
#define ID_VIEW_NEAREST 40052
#define ID_VIEW_NEARESTMIPMAP 40053
#define ID_VIEW_LINEAR 40054
@ -685,6 +686,7 @@ void OnSelectionDragvertecies();
void OnSelectionMakeDetail();
void OnSelectionMakeStructural();
void OnSelectionMakehollow();
void OnSelectionMakehollowTouch();
void OnSelectionSelectcompletetall();
void OnSelectionSelectinside();
void OnSelectionSelectpartialtall();

View file

@ -2061,6 +2061,7 @@ bool CSynapseClientRadiant::RequestAPI( APIDescriptor_t *pAPI ){
pTable->m_pfnSetBuildWindingsNoTexBuild = &Brush_SetBuildWindingsNoTexBuild;
pTable->m_pfnPointFileClear = &Pointfile_Clear;
pTable->m_pfnCSG_MakeHollow = &CSG_MakeHollow;
pTable->m_pfnCSG_MakeHollowMode = &CSG_MakeHollowMode;
pTable->m_pfnRegionSpawnPoint = &Region_SpawnPoint;
pTable->m_pfnQGetTickCount = &QERApp_GetTickCount;
pTable->m_pfnGetModelCache = &GetModelCache;

View file

@ -222,7 +222,10 @@ void Drag_MouseUp( int nButtons = 0 );
//
// csg.c
//
#define CSG_HOLLOW_MODE_OVERLAP (0)
#define CSG_HOLLOW_MODE_TOUCH (1)
void CSG_MakeHollow( void );
void CSG_MakeHollowMode( int mode );
void CSG_Subtract( void );
void CSG_Merge( void );