diff --git a/contrib/terrain_generator/brush_builder.cpp b/contrib/terrain_generator/brush_builder.cpp index c7ed2346..31b08565 100644 --- a/contrib/terrain_generator/brush_builder.cpp +++ b/contrib/terrain_generator/brush_builder.cpp @@ -8,6 +8,9 @@ #include "qerplugin.h" #include "scenelib.h" +const unsigned int BRUSH_DETAIL_FLAG = 27; +const unsigned int BRUSH_DETAIL_MASK = ( 1 << BRUSH_DETAIL_FLAG ); + // --------------------------------------------------------------------------- // Helpers // --------------------------------------------------------------------------- @@ -26,7 +29,7 @@ static void fill_face( _QERFaceData& face, face.m_texdef.shift[0] = 0; face.m_texdef.shift[1] = 0; face.m_texdef.rotate = 0; - face.contents = 0; + face.contents = BRUSH_DETAIL_MASK; face.flags = 0; face.value = 0; } @@ -186,7 +189,6 @@ void build_terrain_brushes( const BrushData& target, double step_x, double step_ } select_generated( entity ); - GlobalRadiant().Brush_setDetail( entity ); SceneChangeNotify(); } @@ -467,9 +469,5 @@ void build_tunnel_brushes( const BrushData& target, double step_x, double step_y select_generated( ceil_entity ); select_generated( lwall_entity ); select_generated( rwall_entity ); - GlobalRadiant().Brush_setDetail( floor_entity ); - GlobalRadiant().Brush_setDetail( ceil_entity ); - GlobalRadiant().Brush_setDetail( lwall_entity ); - GlobalRadiant().Brush_setDetail( rwall_entity ); SceneChangeNotify(); } diff --git a/include/qerplugin.h b/include/qerplugin.h index fd5c2bd9..5c289249 100644 --- a/include/qerplugin.h +++ b/include/qerplugin.h @@ -143,6 +143,7 @@ struct _QERFuncTable_1 Vector3 ( *Camera_getOrigin )(); const char* ( *TextureBrowser_getSelectedShader )( ); + void ( *TextureBrowser_show )( ); // Qt functions PFN_QERAPP_MESSAGEBOX m_pfnMessageBox; @@ -150,10 +151,6 @@ struct _QERFuncTable_1 PFN_QERAPP_DIRDIALOG m_pfnDirDialog; PFN_QERAPP_COLORDIALOG m_pfnColorDialog; PFN_QERAPP_NEWICON m_pfnNewIcon; - - // Plugin extensions — always append new members here to preserve ABI - void ( *TextureBrowser_show )( ); - void ( *Brush_setDetail )( scene::Node& node ); }; #include "modulesystem.h" diff --git a/radiant/brush.h b/radiant/brush.h index f44262de..69073edb 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -1982,12 +1982,13 @@ public: } /// \brief Appends a new face constructed from the parameters to the end of the face list. - Face* addPlane( const DoubleVector3& p0, const DoubleVector3& p1, const DoubleVector3& p2, const char* shader, const TextureProjection& projection ){ + Face* addPlane( const DoubleVector3& p0, const DoubleVector3& p1, const DoubleVector3& p2, const char* shader, const TextureProjection& projection, int contentFlags = 0 ){ if ( m_faces.size() == c_brush_maxFaces ) { return 0; } undoSave(); push_back( FaceSmartPointer( new Face( p0, p1, p2, shader, projection, this ) ) ); + m_faces.back()->getShader().m_flags.m_contentFlags = contentFlags; m_faces.back()->setDetail( isDetail() ); planeChanged(); return m_faces.back(); diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index fcd494b8..b3bd0e8a 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -658,26 +658,6 @@ void Scene_BrushSetDetail_Selected( scene::Graph& graph, bool detail ){ SceneChangeNotify(); } -class BrushSetDetailWalker : public scene::Traversable::Walker -{ -public: - bool pre( scene::Node& node ) const override { - if ( Brush* brush = Node_getBrush( node ) ) { - Brush_forEachFace( *brush, []( Face& face ){ face.setDetail( true ); } ); - } - return true; - } -}; - -void Brush_setDetail( scene::Node& node ){ - if ( Brush* brush = Node_getBrush( node ) ) { - Brush_forEachFace( *brush, []( Face& face ){ face.setDetail( true ); } ); - } - else if ( scene::Traversable* traversable = Node_getTraversable( node ) ) { - traversable->traverse( BrushSetDetailWalker() ); - } -} - bool Face_FindReplaceShader( Face& face, const char* find, const char* replace ){ if ( shader_equal( face.GetShader(), find ) ) { face.SetShader( replace ); diff --git a/radiant/brushmanip.h b/radiant/brushmanip.h index b6ade403..64c96283 100644 --- a/radiant/brushmanip.h +++ b/radiant/brushmanip.h @@ -45,9 +45,6 @@ class Graph; class Node; } void Scene_BrushConstructPrefab( scene::Graph& graph, EBrushPrefab type, std::size_t sides, bool option, const char* shader ); -// Flag every brush in 'node' (a brush, or any node whose subgraph contains -// brushes, e.g. a group entity) as detail. -void Brush_setDetail( scene::Node& node ); class AABB; void Scene_BrushResize_Cuboid( scene::Node*& node, const AABB& bounds ); void Brush_ConstructPlacehoderCuboid( scene::Node& node, const AABB& bounds ); diff --git a/radiant/brushmodule.cpp b/radiant/brushmodule.cpp index 5320e523..2ae03716 100644 --- a/radiant/brushmodule.cpp +++ b/radiant/brushmodule.cpp @@ -236,7 +236,7 @@ public: } bool Brush_addFace( scene::Node& brush, const _QERFaceData& faceData ) override { Node_getBrush( brush )->undoSave(); - return Node_getBrush( brush )->addPlane( faceData.m_p0, faceData.m_p1, faceData.m_p2, faceData.m_shader, TextureProjection( faceData.m_texdef, brushprimit_texdef_t(), Vector3( 0, 0, 0 ), Vector3( 0, 0, 0 ) ) ) != 0; + return Node_getBrush( brush )->addPlane( faceData.m_p0, faceData.m_p1, faceData.m_p2, faceData.m_shader, TextureProjection( faceData.m_texdef, brushprimit_texdef_t(), Vector3( 0, 0, 0 ), Vector3( 0, 0, 0 ) ), faceData.contents ) != 0; } }; diff --git a/radiant/groupdialog.h b/radiant/groupdialog.h index 553b34e8..e2d0267a 100644 --- a/radiant/groupdialog.h +++ b/radiant/groupdialog.h @@ -39,7 +39,5 @@ inline void RawStringExport( const char* string, const StringImportCallback& imp typedef ConstPointerCaller RawStringExportCaller; QWidget* GroupDialog_addPage( const char* tabLabel, QWidget* widget, const StringExportCallback& title ); -bool GroupDialog_isShown(); -QWidget* GroupDialog_getPage(); void GroupDialog_showPage( QWidget* page ); void GroupDialog_updatePageTitle( QWidget* page ); diff --git a/radiant/plugin.cpp b/radiant/plugin.cpp index 85e8402a..d20aaada 100644 --- a/radiant/plugin.cpp +++ b/radiant/plugin.cpp @@ -58,7 +58,6 @@ #include "texwindow.h" #include "modelwindow.h" #include "mainframe.h" -#include "brushmanip.h" #include "build.h" #include "mru.h" #include "surfacedialog.h" @@ -153,7 +152,6 @@ public: m_radiantcore.TextureBrowser_getSelectedShader = TextureBrowser_GetSelectedShader; m_radiantcore.TextureBrowser_show = TextureBrowser_show; - m_radiantcore.Brush_setDetail = Brush_setDetail; m_radiantcore.m_pfnMessageBox = &qt_MessageBox; m_radiantcore.m_pfnFileDialog = &file_dialog; diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index b8e33196..ea3dadc4 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -625,12 +625,8 @@ void TextureBrowser_toggleShow(){ } void TextureBrowser_show(){ - if ( !g_page_textures ) - return; - if ( GroupDialog_isShown() && GroupDialog_getPage() == g_page_textures ) - GroupDialog_show(); // already on textures tab — just raise/focus - else - GroupDialog_showPage( g_page_textures ); // switch to textures tab and show + if ( g_page_textures != nullptr ) + GroupDialog_showPage( g_page_textures ); } void TextureBrowser_updateTitle(){