Did my message never reached the list ? :
17.10.2005 17:29
//
-----------------------------------------------------------------------------
Hi Stefan,
its pretty easy to parse such file. The first field, before the column
is the frame number, second field before the coma is the X value, then
after the coma the Y value.
Use this kind of script ( its a ugly vbscript but it works ):
' ---[ Parse File ]-------------------------------------------------------
LogMessage CNS_NAME & " >>> Parsing File.."
Dim aXKeys,aYKeys
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.GetFile( "YourFileName" )
Set oTS = oFile.OpenAsTextStream( 1, 0 )
nbKeys = 1
Redim aXKeys(0)
Redim aYKeys(0)
Do While oTS.AtEndOfStream <> True
Redim Preserve aXKeys(nbKeys)
Redim Preserve aYKeys(nbKeys)
strLine = oTS.ReadLine
iPos1 = InStr(strLine,":")
iFrameNumber = Left(strLine,iPos1-1)
iPos2 = InStr(strLine,",")
fXKey = Mid(strLine,iPos1+1,iPos2-1-iPos1)
fYKey = Mid(strLine,iPos2+1)
LogMessage strLine &" ( k:"& CInt(iFrameNumber) &" x:"& CDbl(fXKey) &" y:"& CDbl(fYKey) &")"
'
aXKeys(nbKeys-1) = CInt(iFrameNumber)
aXKeys(nbKeys) = (-1)*CDbl(fXKey)
'
aYKeys(nbKeys-1) = CInt(iFrameNumber)
aYKeys(nbKeys) = (-1)*CDbl(fYKey)
'
nbKeys = nbKeys + 2
Loop
oTS.Close()
The (-1)* has to be set or not depending of if you want to compensate
or not the tracker.
Then you can set keyframes with the arrays:
' ---[ Create FCurves ]---------------------------------------------------
oNull.Parameters("posx").AddFCurve2 aXKeys
oNull.Parameters("posy").AddFCurve2 aYKeys
Be aware however that if the flame artist used some offset somewhere
in its tree, then the result wont match.
*Allways* ask the flame artist about any offset prior to use such files!
Hope this helps.
--
guy rabiller | 3d technical director (at) LaMaison
//
-----------------------------------------------------------------------------
--
guy rabiller | 3d technical director (at) LaMaison
Stefan Andersson wrote:
On 10/19/05, kim aldis <kim(at)cg-soup.com> wrote:
I was going to try and look at this earlier but it's been a bit of a week.
This weekend, though, for sure.
Luc's little parser worked except that I wasn't able to put the
keyframes onto the null, but I guess that would be a minor thing to
fix. I haven't had time to look into it either yet... too much work...
ack...
It's a catch22 situation as always. Not enough time to do the research
to make the workflow faster, because you have too much work since you
haven't had time to do research... *stefan mumbles on*
/stefan
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
in body: unsubscribe xsi