Hi all, Below is a pic of my FPSC Entity Importer, But it dosnt always import textures like in the pic below, im wondering if anyone knows exactly how to know what the texture image is.
Heres what im using so far, as i said, this works, but dosnt always import the texture.
Function SelectFPSCEntity()
` Get the FPSC Install Directory...
FPSCPath$ = Get Registry$("SOFTWARE\Dark Basic\FPSCREATOR","INSTALL-PATH")
If FPSCPath$ = "" Then ErrorMessage "FPSCreator is not installed..." : ExitFunction ""
FPSCPath$ = FPSCPath$+"Files\entitybank\"
` Create Window
g1 = CreateWindow((Screen Width()/2)-320,(Screen Height()/2)-240,640,480,"Import FPSC Entity...",WINDOW_FIXED,WINDOW_TOOLWINDOW,1,DBWin)
g2 = CreateTreeView( 0,0,200,440,g1) : ` SetGadgetAlign g2,ALIGN_LEFT
g3 = CreateListView(201,0,420,440,g1) : ` SetGadgetAlign g3,ALIGN_RIGHT
g4 = CreateLabel(10,455,640,15,"Loading Thumbnails...",g1) : SetGadgetAlign g4,ALIGN_BOTTOM
g5 = CreateImageList(64,64)
AddTreeViewFolderList(FPSCPath$,g2,0)
PaintGadget g1
SelectFPSCEntity_NewPath: ` Called when New Dir Selected
If LoadedCount > 0
For i = 0 to LoadedCount
RemoveImageListItem g5,0
RemoveListViewItem g3,0
Next i : EndIf
LoadedCount = 0
` Load Thumbnails (64x64)
SetGadgetText g4,"Loading Thumbnails..."
Set Dir FPSCPath$+FPSCPath2$
Perform Checklist For Files
Count = Checklist Quantity()
For i = 1 to Count : Temp$ = "" : Img$ = ""
If Fast Upper$(Fast Right$(Checklist String$(i),4)) = ".FPE"
Temp$ = Fast Left$(Checklist String$(i),Len(Checklist String$(i))-3)
If File Exist(Temp$+"bmp") = 1 Then Img$ = Temp$+"bmp"
If File Exist(Temp$+"tga") = 1 Then Img$ = Temp$+"tga"
If File Exist(Temp$+"dds") = 1 Then Img$ = Temp$+"dds"
If File Exist(Temp$+"jpg") = 1 Then Img$ = Temp$+"jpg"
If File Exist(Temp$+"dib") = 1 Then Img$ = Temp$+"dib"
If File Exist(Temp$+"png") = 1 Then Img$ = Temp$+"png"
If Img$ <> "" Then Img = LoadAndScaleImage(Img$,64,64) : AddImageListItem g5,Img : Delete Image Img
EndIf : Next i
SetListViewImageList g3,g5
` Add Items.
SetGadgetText g4,"Loading Thumbnails..."
For i = 1 to Count
If Fast Upper$(Fast Right$(Checklist String$(i),4)) = ".FPE"
AddListViewItem g3,Fast Left$(Checklist String$(i),Fast Len(Checklist String$(i))-4),LoadedCount
Inc LoadedCount,1
EndIf : Next i
SetGadgetText g4,Str$(LoadedCount)+" Models Found, (Double Click Thumbnail to Load Object)"
` Update Window
Do : GetEvent
If EventSource() = g2 And EventType() = LEFTBUTTON_UP : FPSCPath2$ = FPSCEntitySelector_GetFullPath() : Goto SelectFPSCEntity_NewPath : EndIf
If EventSource() = g3 And EventType() = MOUSE_CLICK : If SelectedListViewItem(g3) > -1 : RV$ = GetListViewItemText(g3,SelectedListViewItem(g3),0) : Exit : EndIf : EndIf
If EventSource() = g1 And EventType() = WINDOW_CLOSE : RV$ = "" : Exit : EndIf
Loop
` Load Object
If RV$ <> ""
Fn = Find Free File()
Open To Read Fn,RV$+".fpe"
Repeat s$ = ReadString(Fn)
Until Fast Left$(Fast Upper$(s$),5) = "MODEL" Or File End(Fn) = 1
Close File Fn
Split String s$,"="
File$ = FPSCPath$+FPSCPath2$+Trim$(Get Split Word$(2)) : If File Exist(File$) = 1 : Obj = LoadObject(File$) : EndIf
EndIf
` Load Texture
If RV$ <> ""
Fn = Find Free File()
Open To Read Fn,RV$+".fpe"
Repeat s$ = ReadString(Fn)
Until Fast Left$(Fast Upper$(s$),5) = "TEXTURED" Or File End(Fn) = 1
Close File Fn
Split String s$,"="
File$ = FPSCPath$+FPSCPath2$+Trim$(Get Split Word$(2)) : If File Exist(File$) = 1 : TextureObject(Obj,File$) : EndIf
EndIf
` CleanUp
g1 = DeleteGadget(g1)
EndFunction RV$
Function FPSCEntitySelector_GetFullPath()
GUM = GadgetUnderMouse()
n = SelectedTreeViewItem(GUM)
Path$ = GetTreeViewItemText(GUM,n)+"\"
While GetTreeViewParent(GUM,n) > 0
n = GetTreeViewParent(GUM,n)
Path$ = GetTreeViewItemText(GUM,n)+"\"+Path$
EndWhile
EndFunction Path$
Heres the screenshot showing the problem