Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Little tool to list textures from .DAE
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#7
RE: Little tool to list textures from .DAE

I see. Yes, vb6.

Spoiler below!
PHP Code: (Select All)
Private Sub GetFileListFromFile(sFile As String)


Dim sContent As String
Dim sExt 
As String
Dim sMatchStart 
As Long
Dim sMatchEnd 
As Long
Dim lContentStart 
As Long

 Open sFile 
For Input As #1
 
sContent Input$(LOF(1), 1)

Do 
Until Len(sContent) = 0
                
                    
'looks for file tags
                    sMatchStart = InStr(1, sContent, "<init_from>")
                    sMatchEnd = InStr(1, sContent, "</init_from>")
                    
                    '
saves where match was foundto remove later
                    lContentStart 
sMatchEnd Len("</init_from>")
                    
                    
'if tags were found
                    If sMatchStart > 0 And sMatchEnd > 0 Then
                        
                        '
get the file path
                        sMatchStart 
sMatchStart Len("<init_from>")
                        
sFileName Mid(sContentsMatchStartsMatchEnd sMatchStart)
                    
                        
'determines which slash is used
                        sMatchStart = InStrRev(sFileName, "/", -1)
                        sMatchEnd = InStrRev(sFileName, "\", -1)
                        
                        sMatchStart = IIf(sMatchStart > sMatchEnd, sMatchStart, sMatchEnd)
                        
                        '
slashes found in the path
                        
If sMatchStart 0 Then
                            
'takes only the file name, starting from the first slash+1
                            sFileName = Mid(sFileName, sMatchStart + 1, Len(sFileName))
                        Else
                        End If
                            
                        '
locates a char for extension
                        sMatchStart 
InStrRev(sFileName".", -1)
                        
                        
'. found, remove extension
                        If sMatchStart > 0 Then
                            sFileName = Mid(sFileName, 1, sMatchStart - 1)
                            
                            '
adds .mat
                            sFileName 
sFileName ".mat"
                            
                            'adds it to the list
                            List1.AddItem sFileName
                        Else
                            '
no point foundfile may not have extensionadd to list anyways
                            List1
.AddItem sFileName
                        End 
If
                        

                    Else
                        
'no more tags were found
                        '
stops reading file
                        sContent 
""
                    
                    
End If
                    
                    
'remove from content var all previous content before the match
                    sContent = Mid(sContent, lContentStart, Len(sContent))
                       
Loop

Close #1
                
End Sub 


(This post was last modified: 08-08-2014, 04:07 PM by Daemian.)
08-08-2014, 04:03 PM
Find


Messages In This Thread
RE: Little tool to list textures from .DAE - by Daemian - 08-08-2014, 04:03 PM



Users browsing this thread: 1 Guest(s)