Skip to content

Commit 7544d37

Browse files
author
Nik Ska
committed
+boujou
1 parent 93ea77c commit 7544d37

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

importBoujouTracking.jsx

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
//Import Boujou 2d tracks to AE
2+
//CC-BY Nik Ska, 2014
3+
4+
var parseBoujou = this;
5+
6+
parseBoujou.go = function(){
7+
8+
function createNull(comp, _name){
9+
var newTrackNull = comp.layers.addNull();
10+
newTrackNull.name = "Boujou Null_" + _name;
11+
newTrackNull.threeDLayer = true;
12+
newTrackNull.label = 10;
13+
return newTrackNull;
14+
}
15+
16+
var textFile = File.openDialog ("Choose a tracking data file","*.txt");
17+
18+
if (textFile != null) {
19+
var textLines = [];
20+
textFile.open("r");
21+
22+
while (!textFile.eof){
23+
//reading file into lines
24+
textLines.push(textFile.readln());
25+
}
26+
27+
var activeComp = app.project.activeItem;
28+
if(activeComp && activeComp instanceof CompItem){
29+
app.beginUndoGroup("Parse Boujou");
30+
31+
//regex to match X/Y and null name
32+
var XYmatch = /(\d+([\.]\d+)?)/g;
33+
var nameMatch = /auto_(\d+)/;
34+
35+
for(var t = 1; t<textLines.length; t++){
36+
if(t>5){
37+
var parsed = textLines[t].match(XYmatch);
38+
var nullNum = textLines[t].match(nameMatch)[1];
39+
//check for existing null
40+
var curNull = activeComp.layer("Boujou Null_"+nullNum);
41+
//create one if there is no null
42+
if(!curNull) curNull = createNull(activeComp, nullNum);
43+
44+
if(parsed){
45+
// $.writeln(textLines[t].match(XYmatch))
46+
// $.writeln(Number(parsed[2]), ", ", Number(parsed[3]));;
47+
48+
curNull.property("ADBE Transform Group").property("ADBE Position").setValueAtTime(Number(parsed[1]-1)*activeComp.frameDuration, [Number(parsed[2]), Number(parsed[3]),0]);
49+
}
50+
}
51+
}
52+
53+
54+
}
55+
56+
app.endUndoGroup();
57+
}
58+
}
59+
60+
parseBoujou.go();

nullsToOne.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if(activeComp && activeComp instanceof CompItem){
1212
var newTrackNull = activeComp.layers.addNull();
1313
newTrackNull.name = "MasterNull";
1414
newTrackNull.threeDLayer = true;
15+
newTrackNull.label = 10;
1516

1617
for(var s = 0; s < sel.length; s++){
1718
t = s*activeComp.frameDuration; //time
@@ -26,6 +27,7 @@ if(activeComp && activeComp instanceof CompItem){
2627
newTrackNull.property("ADBE Transform Group").property("ADBE Scale").setValueAtTime(t, currentNull.property("ADBE Transform Group").property("ADBE Scale").value);
2728

2829
if(sel[s].threeDLayer){
30+
//for 3D layers also copy orientation and X/Y rotations
2931
newTrackNull.property("ADBE Transform Group").property("ADBE Rotate X").setValueAtTime(t, currentNull.property("ADBE Transform Group").property("ADBE Rotate X").value);
3032

3133
newTrackNull.property("ADBE Transform Group").property("ADBE Rotate Y").setValueAtTime(t, currentNull.property("ADBE Transform Group").property("ADBE Rotate Y").value);

0 commit comments

Comments
 (0)