|
@@ -22,8 +22,8 @@ var debugFile;
|
|
|
|
|
|
var parametersPath = local.parameters ;
|
|
|
|
|
|
-var sequence ;
|
|
|
-var sequencePath = local.parameters.sequence ;
|
|
|
+var sequence = '' ;
|
|
|
+var sequencePath = local.getChild("parameters").sequence ;
|
|
|
var file ;
|
|
|
var filePath = local.parameters.sequenceFile ;
|
|
|
|
|
@@ -70,9 +70,15 @@ function init() {
|
|
|
|
|
|
|
|
|
|
|
|
- sequence = sequencePath.getKey();
|
|
|
+ sequence = local.getChild("parameters").sequence.getKey();
|
|
|
+
|
|
|
+ script.log(sequenceIndex + " " + sequence);
|
|
|
+
|
|
|
if(sequence == ""){refreshSequenceEnum();}
|
|
|
- else{sequencePath.setAttribute("readonly", true);}
|
|
|
+ else{
|
|
|
+ sequencePath.removeOptions();
|
|
|
+ sequencePath.addOption(sequence,0);
|
|
|
+ sequencePath.setAttribute("readonly", true);}
|
|
|
|
|
|
}
|
|
|
|
|
@@ -87,7 +93,7 @@ function scriptParameterChanged(param){
|
|
|
refreshKeysList();
|
|
|
}
|
|
|
|
|
|
- else if (param.is(clearSeq)){seq_clearSequence();}
|
|
|
+
|
|
|
|
|
|
else {script.log("scriptparamchanged" + param.name);}
|
|
|
}
|
|
@@ -95,15 +101,17 @@ function scriptParameterChanged(param){
|
|
|
|
|
|
|
|
|
function update(deltaTime){
|
|
|
-
|
|
|
- if(doSync){
|
|
|
- syncDelta += deltaTime ;
|
|
|
-
|
|
|
- if (syncDelta >= syncRatems){
|
|
|
- syncDelta = 0. ;
|
|
|
- struct_buildValuesFromSeq();
|
|
|
- }
|
|
|
- }
|
|
|
+ if(sequence!=""){
|
|
|
+
|
|
|
+ if(doSync){
|
|
|
+ syncDelta += deltaTime ;
|
|
|
+
|
|
|
+ if (syncDelta >= syncRatems){
|
|
|
+ syncDelta = 0. ;
|
|
|
+ struct_buildValuesFromSeq();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -163,11 +171,18 @@ function moduleParameterChanged(param){
|
|
|
|
|
|
else if (param.is(parametersPath.syncRate)){updateSyncRate();}
|
|
|
|
|
|
+ else if (param.is(parametersPath.clearSequence)){seq_clearSequence();}
|
|
|
+
|
|
|
else if (param.is(parametersPath.changeSequence)){refreshSequenceEnum();}
|
|
|
|
|
|
else if (param.is(parametersPath.sequence)){
|
|
|
sequence = sequencePath.getKey();
|
|
|
- script.log("watching "+ sequence);
|
|
|
+ if(sequence!="choose sequence"){
|
|
|
+ script.log("watching "+ sequence);
|
|
|
+ local.parameters.sequence.setAttribute("readonly",true);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
else{script.log("received module param :" + param.name);}
|
|
@@ -189,39 +204,42 @@ function updateSyncRate(){
|
|
|
function refreshSequenceEnum(){
|
|
|
script.log("refresh list of sequences");
|
|
|
local.parameters.sequence.setAttribute("readonly",false);
|
|
|
+
|
|
|
if(root.sequences.getItems().length){
|
|
|
local.parameters.sequence.removeOptions();
|
|
|
+ local.parameters.sequence.addOption("", 0);
|
|
|
for(var i=0 ; i<root.sequences.getItems().length ; i++ ){
|
|
|
- local.parameters.sequence.addOption(root.sequences.getItems()[i].name,i);
|
|
|
+ local.parameters.sequence.addOption(root.sequences.getItems()[i].name,i+1);
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-function testSequenceFile(){
|
|
|
- var file = local.parameters.sequenceFile;
|
|
|
-
|
|
|
- if( file.getAbsolutePath() != ""){
|
|
|
- script.log("testing file " + file.getAbsolutePath() );
|
|
|
- var data = file.readFile(true);
|
|
|
-
|
|
|
- if (data.groups == undefined){
|
|
|
- script.log("file structure not recognized");
|
|
|
- refreshSequenceEnum();
|
|
|
- }
|
|
|
-
|
|
|
- else {
|
|
|
- script.log("ready to import");
|
|
|
- return 1;
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- script.log("no file to load");
|
|
|
- refreshSequenceEnum();
|
|
|
- return 0;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
function importSequenceFile(){
|
|
|
script.log("loading file");
|
|
|
sequence_structure = local.parameters.sequenceFile.readFile(true);
|
|
@@ -573,7 +591,7 @@ function createNewGroup(){
|
|
|
|
|
|
var groups = local.getChild("values").groups;
|
|
|
var groupsList = util.getObjectProperties(groups, true, false);
|
|
|
- var index = groupsList.length == undefined ? 0 : groupsList.length;
|
|
|
+
|
|
|
var currentGroup;
|
|
|
|
|
|
var tl_seq = root.sequences.getItemWithName(sequence);
|
|
@@ -610,8 +628,9 @@ function createNewGroup(){
|
|
|
|
|
|
var newKey = tl_layers[i].automation.addItem();
|
|
|
newKey.position.set(currentTime);
|
|
|
-
|
|
|
- newKey.value.set(Math.random());
|
|
|
+ script.log([layers[i].name]);
|
|
|
+ newKey.value.set(local.getChild("values").newGroup.layers.getChild(tl_layers[i].name).get());
|
|
|
+
|
|
|
keysContainer.addStringParameter(tl_layers[i].name, "",newKey.name );
|
|
|
currentGroup.addFloatParameter(tl_layers[i].name,tl_layers[i].name+" value" , newKey.value.get(), 0., 1.);
|
|
|
|