|
@@ -77,10 +77,16 @@ function init() {
|
|
|
saveFile.set("sequence_autosave.json");
|
|
|
saveFile.setAttribute("readonly", true);
|
|
|
// importSequenceFile(saveFile);
|
|
|
- // layers = local.getChild("values").keys.layers ;
|
|
|
- // script.log(root.sequences.truc.layers.speed.getType());
|
|
|
- printMethodsAndProperties(root.sequences.truc.layers.audio);
|
|
|
+
|
|
|
+ // var audioLayer = root.sequences.truc.layers.audio ;
|
|
|
+ // var newClip = audioLayer.clips.addItem();
|
|
|
+ // newClip.filePath.set("/home/titi/work/media/Sons/Mono/Aaaah.wav");
|
|
|
+ // newClip.setName("testAudio");
|
|
|
+ // newClip.startTime.set(12);
|
|
|
+
|
|
|
+ // printMethodsAndProperties(newClip);
|
|
|
// script.log(local.getChild("values").groups.group0.cue.get());
|
|
|
+
|
|
|
//test if a sequence is already choosen else refresh and unlock sequence enum
|
|
|
sequence = local.getChild("parameters").sequence.getKey();
|
|
|
// var sequenceIndex = local.getChild("parameters").sequence.get();
|
|
@@ -147,8 +153,8 @@ function update(deltaTime){
|
|
|
|
|
|
function printMethodsAndProperties(obj){
|
|
|
script.log(" ");
|
|
|
- var name = obj.getControlAddress() == undefined ? "object" : obj.getControlAddress();
|
|
|
- // var name = "object";
|
|
|
+ // var name = obj.getControlAddress() == undefined ? "object" : obj.getControlAddress();
|
|
|
+ var name = "object";
|
|
|
script.log(" METHODS OF " + name);
|
|
|
var methods = util.getObjectMethods(obj);
|
|
|
for(var i=0 ; i<methods.length ; i++){
|
|
@@ -388,15 +394,23 @@ function exportSequenceFile(fileObj){
|
|
|
exportLayer["type"] = values.keys.layerTypes.getChild(layersList[i]).get();
|
|
|
if (currentLayersKeys.length){
|
|
|
for(var j=0; j<currentLayersKeys.length; j++){
|
|
|
-
|
|
|
- if(currentLayersKeys[j]!="type"){
|
|
|
- script.log(currentLayersKeys[j]);
|
|
|
- // script.log(groupsList[i]+ " "+ currentGroupLayers[j]);
|
|
|
- exportLayer[currentLayersKeys[j]] = {key:"", value:0., time:0.};
|
|
|
- exportLayer[currentLayersKeys[j]].value = currentLayer.getChild(currentLayersKeys[j]).value.get();
|
|
|
- exportLayer[currentLayersKeys[j]].key = currentLayer.getChild(currentLayersKeys[j]).name;
|
|
|
- exportLayer[currentLayersKeys[j]].time = currentLayer.getChild(currentLayersKeys[j]).time.get();
|
|
|
+ if (exportLayer["type"]!= "Audio"){
|
|
|
+ if(currentLayersKeys[j]!="type"){
|
|
|
+ script.log(currentLayersKeys[j]);
|
|
|
+ // script.log(groupsList[i]+ " "+ currentGroupLayers[j]);
|
|
|
+ exportLayer[currentLayersKeys[j]] = {key:"", value:0., time:0.};
|
|
|
+ exportLayer[currentLayersKeys[j]].value = currentLayer.getChild(currentLayersKeys[j]).value.get();
|
|
|
+ exportLayer[currentLayersKeys[j]].key = currentLayer.getChild(currentLayersKeys[j]).name;
|
|
|
+ exportLayer[currentLayersKeys[j]].time = currentLayer.getChild(currentLayersKeys[j]).time.get();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ exportLayer[currentLayersKeys[j]] = {clip:"", filePath:0., startTime:0.};
|
|
|
+ exportLayer[currentLayersKeys[j]].filePath = currentLayer.getChild(currentLayersKeys[j]).filePath.get();
|
|
|
+ exportLayer[currentLayersKeys[j]].clip = currentLayer.getChild(currentLayersKeys[j]).name;
|
|
|
+ exportLayer[currentLayersKeys[j]].startTime = currentLayer.getChild(currentLayersKeys[j]).startTime.get();
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -547,37 +561,74 @@ function struct_buildValuesFromSeq(){
|
|
|
|
|
|
if(layersList.length){
|
|
|
for(var layerIndex=0; layerIndex<layersList.length; layerIndex++){
|
|
|
-
|
|
|
+ // script.log(layersList[layerIndex]);
|
|
|
var currentLayer = layers.getChild(layersList[layerIndex]);
|
|
|
var keyList = util.getObjectProperties(currentLayer, true, false);
|
|
|
|
|
|
var tl_lay = tl_seq.layers.getItemWithName(layersList[layerIndex]);
|
|
|
var tl_keys;
|
|
|
- if(tl_lay.automation!=undefined){tl_keys = tl_lay.automation.getItems();}
|
|
|
- //rebuild key structure for currentLayer
|
|
|
- if (keyList.length != tl_keys.length){
|
|
|
- var delta = keyList.length-tl_keys.length;
|
|
|
- var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
|
|
|
- delta = Math.abs(delta);
|
|
|
- script.log("keys "+ delta + (addRemove ? " up" : " down"));
|
|
|
- for(var i=0; i<delta; i++){
|
|
|
-
|
|
|
- // script.log(i);
|
|
|
- if(addRemove){
|
|
|
- var newKey = currentLayer.addContainer("newkey"+i);
|
|
|
- newKey.addFloatParameter("time", "position in time", 0., 0.);
|
|
|
- newKey.addFloatParameter("value", "vertical value", 0., 0.);
|
|
|
- newKey.setCollapsed(true);
|
|
|
+
|
|
|
+ //test keys for automation layers
|
|
|
+ if(tl_lay.automation!=undefined){
|
|
|
+ tl_keys = tl_lay.automation.getItems();
|
|
|
+ //rebuild key structure for currentLayer
|
|
|
+ if (keyList.length != tl_keys.length){
|
|
|
+ var delta = keyList.length-tl_keys.length;
|
|
|
+ var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
|
|
|
+ delta = Math.abs(delta);
|
|
|
+ script.log("keys "+ delta + (addRemove ? " up" : " down"));
|
|
|
+ for(var i=0; i<delta; i++){
|
|
|
+
|
|
|
+ // script.log(i);
|
|
|
+ if(addRemove){
|
|
|
+ var newKey = currentLayer.addContainer("newkey"+i);
|
|
|
+ newKey.addFloatParameter("time", "position in time", 0., 0.);
|
|
|
+ newKey.addFloatParameter("value", "vertical value", 0., 0.);
|
|
|
+ newKey.setCollapsed(true);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ script.log(util.getObjectProperties(currentLayer, true, false)[0]);
|
|
|
+ currentLayer.removeContainer(util.getObjectProperties(currentLayer, true, false)[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
- else {
|
|
|
- script.log(util.getObjectProperties(currentLayer, true, false)[0]);
|
|
|
- currentLayer.removeContainer(util.getObjectProperties(currentLayer, true, false)[0]);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ hasUpdated = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //test clips for audio layer
|
|
|
+ var tl_clips ;
|
|
|
+ if(tl_lay.clips!=undefined){
|
|
|
+ tl_clips = tl_lay.clips.getItems();
|
|
|
+ //rebuild key structure for currentLayer, "keyList" holds clips
|
|
|
+ if (keyList.length != tl_clips.length){
|
|
|
+ var delta = keyList.length-tl_clips.length;
|
|
|
+ var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
|
|
|
+ delta = Math.abs(delta);
|
|
|
+ script.log("clips "+ delta + (addRemove ? " up" : " down"));
|
|
|
+ for(var i=0; i<delta; i++){
|
|
|
+
|
|
|
+ // script.log(i);
|
|
|
+ if(addRemove){
|
|
|
+ var newClip = currentLayer.addContainer("newclip"+i);
|
|
|
+ newClip.addFileParameter("File Path", "sound file");
|
|
|
+ newClip.addFloatParameter("start Time", "", 0., 0.);
|
|
|
+ newClip.setCollapsed(true);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ script.log(util.getObjectProperties(currentLayer, true, false)[0]);
|
|
|
+ currentLayer.removeContainer(util.getObjectProperties(currentLayer, true, false)[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ hasUpdated = true;
|
|
|
}
|
|
|
- hasUpdated = true;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
currentLayer = layers.getChild(layersList[layerIndex]);
|
|
|
keyList = util.getObjectProperties(currentLayer, true, false);
|
|
@@ -591,6 +642,15 @@ function struct_buildValuesFromSeq(){
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ if(tl_clips.length){
|
|
|
+ for(var i=0; i<tl_clips.length; i++){
|
|
|
+ var currentKey = currentLayer.getChild(keyList[i]);
|
|
|
+ currentKey.setName(tl_clips[i].name);
|
|
|
+ currentKey.filePath.set(tl_clips[i].filePath.get());
|
|
|
+ currentKey.startTime.set(tl_clips[i].startTime.get());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -710,10 +770,6 @@ function struct_buildValuesFromSeq(){
|
|
|
}
|
|
|
|
|
|
|
|
|
-function struct_rebuildGroupsFromSeq(){
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
|
|
|
// function rebuildValuesStructure() {
|