diff --git a/radiant/brush.h b/radiant/brush.h index 3645a808..cb6352e3 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -552,9 +552,9 @@ void unrealiseShader(){ } } -void setTexdef( const TextureProjection& projection ){ +void setTexdef( const TextureProjection& projection, bool setBasis ){ removeScale(); - Texdef_Assign( m_projection, projection ); + Texdef_Assign( m_projection, projection, setBasis ); addScale(); } @@ -1014,7 +1014,7 @@ Face( const Face& other, FaceObserver* observer ) : m_shader.attach( *this ); m_plane.copy( other.m_plane ); planepts_assign( m_move_planepts, other.m_move_planepts ); -// m_texdef.setBasis( m_plane.plane3().normal() ); +// m_texdef.setBasis( m_plane.plane3().normal() ); //don't reset basis on face clone planeChanged(); updateFiltered(); } @@ -1220,9 +1220,9 @@ void texdefChanged(){ void GetTexdef( TextureProjection& projection ) const { projection = m_texdef.normalised(); } -void SetTexdef( const TextureProjection& projection, bool resetBasis = false ){ +void SetTexdef( const TextureProjection& projection, bool setBasis = true, bool resetBasis = false ){ undoSave(); - m_texdef.setTexdef( projection ); + m_texdef.setTexdef( projection, setBasis ); if( resetBasis ){ m_texdef.setBasis( m_plane.plane3().normal() ); } diff --git a/radiant/brush_primit.cpp b/radiant/brush_primit.cpp index 0a241d95..f73cb809 100644 --- a/radiant/brush_primit.cpp +++ b/radiant/brush_primit.cpp @@ -1185,14 +1185,14 @@ void BPTexdef_Construct( brushprimit_texdef_t& bp_td, std::size_t width, std::si ConvertTexMatWithDimensions( bp_td.coords, 2, 2, bp_td.coords, width, height ); } -void Texdef_Assign( TextureProjection& projection, const TextureProjection& other ){ +void Texdef_Assign( TextureProjection& projection, const TextureProjection& other, bool setBasis /*= true*/ ){ if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) { BPTexdef_Assign( projection.m_brushprimit_texdef, other.m_brushprimit_texdef ); } else { Texdef_Assign( projection.m_texdef, other.m_texdef ); - if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_VALVE ) { + if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_VALVE && setBasis ) { projection.m_basis_s = other.m_basis_s; projection.m_basis_t = other.m_basis_t; } diff --git a/radiant/brush_primit.h b/radiant/brush_primit.h index 6293bced..9af4adcd 100644 --- a/radiant/brush_primit.h +++ b/radiant/brush_primit.h @@ -101,7 +101,7 @@ void Normal_GetTransform( const Vector3& normal, Matrix4& transform ); void TexDef_Construct_Default( TextureProjection& projection ); -void Texdef_Assign( TextureProjection& projection, const TextureProjection& other ); +void Texdef_Assign( TextureProjection& projection, const TextureProjection& other, bool setBasis = true ); void Texdef_Assign( TextureProjection& projection, const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation ); void Texdef_Shift( TextureProjection& projection, float s, float t ); void Texdef_Scale( TextureProjection& projection, float s, float t ); diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index c85abc1e..82ca2299 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -493,21 +493,23 @@ void ConstructRegionBrushes( scene::Node* brushes[6], const Vector3& region_mins class FaceSetTexdef { const TextureProjection& m_projection; +const bool m_setBasis; +const bool m_resetBasis; public: -FaceSetTexdef( const TextureProjection& projection ) : m_projection( projection ){ +FaceSetTexdef( const TextureProjection& projection, bool setBasis, bool resetBasis ) : m_projection( projection ), m_setBasis( setBasis ), m_resetBasis( resetBasis ){ } void operator()( Face& face ) const { - face.SetTexdef( m_projection, true ); /* reset valve220 basis, once this chain is used for reset only atm */ + face.SetTexdef( m_projection, m_setBasis, m_resetBasis ); } }; -void Scene_BrushSetTexdef_Selected( scene::Graph& graph, const TextureProjection& projection ){ - Scene_ForEachSelectedBrush_ForEachFace( graph, FaceSetTexdef( projection ) ); +void Scene_BrushSetTexdef_Selected( scene::Graph& graph, const TextureProjection& projection, bool setBasis, bool resetBasis ){ + Scene_ForEachSelectedBrush_ForEachFace( graph, FaceSetTexdef( projection, setBasis, resetBasis ) ); SceneChangeNotify(); } -void Scene_BrushSetTexdef_Component_Selected( scene::Graph& graph, const TextureProjection& projection ){ - Scene_ForEachSelectedBrushFace( graph, FaceSetTexdef( projection ) ); +void Scene_BrushSetTexdef_Component_Selected( scene::Graph& graph, const TextureProjection& projection, bool setBasis, bool resetBasis ){ + Scene_ForEachSelectedBrushFace( graph, FaceSetTexdef( projection, setBasis, resetBasis ) ); SceneChangeNotify(); } diff --git a/radiant/brushmanip.h b/radiant/brushmanip.h index 21fbfd1e..47aebfbe 100644 --- a/radiant/brushmanip.h +++ b/radiant/brushmanip.h @@ -47,8 +47,8 @@ void Scene_BrushConstructPrefab( scene::Graph& graph, EBrushPrefab type, std::si class AABB; void Scene_BrushResize_Selected( scene::Graph& graph, const AABB& bounds, const char* shader ); void Brush_ConstructPlacehoderCuboid( scene::Node& node, const AABB& bounds ); -void Scene_BrushSetTexdef_Selected( scene::Graph& graph, const TextureProjection& projection ); -void Scene_BrushSetTexdef_Component_Selected( scene::Graph& graph, const TextureProjection& projection ); +void Scene_BrushSetTexdef_Selected( scene::Graph& graph, const TextureProjection& projection, bool setBasis, bool resetBasis ); +void Scene_BrushSetTexdef_Component_Selected( scene::Graph& graph, const TextureProjection& projection, bool setBasis, bool resetBasis ); void Scene_BrushSetTexdef_Selected( scene::Graph& graph, const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation ); void Scene_BrushSetTexdef_Component_Selected( scene::Graph& graph, const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation ); void Scene_BrushGetTexdef_Selected( scene::Graph& graph, TextureProjection& projection ); diff --git a/radiant/select.cpp b/radiant/select.cpp index 9ba406b4..744e608c 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -517,11 +517,11 @@ void Select_SetShader_Undo( const char* shader ){ } } -void Select_SetTexdef( const TextureProjection& projection ){ +void Select_SetTexdef( const TextureProjection& projection, bool setBasis /*= true*/, bool resetBasis /*= false*/ ){ if ( GlobalSelectionSystem().Mode() != SelectionSystem::eComponent ) { - Scene_BrushSetTexdef_Selected( GlobalSceneGraph(), projection ); + Scene_BrushSetTexdef_Selected( GlobalSceneGraph(), projection, setBasis, resetBasis ); } - Scene_BrushSetTexdef_Component_Selected( GlobalSceneGraph(), projection ); + Scene_BrushSetTexdef_Component_Selected( GlobalSceneGraph(), projection, setBasis, resetBasis ); } void Select_SetTexdef( const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation ){ diff --git a/radiant/select.h b/radiant/select.h index 16e3050b..30922662 100644 --- a/radiant/select.h +++ b/radiant/select.h @@ -58,7 +58,7 @@ void Select_SetShader( const char* shader ); void Select_SetShader_Undo( const char* shader ); class TextureProjection; -void Select_SetTexdef( const TextureProjection& projection ); +void Select_SetTexdef( const TextureProjection& projection, bool setBasis = true, bool resetBasis = false ); void Select_SetTexdef( const float* hShift, const float* vShift, const float* hScale, const float* vScale, const float* rotation ); class ContentsFlagsValue; diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index df2518bf..bd12f742 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -541,7 +541,7 @@ static void OnBtnReset( GtkWidget *widget, gpointer data ){ } #endif - Select_SetTexdef( projection ); + Select_SetTexdef( projection, false, true ); } static void OnBtnProject( GtkWidget *widget, gpointer data ){ @@ -1519,7 +1519,7 @@ typedef Function4 FaceSetTexture; @@ -1693,7 +1693,7 @@ void Scene_applyClosestTexture( SelectionTest& test, bool seamless, bool project } else if( !seamless ){ Select_SetShader( TextureBrowser_GetSelectedShader( g_TextureBrowser ) ); - Select_SetTexdef( g_faceTextureClipboard.m_projection ); + Select_SetTexdef( g_faceTextureClipboard.m_projection, false, false ); } }