diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index bc2c24b9..3f0b5f3f 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -850,7 +850,7 @@ void Scene_BrushResize_Cuboid( scene::Node*& node, const AABB& bounds ){ if ( brush != 0 ) { const char* shader = g_brush_always_caulk? GetCaulkShader() - : TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ); + : TextureBrowser_GetSelectedShader(); Brush_ConstructCuboid( *brush, bounds, shader, TextureTransform_getDefault() ); SceneChangeNotify(); } @@ -1473,7 +1473,7 @@ BrushMakeSided( std::size_t count ) : m_count( count ){ } void set(){ - Scene_BrushConstructPrefab( GlobalSceneGraph(), eBrushPrism, m_count, TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); + Scene_BrushConstructPrefab( GlobalSceneGraph(), eBrushPrism, m_count, TextureBrowser_GetSelectedShader() ); } typedef MemberCaller SetCaller; }; diff --git a/radiant/csg.cpp b/radiant/csg.cpp index 09b0898d..08b7b357 100644 --- a/radiant/csg.cpp +++ b/radiant/csg.cpp @@ -191,7 +191,7 @@ public: m_out.back()->addPlane( winding[index].vertex, winding[next].vertex, winding[next].vertex + face.getPlane().plane3().normal() * m_settings.m_offset, - TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), + TextureBrowser_GetSelectedShader(), projection ); } } @@ -269,7 +269,7 @@ public: m_out.back()->addPlane( winding[next].vertex, winding[index].vertex, BestPoint, - m_settings.m_caulk ? GetCaulkShader() : TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), + m_settings.m_caulk ? GetCaulkShader() : TextureBrowser_GetSelectedShader(), projection ); } } @@ -796,7 +796,7 @@ void post( const scene::Path& path, scene::Instance& instance ) const { }; void Scene_BrushSplitByPlane( scene::Graph& graph, const ClipperPoints& points, bool caulk, bool split ){ - const char* shader = caulk? GetCaulkShader() : TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ); + const char* shader = caulk? GetCaulkShader() : TextureBrowser_GetSelectedShader(); TextureProjection projection; TexDef_Construct_Default( projection ); graph.traverse( BrushSplitByPlaneSelected( points, shader, projection, split ) ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 2d1e5f37..1bff7fcd 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -461,10 +461,10 @@ void DoSides( int type, int axis ){ if ( modal_dialog_show( window, dialog ) == eIDOK ) { // const char *str = gtk_entry_get_text( sides_entry ); -// Scene_BrushConstructPrefab( GlobalSceneGraph(), (EBrushPrefab)type, atoi( str ), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); +// Scene_BrushConstructPrefab( GlobalSceneGraph(), (EBrushPrefab)type, atoi( str ), TextureBrowser_GetSelectedShader() ); gtk_spin_button_update ( GTK_SPIN_BUTTON( sides_spin ) ); int sides = static_cast( gtk_spin_button_get_value( GTK_SPIN_BUTTON( sides_spin ) ) ); - Scene_BrushConstructPrefab( GlobalSceneGraph(), (EBrushPrefab)type, sides, TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); + Scene_BrushConstructPrefab( GlobalSceneGraph(), (EBrushPrefab)type, sides, TextureBrowser_GetSelectedShader() ); } gtk_widget_destroy( GTK_WIDGET( window ) ); diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index 6e26aead..b461be25 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -560,43 +560,43 @@ void Patch_XactCone(){ void Patch_Cylinder(){ UndoableCommand undo( "patchCreateCylinder" ); - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), eCylinder, GlobalXYWnd_getCurrentViewType() ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), eCylinder, GlobalXYWnd_getCurrentViewType() ); } void Patch_DenseCylinder(){ UndoableCommand undo( "patchCreateDenseCylinder" ); - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), eDenseCylinder, GlobalXYWnd_getCurrentViewType() ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), eDenseCylinder, GlobalXYWnd_getCurrentViewType() ); } void Patch_VeryDenseCylinder(){ UndoableCommand undo( "patchCreateVeryDenseCylinder" ); - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), eVeryDenseCylinder, GlobalXYWnd_getCurrentViewType() ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), eVeryDenseCylinder, GlobalXYWnd_getCurrentViewType() ); } void Patch_SquareCylinder(){ UndoableCommand undo( "patchCreateSquareCylinder" ); - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), eSqCylinder, GlobalXYWnd_getCurrentViewType() ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), eSqCylinder, GlobalXYWnd_getCurrentViewType() ); } void Patch_Endcap(){ UndoableCommand undo( "patchCreateEndCap" ); - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), eEndCap, GlobalXYWnd_getCurrentViewType() ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), eEndCap, GlobalXYWnd_getCurrentViewType() ); } void Patch_Bevel(){ UndoableCommand undo( "patchCreateBevel" ); - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), eBevel, GlobalXYWnd_getCurrentViewType() ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), eBevel, GlobalXYWnd_getCurrentViewType() ); } void Patch_Sphere(){ UndoableCommand undo( "patchCreateSphere" ); - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), eSphere, GlobalXYWnd_getCurrentViewType() ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), eSphere, GlobalXYWnd_getCurrentViewType() ); } void Patch_SquareBevel(){ @@ -608,7 +608,7 @@ void Patch_SquareEndcap(){ void Patch_Cone(){ UndoableCommand undo( "patchCreateCone" ); - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), eCone, GlobalXYWnd_getCurrentViewType() ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), eCone, GlobalXYWnd_getCurrentViewType() ); } void Patch_Plane(){ @@ -706,7 +706,7 @@ void Patch_Cap(){ // Patch_CapCurrent(); UndoableCommand undo( "patchPutCaps" ); - Scene_PatchDoCap_Selected( GlobalSceneGraph(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); + Scene_PatchDoCap_Selected( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); } ///\todo Unfinished. @@ -1116,7 +1116,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, if( prefab != ePlane ){ redisperse = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( redisperseCheckBox ) ) ? true : false; } - Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), prefab, GlobalXYWnd_getCurrentViewType(), w, h, redisperse ); + Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(), prefab, GlobalXYWnd_getCurrentViewType(), w, h, redisperse ); } gtk_widget_destroy( GTK_WIDGET( window ) ); diff --git a/radiant/plugin.cpp b/radiant/plugin.cpp index c51699bd..f94ecb0d 100644 --- a/radiant/plugin.cpp +++ b/radiant/plugin.cpp @@ -109,10 +109,6 @@ Vector3 XYWindow_windowToWorld( const WindowVector& position ){ return result; } -const char* TextureBrowser_getSelectedShader(){ - return TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ); -} - class RadiantCoreAPI { _QERFuncTable_1 m_radiantcore; @@ -153,7 +149,7 @@ RadiantCoreAPI(){ m_radiantcore.XYWindowMouseDown_disconnect = XYWindowMouseDown_disconnect; m_radiantcore.XYWindow_getViewType = XYWindow_getViewType; m_radiantcore.XYWindow_windowToWorld = XYWindow_windowToWorld; - m_radiantcore.TextureBrowser_getSelectedShader = TextureBrowser_getSelectedShader; + m_radiantcore.TextureBrowser_getSelectedShader = TextureBrowser_GetSelectedShader; m_radiantcore.m_pfnMessageBox = >k_MessageBox; m_radiantcore.m_pfnFileDialog = &file_dialog; diff --git a/radiant/select.cpp b/radiant/select.cpp index f6dcb2c4..81190297 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -848,7 +848,7 @@ void Select_AllOfType(){ if ( GlobalSelectionSystem().Mode() == SelectionSystem::eComponent ) { if ( GlobalSelectionSystem().ComponentMode() == SelectionSystem::eFace ) { GlobalSelectionSystem().setSelectedAllComponents( false ); - Scene_BrushSelectByShader_Component( GlobalSceneGraph(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); + Scene_BrushSelectByShader_Component( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); } } else @@ -865,15 +865,15 @@ void Select_AllOfType(){ } else { - Scene_BrushSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); - Scene_PatchSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); + Scene_BrushSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); + Scene_PatchSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); } } } void Select_FacesAndPatchesByShader(){ - Scene_BrushFacesSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); - Scene_PatchSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ) ); + Scene_BrushFacesSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); + Scene_PatchSelectByShader( GlobalSceneGraph(), TextureBrowser_GetSelectedShader() ); } void Select_Inside( void ){ diff --git a/radiant/selection.cpp b/radiant/selection.cpp index 0229f669..a780a78b 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -5571,7 +5571,6 @@ const ModifierFlags c_modifier_copy_texture = c_modifierNone; void Scene_copyClosestTexture( SelectionTest& test ); void Scene_applyClosestTexture( SelectionTest& test, bool seamless, bool project, bool texturize_selected = false ); -void Scene_projectClosestTexture( SelectionTest& test ); class TexManipulator_ { diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index a9693dfa..321d5a75 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -1690,15 +1690,13 @@ void Scene_setClosestTexture( scene::Graph& graph, SelectionTest& test, const ch } } -class TextureBrowser; -extern TextureBrowser g_TextureBrowser; -void TextureBrowser_SetSelectedShader( TextureBrowser& textureBrowser, const char* shader ); -const char* TextureBrowser_GetSelectedShader( TextureBrowser& textureBrowser ); +void TextureBrowser_SetSelectedShader( const char* shader ); +const char* TextureBrowser_GetSelectedShader(); void Scene_copyClosestTexture( SelectionTest& test ){ CopiedString shader; if ( Scene_getClosestTexture( GlobalSceneGraph(), test, shader, g_faceTextureClipboard.m_projection, g_faceTextureClipboard.m_flags ) ) { - TextureBrowser_SetSelectedShader( g_TextureBrowser, shader.c_str() ); + TextureBrowser_SetSelectedShader( shader.c_str() ); // UndoableCommand undo( "textureNameAndProjectionSetSelected" ); // Select_SetShader( shader.c_str() ); // Select_SetTexdef( g_faceTextureClipboard.m_projection ); @@ -1710,16 +1708,16 @@ void Scene_applyClosestTexture( SelectionTest& test, bool seamless, bool project if( texturize_selected ){ if( project ){ - Select_SetShader( TextureBrowser_GetSelectedShader( g_TextureBrowser ) ); + Select_SetShader( TextureBrowser_GetSelectedShader() ); Select_ProjectTexture( g_faceTextureClipboard.m_projection, g_faceTextureClipboard.m_plane.normal() ); } else if( !seamless ){ - Select_SetShader( TextureBrowser_GetSelectedShader( g_TextureBrowser ) ); + Select_SetShader( TextureBrowser_GetSelectedShader() ); Select_SetTexdef( g_faceTextureClipboard.m_projection, false, false ); } } - Scene_setClosestTexture( GlobalSceneGraph(), test, TextureBrowser_GetSelectedShader( g_TextureBrowser ), g_faceTextureClipboard.m_projection, g_faceTextureClipboard.m_flags, seamless, project ); + Scene_setClosestTexture( GlobalSceneGraph(), test, TextureBrowser_GetSelectedShader(), g_faceTextureClipboard.m_projection, g_faceTextureClipboard.m_flags, seamless, project ); SceneChangeNotify(); } @@ -1734,13 +1732,13 @@ void SelectedFaces_copyTexture(){ face.GetTexdef( g_faceTextureClipboard.m_projection ); g_faceTextureClipboard.m_flags = face.getShader().m_flags; - TextureBrowser_SetSelectedShader( g_TextureBrowser, face.getShader().getShader() ); + TextureBrowser_SetSelectedShader( face.getShader().getShader() ); } } void FaceInstance_pasteTexture( FaceInstance& faceInstance ){ faceInstance.getFace().SetTexdef( g_faceTextureClipboard.m_projection ); - faceInstance.getFace().SetShader( TextureBrowser_GetSelectedShader( g_TextureBrowser ) ); + faceInstance.getFace().SetShader( TextureBrowser_GetSelectedShader() ); faceInstance.getFace().SetFlags( g_faceTextureClipboard.m_flags ); SceneChangeNotify(); } diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index c795fb40..50c27b81 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -387,6 +387,10 @@ inline int TextureBrowser_fontHeight( TextureBrowser& textureBrowser ){ return GlobalOpenGL().m_font->getPixelHeight(); } +const char* TextureBrowser_GetSelectedShader(){ + return GlobalTextureBrowser().shader.c_str(); +} + const char* TextureBrowser_GetSelectedShader( TextureBrowser& textureBrowser ){ return textureBrowser.shader.c_str(); } @@ -428,6 +432,10 @@ void TextureBrowser_SetSelectedShader( TextureBrowser& textureBrowser, const cha ishader->DecRef(); } +void TextureBrowser_SetSelectedShader( const char* shader ){ + TextureBrowser_SetSelectedShader( GlobalTextureBrowser(), shader ); +} + CopiedString g_TextureBrowser_currentDirectory; @@ -2441,7 +2449,7 @@ void TextureBrowser_selectionHelper( GtkTreeModel* model, GtkTreePath* path, Gtk } void TextureBrowser_shaderInfo(){ - const char* name = TextureBrowser_GetSelectedShader( g_TextureBrowser ); + const char* name = TextureBrowser_GetSelectedShader(); IShader* shader = QERApp_Shader_ForName( name ); DoShaderInfoDlg( name, shader->getShaderFileName(), "Shader Info" ); diff --git a/radiant/texwindow.h b/radiant/texwindow.h index d62c772a..f6ab8109 100644 --- a/radiant/texwindow.h +++ b/radiant/texwindow.h @@ -40,7 +40,7 @@ void TextureBrowser_destroyWindow(); void TextureBrowser_ShowDirectory( TextureBrowser& textureBrowser, const char* name ); void TextureBrowser_ShowStartupShaders( TextureBrowser& textureBrowser ); -const char* TextureBrowser_GetSelectedShader( TextureBrowser& textureBrower ); +const char* TextureBrowser_GetSelectedShader(); void TextureBrowser_Construct(); void TextureBrowser_Destroy();