Changeset 2235


Ignore:
Timestamp:
03/12/07 14:06:28 (17 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/GTPSceneExport.mel

    r2219 r2235  
    146146                eval ("ogreExport" + $options); 
    147147        } 
    148              
     148                 
    149149        fclose $fileId;  
     150         
     151        int $exportPathMapMaterials = `checkBox -query -value ExportPMMat`; 
     152        if($exportPathMapMaterials) 
     153        { 
     154                string $materialFile = (`textField -query -text PMMatFile`); 
     155                string $materialFileName = encodeString(toNativePath($outputDir + $materialFile)); 
     156                 
     157                $PMMatfileId = `fopen $materialFileName "w"`; 
     158                 
     159                fprint $PMMatfileId "<materials>\n";   
     160                 
     161                string $materials[] = `ls -type lambert`; 
     162                for($i = 0; $i < size($materials); $i++) 
     163                { 
     164                        select $materials[$i]; 
     165                        fprint $PMMatfileId ("<material name=\"" + $materials[$i] +"\" "); 
     166                        string $textureFiles[] = `listConnections -t file`; 
     167                        if(size($textureFiles) > 0) 
     168                        {        
     169                                select $textureFiles[0]; 
     170                                $textureName = `getAttr .fileTextureName`; 
     171                                fprint $PMMatfileId ("texture=\"" +  basename($textureName, "") + "\" "); 
     172                        } 
     173                        else 
     174                        { 
     175                                float $baseColor[] =  `getAttr .color`; 
     176                                string $colorString = $baseColor[0] + " " + $baseColor[1] + " " + $baseColor[2];                         
     177                                fprint $PMMatfileId ("color=\"" + $colorString + "\" "); 
     178                        } 
     179                        fprint $PMMatfileId "/>\n";                                                                      
     180                } 
     181                fprint $PMMatfileId "</materials>\n";  
     182                fclose $PMMatfileId; 
     183        } 
    150184} 
    151185 
     
    179213        int $exportPM = `checkBox -q -v ExportPMAttr`; 
    180214        text -edit -enable $exportPM PMPathLabel; 
    181         textField -edit -enable $exportPM PMPath;        
     215        textField -edit -enable $exportPM PMPath; 
     216         
     217        int $exportPMMat = `checkBox -q -v ExportPMMat`; 
     218        text -edit -enable $exportPMMat PMMatFileLabel; 
     219        textField -edit -enable $exportPMMat PMMatFile;  
    182220} 
    183221 
     
    185223{ 
    186224        string $sceneFile    = `file -query -sceneName`; 
     225        string $sceneDir    = dirname($sceneFile); 
    187226        string $mayaFile     = basename($sceneFile, "." + fileExtension($sceneFile)); 
    188227        if($mayaFile == "") 
     
    217256                        -parent GTPGeneralControlsLayout  
    218257                        -width 305 
     258                        -text $sceneDir 
    219259                        OutputDirectory; 
    220260                text   
     
    333373                        -text "prm" 
    334374                        PMPath; 
    335          
     375                checkBox 
     376                        -parent PathMapControlsLayout 
     377                        -value false  
     378                        -changeCommand "formatGTPExportUI" 
     379                        -label "Export Path Map Materials" 
     380                        ExportPMMat; 
     381                text 
     382                        -parent PathMapControlsLayout 
     383                        -label "Path Map Material File" 
     384                        -enable false 
     385                        PMMatFileLabel; 
     386                textField 
     387                        -parent PathMapControlsLayout 
     388                        -width 305 
     389                        -enable false 
     390                        -text ($mayaFile + ".materials") 
     391                        PMMatFile;       
    336392        button 
    337393                -parent GTPSceneExportMainLayout  
Note: See TracChangeset for help on using the changeset viewer.