|
@@ -16,6 +16,7 @@ var syncRatems = 100;
|
|
|
var syncDelta = 0.;
|
|
|
var doSync = false ;
|
|
|
var inibValuesChanged = false ;
|
|
|
+var doSyncKeysCues = false ;
|
|
|
|
|
|
var saveFile = script.addFileParameter("auto save sequence","");
|
|
|
var saveRatems = 30;
|
|
@@ -80,7 +81,7 @@ function init() {
|
|
|
// script.log(root.sequences.truc.viewStartTime.get();)
|
|
|
saveFile.set("sequence_autosave.json");
|
|
|
saveFile.setAttribute("readonly", true);
|
|
|
- //importSequenceFile(saveFile);
|
|
|
+ // importSequenceFile(saveFile);
|
|
|
|
|
|
// var audioLayer = root.sequences.truc.layers.audio ;
|
|
|
// var newClip = audioLayer.clips.addItem();
|
|
@@ -88,7 +89,7 @@ function init() {
|
|
|
// newClip.setName("testAudio");
|
|
|
// newClip.startTime.set(12);
|
|
|
|
|
|
- printMethodsAndProperties(root.sequences.truc);
|
|
|
+ // printMethodsAndProperties(root.sequences.truc);
|
|
|
// script.log(local.getChild("values").groups.group0.cue.get());
|
|
|
|
|
|
//test if a sequence is already choosen else refresh and unlock sequence enum
|
|
@@ -146,12 +147,12 @@ function update(deltaTime){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- saveDelta += deltaTime ;
|
|
|
- if (saveDelta >= saveRatems){
|
|
|
- saveDelta = 0. ;
|
|
|
- exportSequenceFile(saveFile);
|
|
|
- script.log("sequence autosave");
|
|
|
- }
|
|
|
+ // saveDelta += deltaTime ;
|
|
|
+ // if (saveDelta >= saveRatems){
|
|
|
+ // saveDelta = 0. ;
|
|
|
+ // exportSequenceFile(saveFile);
|
|
|
+ // script.log("sequence autosave");
|
|
|
+ // }
|
|
|
|
|
|
followDelta += deltaTime ;
|
|
|
if(followCursor && (followDelta>followRatems)){
|
|
@@ -221,6 +222,8 @@ function moduleParameterChanged(param){
|
|
|
|
|
|
else if (param.is(parametersPath.syncRate)){updateSyncRate();}
|
|
|
|
|
|
+ else if (param.is(parametersPath.monitorKeysCues)){monitorKeysCues();}
|
|
|
+
|
|
|
else if (param.is(parametersPath.clearSequence)){seq_clearSequence();}
|
|
|
|
|
|
else if (param.is(parametersPath.reorderSequence)){seq_reorderSequence();}
|
|
@@ -251,7 +254,13 @@ function updateSyncRate(){
|
|
|
syncRatems = parametersPath.syncRate.get() / 1000.;
|
|
|
script.log("new sync rate : " + syncRatems);
|
|
|
// script.setUpdateRate(syncRatems);
|
|
|
+}
|
|
|
|
|
|
+function monitorKeysCues(){
|
|
|
+ // var parametersPath = local.getChild("parameters") ;
|
|
|
+ doSyncKeysCues = parametersPath.monitorKeysCues.get() ;
|
|
|
+ script.log(doSyncKeysCues ? "syncKeys ON" : "syncKeys OFF" );
|
|
|
+ // script.setUpdateRate(syncRatems);
|
|
|
}
|
|
|
|
|
|
//refresh Enum
|
|
@@ -472,220 +481,274 @@ function moduleValueChanged(value){
|
|
|
}
|
|
|
|
|
|
|
|
|
-//rebuild values.keys structure from sequence
|
|
|
-function struct_buildValuesFromSeq(){
|
|
|
-
|
|
|
- inibValuesChanged = true;
|
|
|
- var hasUpdated = false ;
|
|
|
-
|
|
|
- var tl_seq = root.sequences.getItemWithName(sequence);
|
|
|
-
|
|
|
- if(tl_seq.name!="undefined"){
|
|
|
- //build cues if needed
|
|
|
- var tl_cues = tl_seq.cues.getItems();
|
|
|
- cues = local.getChild("values").keys.cues ;
|
|
|
- var cuesList = util.getObjectProperties(cues, true, false);
|
|
|
- // script.log("cueList : " +cuesList.length);
|
|
|
- // script.log("tl List : " +tl_cues.length);
|
|
|
- if (cuesList.length != tl_cues.length){
|
|
|
-
|
|
|
- var delta = cuesList.length-tl_cues.length;
|
|
|
- var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
|
|
|
-
|
|
|
- delta = Math.abs(delta);
|
|
|
- script.log("cues "+ delta + (addRemove ? " up" : " down"));
|
|
|
- for(var i=0; i<delta; i++){
|
|
|
- // script.log(i);
|
|
|
- if(addRemove){
|
|
|
- var newCue = cues.addContainer("newCue"+i);
|
|
|
- newCue.addFloatParameter("time", "position in time", 0., 0.);
|
|
|
- newCue.setCollapsed(true);
|
|
|
- }
|
|
|
- else {
|
|
|
- // script.log(util.getObjectProperties(cues, true, false)[0]);
|
|
|
- cues.removeContainer(util.getObjectProperties(cues, true, false)[i]);
|
|
|
- }
|
|
|
- // cuesList = ;
|
|
|
-
|
|
|
+function struct_rebuildValues(){
|
|
|
+ //build cues if needed
|
|
|
+ var tl_cues = tl_seq.cues.getItems();
|
|
|
+ cues = local.getChild("values").keys.cues ;
|
|
|
+ var cuesList = util.getObjectProperties(cues, true, false);
|
|
|
+ // script.log("cueList : " +cuesList.length);
|
|
|
+ // script.log("tl List : " +tl_cues.length);
|
|
|
+ if (cuesList.length != tl_cues.length){
|
|
|
+
|
|
|
+ var delta = cuesList.length-tl_cues.length;
|
|
|
+ var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
|
|
|
+
|
|
|
+ delta = Math.abs(delta);
|
|
|
+ script.log("cues "+ delta + (addRemove ? " up" : " down"));
|
|
|
+ for(var i=0; i<delta; i++){
|
|
|
+ // script.log(i);
|
|
|
+ if(addRemove){
|
|
|
+ var newCue = cues.addContainer("newCue"+i);
|
|
|
+ newCue.addFloatParameter("time", "position in time", 0., 0.);
|
|
|
+ newCue.setCollapsed(true);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // script.log(util.getObjectProperties(cues, true, false)[0]);
|
|
|
+ cues.removeContainer(util.getObjectProperties(cues, true, false)[i]);
|
|
|
}
|
|
|
- hasUpdated = true;
|
|
|
+ // cuesList = ;
|
|
|
+
|
|
|
}
|
|
|
+ hasUpdated = true;
|
|
|
+ }
|
|
|
|
|
|
- //update cues
|
|
|
- cues = local.getChild("values").keys.cues ;
|
|
|
- var cuesList = util.getObjectProperties(cues, true, false);
|
|
|
- if(tl_cues.length){
|
|
|
- for (var i=0; i<tl_cues.length; i++){
|
|
|
- var currentCue = cues.getChild(cuesList[i]);
|
|
|
- currentCue.setName(tl_cues[i].name);
|
|
|
- currentCue.time.set(tl_cues[i].time.get());
|
|
|
- }
|
|
|
+ //update cues
|
|
|
+ cues = local.getChild("values").keys.cues ;
|
|
|
+ var cuesList = util.getObjectProperties(cues, true, false);
|
|
|
+ if(tl_cues.length){
|
|
|
+ for (var i=0; i<tl_cues.length; i++){
|
|
|
+ var currentCue = cues.getChild(cuesList[i]);
|
|
|
+ currentCue.setName(tl_cues[i].name);
|
|
|
+ currentCue.time.set(tl_cues[i].time.get());
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- //build layers if needed
|
|
|
- var layersChanged = false ;
|
|
|
- var tl_layers = tl_seq.layers.getItems();
|
|
|
- layers = local.getChild("values").keys.layers ;
|
|
|
- var layersList = util.getObjectProperties(layers, true, false);
|
|
|
- if (layersList.length != tl_layers.length){
|
|
|
- layersChanged = true ;
|
|
|
- var delta = layersList.length-tl_layers.length;
|
|
|
- var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
|
|
|
- delta = Math.abs(delta);
|
|
|
- script.log("layers "+ delta + (addRemove ? " up" : " down"));
|
|
|
- for(var i=0; i<delta; i++){
|
|
|
- // script.log(i);
|
|
|
-
|
|
|
- if(addRemove){
|
|
|
- var newLayer = layers.addContainer("newLayer"+i);
|
|
|
- // newLayer.addFloatParameter("time", "position in time", 0., 0.);
|
|
|
- local.getChild("values").keys.layerTypes.addStringParameter("newLayer"+i, "", "");
|
|
|
- newLayer.setCollapsed(true);
|
|
|
- local.getChild("values").newGroup.layers.addFloatParameter("newLayer"+i, "value for this layer at group creation", 0., 0., 1.);
|
|
|
- // if (tl_layers[i].getType()!="Audio"){
|
|
|
- // local.getChild("values").newGroup.layers.addFloatParameter("newLayer"+i, "value for this layer at group creation", 0., 0., 1.);
|
|
|
- // }
|
|
|
-
|
|
|
- }
|
|
|
- else {
|
|
|
- // script.log(util.getObjectProperties(layers, true, false)[0]);
|
|
|
- layers.removeContainer(util.getObjectProperties(layers, true, false)[i]);
|
|
|
- local.getChild("values").newGroup.layers.removeParameter(util.getObjectProperties(layers, true, false)[i]);
|
|
|
- local.getChild("values").newGroup.layers.setCollapsed(true);
|
|
|
- local.getChild("values").newGroup.layers.setCollapsed(false);
|
|
|
- local.getChild("values").keys.layerTypes.removeParameter(util.getObjectProperties(layers, true, false)[i]);
|
|
|
- local.getChild("values").keys.layerTypes.setCollapsed(true);
|
|
|
- local.getChild("values").keys.layerTypes.setCollapsed(false);
|
|
|
- }
|
|
|
- // cuesList = ;
|
|
|
+
|
|
|
+ //build layers if needed
|
|
|
+ var layersChanged = false ;
|
|
|
+ var tl_layers = tl_seq.layers.getItems();
|
|
|
+ layers = local.getChild("values").keys.layers ;
|
|
|
+ var layersList = util.getObjectProperties(layers, true, false);
|
|
|
+ if (layersList.length != tl_layers.length){
|
|
|
+ layersChanged = true ;
|
|
|
+ var delta = layersList.length-tl_layers.length;
|
|
|
+ var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
|
|
|
+ delta = Math.abs(delta);
|
|
|
+ script.log("layers "+ delta + (addRemove ? " up" : " down"));
|
|
|
+ for(var i=0; i<delta; i++){
|
|
|
+ // script.log(i);
|
|
|
+
|
|
|
+ if(addRemove){
|
|
|
+ var newLayer = layers.addContainer("newLayer"+i);
|
|
|
+ // newLayer.addFloatParameter("time", "position in time", 0., 0.);
|
|
|
+ local.getChild("values").keys.layerTypes.addStringParameter("newLayer"+i, "", "");
|
|
|
+ newLayer.setCollapsed(true);
|
|
|
+ local.getChild("values").newGroup.layers.addFloatParameter("newLayer"+i, "value for this layer at group creation", 0., 0., 1.);
|
|
|
+ // if (tl_layers[i].getType()!="Audio"){
|
|
|
+ // local.getChild("values").newGroup.layers.addFloatParameter("newLayer"+i, "value for this layer at group creation", 0., 0., 1.);
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
|
- hasUpdated = true;
|
|
|
+ else {
|
|
|
+ // script.log(util.getObjectProperties(layers, true, false)[0]);
|
|
|
+ layers.removeContainer(util.getObjectProperties(layers, true, false)[i]);
|
|
|
+ local.getChild("values").newGroup.layers.removeParameter(util.getObjectProperties(layers, true, false)[i]);
|
|
|
+ local.getChild("values").newGroup.layers.setCollapsed(true);
|
|
|
+ local.getChild("values").newGroup.layers.setCollapsed(false);
|
|
|
+ local.getChild("values").keys.layerTypes.removeParameter(util.getObjectProperties(layers, true, false)[i]);
|
|
|
+ local.getChild("values").keys.layerTypes.setCollapsed(true);
|
|
|
+ local.getChild("values").keys.layerTypes.setCollapsed(false);
|
|
|
+ }
|
|
|
+ // cuesList = ;
|
|
|
+
|
|
|
}
|
|
|
- //update layers value if there was a change in structure
|
|
|
- if(layersChanged){
|
|
|
- layers = local.getChild("values").keys.layers ;
|
|
|
- var layerList = util.getObjectProperties(layers, true, false);
|
|
|
- layerTypes = local.getChild("values").keys.layerTypes ;
|
|
|
- var layerTypeList = util.getObjectProperties(layerTypes, true, false);
|
|
|
- var template = local.getChild("values").newGroup.layers;
|
|
|
- var layerTemplate = util.getObjectProperties(template, true, false);
|
|
|
-
|
|
|
- if(tl_layers.length){
|
|
|
- var layer_offset = 0 ;
|
|
|
- for (var i=0; i<tl_layers.length; i++){
|
|
|
- var currentLayer = layers.getChild(layerList[i]);
|
|
|
- // currentLayer.getChild("type").set(tl_layers[i].getType());
|
|
|
- currentLayer.setName(tl_layers[i].name);
|
|
|
- var currentLayerType = layerTypes.getChild(layerTypeList[i]);
|
|
|
- currentLayerType.setName(tl_layers[i].name);
|
|
|
- currentLayerType.set(tl_layers[i].getType());
|
|
|
- var currentTemplate = template.getChild(layerTemplate[i]) ;
|
|
|
- if (tl_layers[i].getType()=="Audio"){layer_offset+=1;}
|
|
|
- currentTemplate.setName(tl_layers[i+layer_offset].name);
|
|
|
- }
|
|
|
+ hasUpdated = true;
|
|
|
+ }
|
|
|
+ //update layers value if there was a change in structure
|
|
|
+ if(layersChanged){
|
|
|
+ layers = local.getChild("values").keys.layers ;
|
|
|
+ var layerList = util.getObjectProperties(layers, true, false);
|
|
|
+ layerTypes = local.getChild("values").keys.layerTypes ;
|
|
|
+ var layerTypeList = util.getObjectProperties(layerTypes, true, false);
|
|
|
+ var template = local.getChild("values").newGroup.layers;
|
|
|
+ var layerTemplate = util.getObjectProperties(template, true, false);
|
|
|
+
|
|
|
+ if(tl_layers.length){
|
|
|
+ var layer_offset = 0 ;
|
|
|
+ for (var i=0; i<tl_layers.length; i++){
|
|
|
+ var currentLayer = layers.getChild(layerList[i]);
|
|
|
+ // currentLayer.getChild("type").set(tl_layers[i].getType());
|
|
|
+ currentLayer.setName(tl_layers[i].name);
|
|
|
+ var currentLayerType = layerTypes.getChild(layerTypeList[i]);
|
|
|
+ currentLayerType.setName(tl_layers[i].name);
|
|
|
+ currentLayerType.set(tl_layers[i].getType());
|
|
|
+ var currentTemplate = template.getChild(layerTemplate[i]) ;
|
|
|
+ if (tl_layers[i].getType()=="Audio"){layer_offset+=1;}
|
|
|
+ currentTemplate.setName(tl_layers[i+layer_offset].name);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- //build keys if needed
|
|
|
- layers = local.getChild("values").keys.layers ;
|
|
|
- layersList = util.getObjectProperties(layers, true, false);
|
|
|
-
|
|
|
- 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);
|
|
|
+ //build keys if needed
|
|
|
+ layers = local.getChild("values").keys.layers ;
|
|
|
+ layersList = util.getObjectProperties(layers, true, false);
|
|
|
+
|
|
|
+ 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;
|
|
|
-
|
|
|
- //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)[i]);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ var tl_lay = tl_seq.layers.getItemWithName(layersList[layerIndex]);
|
|
|
+ var tl_keys;
|
|
|
+
|
|
|
+ //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);
|
|
|
}
|
|
|
- hasUpdated = true;
|
|
|
+ else {
|
|
|
+ // script.log(util.getObjectProperties(currentLayer, true, false)[0]);
|
|
|
+ currentLayer.removeContainer(util.getObjectProperties(currentLayer, true, false)[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+ 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)[i]);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ //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);
|
|
|
}
|
|
|
- hasUpdated = true;
|
|
|
+ else {
|
|
|
+ // script.log(util.getObjectProperties(currentLayer, true, false)[0]);
|
|
|
+ currentLayer.removeContainer(util.getObjectProperties(currentLayer, true, false)[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+ hasUpdated = true;
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
- currentLayer = layers.getChild(layersList[layerIndex]);
|
|
|
- keyList = util.getObjectProperties(currentLayer, true, false);
|
|
|
- //update values for currentLayer
|
|
|
- if(tl_keys.length){
|
|
|
- for(var i=0; i<tl_keys.length; i++){
|
|
|
- var currentKey = currentLayer.getChild(keyList[i]);
|
|
|
- currentKey.setName(tl_keys[i].name);
|
|
|
- currentKey.time.set(tl_keys[i].position.get());
|
|
|
- currentKey.value.set(tl_keys[i].value.get());
|
|
|
+ currentLayer = layers.getChild(layersList[layerIndex]);
|
|
|
+ keyList = util.getObjectProperties(currentLayer, true, false);
|
|
|
+ //update values for currentLayer
|
|
|
+ if(tl_keys.length){
|
|
|
+ for(var i=0; i<tl_keys.length; i++){
|
|
|
+ var currentKey = currentLayer.getChild(keyList[i]);
|
|
|
+ currentKey.setName(tl_keys[i].name);
|
|
|
+ currentKey.time.set(tl_keys[i].position.get());
|
|
|
+ currentKey.value.set(tl_keys[i].value.get());
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
- 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());
|
|
|
+ }
|
|
|
+ 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());
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function struct_rebuildGroupLayers(){
|
|
|
+ var layersChanged = false;
|
|
|
+ var tl_layers = tl_seq.layers.getItems();
|
|
|
+ layers = local.getChild("values").newGroup.layers ;
|
|
|
+ var layersList = util.getObjectProperties(layers, true, false);
|
|
|
+ if (layersList.length != tl_layers.length){
|
|
|
+
|
|
|
+ var delta = layersList.length-tl_layers.length;
|
|
|
+ var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
|
|
|
+ delta = Math.abs(delta);
|
|
|
+ script.log("Group layers "+ delta + (addRemove ? " up" : " down"));
|
|
|
+ for(var i=0; i<delta; i++){
|
|
|
+ // script.log(i);
|
|
|
+
|
|
|
+ if(addRemove){
|
|
|
+
|
|
|
+ local.getChild("values").newGroup.layers.addFloatParameter("newLayer"+i, "value for this layer at group creation", 0., 0., 1.);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ local.getChild("values").newGroup.layers.removeParameter(util.getObjectProperties(layers, true, false)[i]);
|
|
|
+ local.getChild("values").newGroup.layers.setCollapsed(true);
|
|
|
+ local.getChild("values").newGroup.layers.setCollapsed(false);
|
|
|
+
|
|
|
+ }
|
|
|
+ // cuesList = ;
|
|
|
+
|
|
|
+ }
|
|
|
+ layersChanged = true;
|
|
|
+ }
|
|
|
+ if(layersChanged){
|
|
|
+ var template = local.getChild("values").newGroup.layers;
|
|
|
+ var layerTemplate = util.getObjectProperties(template, true, false);
|
|
|
+
|
|
|
+ if(tl_layers.length){
|
|
|
+ for (var i=0; i<tl_layers.length; i++){
|
|
|
+ var currentTemplate = template.getChild(layerTemplate[i]) ;
|
|
|
+ currentTemplate.setName(tl_layers[i].name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//rebuild values.keys structure from sequence
|
|
|
+function struct_buildValuesFromSeq(){
|
|
|
+
|
|
|
+ inibValuesChanged = true;
|
|
|
+ var hasUpdated = false ;
|
|
|
+
|
|
|
+ var tl_seq = root.sequences.getItemWithName(sequence);
|
|
|
+
|
|
|
+ if(tl_seq.name!="undefined"){
|
|
|
+
|
|
|
+
|
|
|
+ if(doSyncKeysCues) {struct_rebuildValues();}
|
|
|
+
|
|
|
+ else{struct_rebuildGroupLayers();}
|
|
|
+
|
|
|
|
|
|
//Groups
|
|
|
tl_seq = root.sequences.getItemWithName(sequence);
|