Peer-to-Peer Forum

 

Login Register    
Finding missing textures in a large number of *flt files?
Posted: 08 April 2009 07:27 AM  
Newbie
Rank
Total Posts:  1
Joined  2009-04-08

Hello to all the forum members smile I’ve been using Creator(and flt files)for couple of months now, and was wondering is there a tool or plugin that can check a number of *flt files (say,100) for missing textures, and list the names of the texture files that are not found on the disk?

 
Posted: 16 April 2009 02:12 PM   [ # 1 ]  
Moderator
RankRankRankRank
Total Posts:  373
Joined  2008-07-03

Hi Jazznazz,

This type of search would be very easy to use Creator’s OpenFlight Scripting to accomplish. Whenever something is needed to be done on a lot of models, scripting is usually the best answer. To show how this could be accomplished, I have written a script to do exactly this.  The script below will take a directory as input, and analyze all the flt files in that directory. It outputs all texture files that are referenced in the geometry, but not included on disk.  However, please note that what you want may differ slightly from what this script does. for instance, it does not check to see what textures are in the palette and make sure they exist on disk. It also doesn’t check to see what textures are referenced by new materials. So if you have a missing texture in the palette and it is not assigned to a polygon, or if you have a missing texture assigned to an extended material, these missing textures will be missed.

Here is the script. Feel free to edit this to address your needs.  Just copy and paste into the OpenFlight Script Editor inside of Creator. (It will only run in Creator due to API Level 4 call to prompt for a folder)

import osglob

def Prefunc 
(dbparentrecdata):
    
type mgGetCode(rec)
    if (
type == fltPolygon):
        
outs mgGetAttList (recfltPolyTexturefltLayerTexture1,fltLayerTexture2fltLayerTexture3fltLayerTexture4fltLayerTexture5fltLayerTexture6fltLayerTexture7 )
        for 
i in range(1,8):
            
idx i*2
            name 
mgGetTextureName (dbouts[idx])
            if ( 
name ):
                if ( 
not os.path.exists(name) ):
                    print 
"  --Texture Missing: " name
                       
    
return MG_TRUE

    
status
folder mgPromptDialogFolder (None"Select Directory to Process"None)
for 
filename in glob.globos.path.join(folder'*.flt') ):
    
db mgOpenDb (filename)
    print 
"  Processing "filename
    mgWalk 
(dbPrefuncNoneNoneMWALK_ON)
    
mgCloseDb (db)

print 
"Finished Processing Directory" 
 
Posted: 20 September 2010 01:46 PM   [ # 2 ]  
Moderator
RankRankRankRank
Total Posts:  590
Joined  2008-07-02

Hello to all the forum members I’ve been using Creator(and flt files)for couple of months now, and was wondering is there a tool or plugin that can check a number of *flt files (say,100) for missing textures, and list the names of the texture files that are not found on the disk?

You might also try the Analyze Models command in Creator (new in Creator 4.0 in the File menu).  This tool can print out missing textures AND fix them for many OpenFlight files simultaneously.