Changeset 449

Show
Ignore:
Timestamp:
12/23/11 08:41:19 (5 months ago)
Author:
Carsten
Message:

CaWE: Pick the material into the Edit Surface Properties dialog even if the rest of the texture details cannot be picked (SI.TexCoordGenMode==Custom).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/CaWE/DialogEditSurfaceProps.cpp

    r304 r449  
    562562    if (Patch!=NULL) 
    563563    { 
     564        Material=Patch->GetMaterial(); 
     565 
    564566        const SurfaceInfoT& SI=Patch->GetSurfaceInfo(); 
    565567 
    566568        if (SI.TexCoordGenMode==Custom) 
    567569        { 
    568             wxMessageBox("The texture information on this Bezier patch is in a custom format that cannot be picked for use in the dialog.\n" 
    569                 "You can fix the problem by assigning new texture information (using the right mouse button) to the patch first."); 
    570             return; 
    571         } 
    572  
    573         m_SpinCtrlScaleX  ->SetValue((SI.TexCoordGenMode==MatFit) ? SI.Scale[0] : 1.0/SI.Scale[0]/Patch->GetMaterial()->GetWidth()); 
    574         m_SpinCtrlScaleY  ->SetValue((SI.TexCoordGenMode==MatFit) ? SI.Scale[1] : 1.0/SI.Scale[1]/Patch->GetMaterial()->GetHeight()); 
    575         m_SpinCtrlShiftX  ->SetValue(SI.Trans[0]*Patch->GetMaterial()->GetWidth()); 
    576         m_SpinCtrlShiftY  ->SetValue(SI.Trans[1]*Patch->GetMaterial()->GetHeight()); 
    577         m_SpinCtrlRotation->SetValue(SI.Rotate); 
    578         m_TexGenModeInfo  ->SetLabel("");   // The proper value is set below. 
    579  
    580         Material=Patch->GetMaterial(); 
    581  
    582         m_CurrentTexGenMode=SI.TexCoordGenMode; 
    583         m_CurrentUAxis=SI.UAxis; 
    584         m_CurrentVAxis=SI.VAxis; 
    585  
    586         UpdateVectorInfo(); 
    587  
    588         switch (m_CurrentTexGenMode) 
    589         { 
    590             case Custom: m_TexGenModeInfo->SetLabel("Mode: Custom"); break; 
    591             case MatFit: m_TexGenModeInfo->SetLabel("Mode: Fit");    break; 
    592             default:     m_TexGenModeInfo->SetLabel("");             break; 
     570            wxMessageBox("The texture information on this Bezier patch is in a custom format that cannot be picked into the dialog.\n" 
     571                "You can fix the problem by assigning new texture information (using the right mouse button) to the patch."); 
     572        } 
     573        else 
     574        { 
     575            m_SpinCtrlScaleX  ->SetValue((SI.TexCoordGenMode==MatFit) ? SI.Scale[0] : 1.0/SI.Scale[0]/Patch->GetMaterial()->GetWidth()); 
     576            m_SpinCtrlScaleY  ->SetValue((SI.TexCoordGenMode==MatFit) ? SI.Scale[1] : 1.0/SI.Scale[1]/Patch->GetMaterial()->GetHeight()); 
     577            m_SpinCtrlShiftX  ->SetValue(SI.Trans[0]*Patch->GetMaterial()->GetWidth()); 
     578            m_SpinCtrlShiftY  ->SetValue(SI.Trans[1]*Patch->GetMaterial()->GetHeight()); 
     579            m_SpinCtrlRotation->SetValue(SI.Rotate); 
     580            m_TexGenModeInfo  ->SetLabel("");   // The proper value is set below. 
     581 
     582            m_CurrentTexGenMode=SI.TexCoordGenMode; 
     583            m_CurrentUAxis=SI.UAxis; 
     584            m_CurrentVAxis=SI.VAxis; 
     585 
     586            UpdateVectorInfo(); 
     587 
     588            switch (m_CurrentTexGenMode) 
     589            { 
     590                case Custom: m_TexGenModeInfo->SetLabel("Mode: Custom"); break; 
     591                case MatFit: m_TexGenModeInfo->SetLabel("Mode: Fit");    break; 
     592                default:     m_TexGenModeInfo->SetLabel("");             break; 
     593            } 
    593594        } 
    594595    }