ScriptSpot

Forum topic · General Scripting

pftrack ASCII text file to max point helpers

By splinterD · 2011-06-19

Description

hi guys
im looking for a way to import the tracking data of a face (deforming)
from pftrack 2011 to 3ds max , i cant find any easy way to export 2d tracking data, part from the export the creates a ASCII text file, witch i cant seam to import to max or after effects .

i was wondering is thete a way to import the txt file via max script to max ???
this is a sample of how the file looks like:

# "Name"
# clipNumber
# frameCount
# frame, xpos, ypos, similarity

"Null_001"
1
924
0 192.000000 510.750000 1.000000
1 192.000000 510.750000 -1.000000
2 190.747025 508.957520 -1.000000
3 190.710312 508.697418 -1.000000
4 190.808624 508.255066 -1.000000
5 191.121292 508.484161 -1.000000
6 191.931137 508.433838 -1.000000
7 191.155853 508.437500 0.936175
8 190.832977 509.182068 -1.000000
9 190.746475 509.122803 -1.000000
10 190.645721 509.392761 -1.000000
11 190.671677 509.316772 -1.000000
12 190.638367 509.636078 -1.000000
13 190.457062 510.084320 -1.000000
14 190.396042 510.148041 -1.000000
15 190.374603 510.218750 0.920438
16 190.383316 510.290100 -1.000000
17 190.386795 510.239838 -1.000000
18 190.396088 510.262604 -1.000000
19 190.432693 510.103455 -1.000000
20 190.427826 509.829803 -1.000000
21 190.465027 509.706207 -1.000000
22 190.624603 509.625000 0.920398

----------------

i really hope you guys can help

Comments (1)

quick help

Anubis · 2011-06-20

am not at home, so its not tested...
but try this...

file = openFile "C:\\data.txt" mode:"r"

while not eof file do
(
	if readChar file == "#" do skipToNextLine file
	skipToString file "\""
	local _pt = Point name:(readDelimitedString file "\"")
	readLine file
	local frameCount = readValue file
	with animate on 
	(
		for i = 1 to frameCount do
		(
			at time readValue file
				_pt.pos = [readValue file, readValue file, readValue file]
		)
	)
)

close file
free file