* Valve220: keep basis on 'paintTexture&Projection' (shift+m3); 'projectTexture' (ctrl+shift+m3) performs basis copy

This commit is contained in:
Garux 2017-11-10 14:56:35 +03:00
parent 618d31bc96
commit 1658f27ee6
8 changed files with 25 additions and 23 deletions

View File

@ -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() );
}

View File

@ -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;
}

View File

@ -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 );

View File

@ -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();
}

View File

@ -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 );

View File

@ -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 ){

View File

@ -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;

View File

@ -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<Face&, const char*, const TextureProjection&, const ContentsFl
void Face_setTexture( Face& face, const char* shader, const TextureProjection& projection, const ContentsFlagsValue& flags ){
face.SetShader( shader );
face.SetTexdef( projection );
face.SetTexdef( projection, false );
face.SetFlags( flags );
}
typedef Function4<Face&, const char*, const TextureProjection&, const ContentsFlagsValue&, void, Face_setTexture> 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 );
}
}