Someone shoot Evangel.
Alright, the reason i need a cmp importer is so when i load up a THN file, i can also load up the object m0dels. This way i don't have to use dummy m0dels. The program is still in production, Although i'm not entirely sure i can make the 3D view, i'm absolutly positive i can make the list view, tree view, and advanced view, all of which will be helpful in creating a THN. Heres some of the code i'm using to access a THN file (it only loads the scene type, but the other types are soon to follow):
Option Explicit
Dim inttemp As Integer
Dim STrtemp As String
Public NUM_SCENE As Integer
Public NUM_COMPOUND As Integer
Public NUM_PSYS As Integer
Public NUM_CAMERA As Integer
Public NUM_LIGHT As Integer
Public NUM_MONITER As Integer
Public NUM_MOTION As Integer
Public NUM_MARKER As Integer
Public Sub ReadTHN(Path As String)
Dim iff As Integer, blnok As Boolean, strname As String, intbox As Integer
iff = FreeFile()
'reset variables
NUM_SCENE = 0
NUM_COMPOUND = 0
NUM_PSYS = 0
NUM_CAMERA = 0
NUM_LIGHT = 0
NUM_MONITER = 0
NUM_MOTION = 0
NUM_MARKER = 0
inttemp = 0
intbox = 0
Open Path For Input As #iff
'get duration
Line Input #iff, STrtemp
STrtemp = Replace(STrtemp, "duration=", vbNullString)
THNFile.Duration = STrtemp
'Get rid of blank line
Line Input #iff, STrtemp
'Get Entities
Do Until blnok = True
'Take care of 2 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp
'Store Name
Line Input #iff, strname
strname = Replace(strname, "entity_name=", vbNullString)
strname = Trim(strname)
'Get Type
Line Input #iff, STrtemp
STrtemp = Replace(STrtemp, "type=", vbNullString)
STrtemp = Trim(STrtemp)
Select Case STrtemp
Case "SCENE":
NUM_SCENE = NUM_SCENE + 1
'get Props
With THNFile.Entities(inttemp).Scenes(NUM_SCENE)
.type = STrtemp
Line Input #iff, STrtemp
.Template = STrtemp
Line Input #iff, STrtemp
.Lightgroup = STrtemp
Line Input #iff, STrtemp
.Sortgroup = STrtemp
Line Input #iff, STrtemp
.UserFlag = STrtemp
'2 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp
'pos values
Line Input #iff, STrtemp
.SpatialProps.pos.Value1 = STrtemp
Line Input #iff, STrtemp
.SpatialProps.pos.Value2 = STrtemp
Line Input #iff, STrtemp
.SpatialProps.pos.Value3 = STrtemp
'3 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp
Line Input #iff, STrtemp
'orient values
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup1.Value1 = STrtemp
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup1.Value2 = STrtemp
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup1.Value3 = STrtemp
'2 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup2.Value1 = STrtemp
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup2.Value2 = STrtemp
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup2.Value3 = STrtemp
'2 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup3.Value1 = STrtemp
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup3.Value2 = STrtemp
Line Input #iff, STrtemp
.SpatialProps.orient.ValueGroup3.Value3 = STrtemp
'3 useless lines
Line Input #iff, STrtemp
Line Input #iff, STrtemp
Line Input #iff, STrtemp
'up and front values
Line Input #iff, STrtemp
.Up = STrtemp
Line Input #iff, STrtemp
.Front = STrtemp
'useless line
Line Input #iff, STrtemp
'ambient values
Line Input #iff, STrtemp
.Ambient.Value1 = STrtemp
Line Input #iff, STrtemp
.Ambient.Value2 = STrtemp
Line Input #iff, STrtemp
.Ambient.Value3 = STrtemp
'useless line
Line Input #iff, STrtemp
End With
Case "COMPOUND":
Case Else:
intbox = MsgBox("Unknown Entity Type " & Chr(34) & STrtemp & Chr(34) & " Encountered in Entity " & (inttemp + 1) & " - " & strname, vbExclamation + vbApplicationModal + vbOKCancel, "Unknown Entry"
'if no, cancel THN file load
If intbox = 0 Then
WipeTHNvar
Exit Sub
End If
End Select
inttemp = inttemp + 1
Loop
'Get Events
Close #iff
End Sub
NOTE: This stupid forum takes out spaces x.x
And a screenie of the 3D interface (kudos to foxer for designing it):
Interface
EDIT: The other guys didn't deliever eh? Well i'll promise you i'll at LEAST get that advanced view working. That alone should make THN editing much easier.
Edited by - Blackhole2001 on 8/14/2005 10:44:22 AM
Please, if you are going to post pictures make them small, if they are large please post them as links as I've done above - Parabolix
Edited by - parabolix on 8/14/2005 5:07:36 PM
Edited by - Finalday on 8/15/2005 4:53:53 AM