|
@@ -11,7 +11,7 @@ keys are grouped by name, and groups can be saved/loaded to a file
|
|
// var parameterPath = local.parameters;
|
|
// var parameterPath = local.parameters;
|
|
// var valuesPath = local.values;
|
|
// var valuesPath = local.values;
|
|
|
|
|
|
-var newKey = script.addTrigger("newKey", "adds a key at current cursor position" );
|
|
|
|
|
|
+var rebuildValues = script.addTrigger("rebuild values", "adds a key at current cursor position" );
|
|
var refreshKeys = script.addTrigger("refresh keys", "truc");
|
|
var refreshKeys = script.addTrigger("refresh keys", "truc");
|
|
var printKeys = script.addTrigger("printKeys","truc");
|
|
var printKeys = script.addTrigger("printKeys","truc");
|
|
var moveKey = script.addTrigger("moveKey","truc");
|
|
var moveKey = script.addTrigger("moveKey","truc");
|
|
@@ -34,7 +34,7 @@ var sequence_structure = { params: {},
|
|
function init() {
|
|
function init() {
|
|
script.log("LOADED SEQUENCE GROUPING MANAGEMENT MODULE ");
|
|
script.log("LOADED SEQUENCE GROUPING MANAGEMENT MODULE ");
|
|
// script.log();
|
|
// script.log();
|
|
- testSequenceFile();
|
|
|
|
|
|
+ if(testSequenceFile()){loadSequenceFile();}
|
|
|
|
|
|
// printMethodsAndProperties(local.parameters.sequenceFile);
|
|
// printMethodsAndProperties(local.parameters.sequenceFile);
|
|
|
|
|
|
@@ -76,19 +76,7 @@ function moduleParameterChanged(param){
|
|
}
|
|
}
|
|
|
|
|
|
function moduleValueChanged(value){
|
|
function moduleValueChanged(value){
|
|
-
|
|
|
|
-
|
|
|
|
- //
|
|
|
|
- // if (value.name == "addGroup"){
|
|
|
|
- // script.log("in values");
|
|
|
|
- //
|
|
|
|
- // var meth = util.getObjectProperties(key);
|
|
|
|
- // if(meth.length){
|
|
|
|
- // for(var i=0; i< meth.length; i++){
|
|
|
|
- // script.log(meth[i]);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
|
|
+ if (value.name == "addGroup"){createNewGroup(sequence_structure.params.sequence);}
|
|
}
|
|
}
|
|
|
|
|
|
function scriptParameterChanged(param){
|
|
function scriptParameterChanged(param){
|
|
@@ -107,12 +95,7 @@ function scriptParameterChanged(param){
|
|
// root.sequences.sequence.layers.mapping.automation.key2.position.set(10.);
|
|
// root.sequences.sequence.layers.mapping.automation.key2.position.set(10.);
|
|
// }
|
|
// }
|
|
if (param.is(printKeys) ){printKeys();}
|
|
if (param.is(printKeys) ){printKeys();}
|
|
- if(param.is(newKey)){
|
|
|
|
- var key = root.sequences.sequence.layers.mapping.automation.addItem();
|
|
|
|
- key.position.set(root.sequences.sequence.currentTime.get());
|
|
|
|
- key.value.set(Math.random());
|
|
|
|
- root.sequences.sequence.layers.mapping.automation.reorderItems();
|
|
|
|
- }
|
|
|
|
|
|
+ if(param.is(rebuildValues)){rebuildValuesStructure(); }
|
|
|
|
|
|
if (param.is(refreshKeys)){
|
|
if (param.is(refreshKeys)){
|
|
script.log("refreshKeys");
|
|
script.log("refreshKeys");
|
|
@@ -176,22 +159,24 @@ function testSequenceFile(){
|
|
//if all is well, let's load in sequence_structure
|
|
//if all is well, let's load in sequence_structure
|
|
else {
|
|
else {
|
|
script.log("ready to import");
|
|
script.log("ready to import");
|
|
|
|
+ return 1;
|
|
// loadSequenceFile();
|
|
// loadSequenceFile();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
script.log("no file to load");
|
|
script.log("no file to load");
|
|
refreshSequenceEnum();
|
|
refreshSequenceEnum();
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function loadSequenceFile(){
|
|
function loadSequenceFile(){
|
|
script.log("loading file");
|
|
script.log("loading file");
|
|
- sequence_structure = data;
|
|
|
|
|
|
+ sequence_structure = local.parameters.sequenceFile.readFile(true);
|
|
//lock enum with curent sequence name
|
|
//lock enum with curent sequence name
|
|
var sequenceList = local.parameters.sequence;
|
|
var sequenceList = local.parameters.sequence;
|
|
sequenceList.removeOptions();
|
|
sequenceList.removeOptions();
|
|
- sequenceList.addOption(data.params.sequence, 0);
|
|
|
|
|
|
+ sequenceList.addOption(sequence_structure.params.sequence, 0);
|
|
local.parameters.sequence.setAttribute("readonly",true);
|
|
local.parameters.sequence.setAttribute("readonly",true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -217,12 +202,33 @@ function printKeys(){
|
|
a nogroup container shows keys that are not grouped
|
|
a nogroup container shows keys that are not grouped
|
|
*/
|
|
*/
|
|
|
|
|
|
-function clearValues(){
|
|
|
|
- var values = local.values.getItems();
|
|
|
|
-
|
|
|
|
|
|
+// function clearValues(){
|
|
|
|
+ // var values = local.values.getItems();
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+function rebuildValuesStructure() {
|
|
|
|
+ script.log("updating values structure");
|
|
|
|
+ //empty current structure
|
|
|
|
+ local.getChild("Values").removeContainer("newGroup");
|
|
|
|
+ local.getChild("Values").removeContainer("groups");
|
|
|
|
+ local.getChild("Values").removeContainer("ungrouped");
|
|
|
|
+
|
|
|
|
+ //rebuild containers
|
|
|
|
+ var ng_cont = local.values.addContainer("New group");
|
|
|
|
+ var g_cont = local.values.addContainer("groups");
|
|
|
|
+ var ug_cont = local.values.addContainer("ungrouped");
|
|
|
|
+
|
|
|
|
+ // rebuild new group
|
|
|
|
+ ng_cont.addTrigger("add group", "adds a new group at cursor time with below values");
|
|
|
|
+ ng_cont.addFloatParameter("group time", "time position where the group will be created ", 0., 0.);
|
|
|
|
+ var layer_cont = ng_cont.addContainer("layers values");
|
|
|
|
+ var layers = util.getObjectProperties(sequence_structure.keys.layers) ;
|
|
|
|
+ for (var i=0; i<layers.length; i++){
|
|
|
|
+ layer_cont.addFloatParameter(layers[i], "", 0., 0., 1.);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/////////////////////// TIMELINE FUNCTIONS ///////////////////////
|
|
/////////////////////// TIMELINE FUNCTIONS ///////////////////////
|
|
|
|
|
|
function refreshKeysList(){
|
|
function refreshKeysList(){
|
|
@@ -263,4 +269,30 @@ function refreshKeysList(){
|
|
}
|
|
}
|
|
|
|
|
|
// myFile.writeFile(JSON.stringify(tl_keyframes), 1);
|
|
// myFile.writeFile(JSON.stringify(tl_keyframes), 1);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function createNewGroup(seqName){
|
|
|
|
+ //create a cue and a key in each layer at cursor position in selected sequence
|
|
|
|
+
|
|
|
|
+ var seq = root.sequences.getItemWithName(seqName);
|
|
|
|
+ var currentTime = seq.currentTime.get() ;
|
|
|
|
+ // var currentTime = local.values.newGroup.groupTime.get();
|
|
|
|
+ script.log(currentTime);
|
|
|
|
+ newCue = seq.cues.addItem();
|
|
|
|
+ newCue.time.set(currentTime);
|
|
|
|
+ var layers = seq.layers.getItems();
|
|
|
|
+ script.log(layers.length);
|
|
|
|
+ // var struc_layers = util.getObjectProperties(sequence_structure.keys.layers);
|
|
|
|
+ if(layers.length){
|
|
|
|
+ for(var i=0;i<layers.length; i++ ){
|
|
|
|
+ // script.log(sequence_structure.keys.layers[layers[i].name]);
|
|
|
|
+ newKey = layers[i].automation.addItem();
|
|
|
|
+ newKey.position.set(currentTime);
|
|
|
|
+ script.log(local.values.newGroup.layersValues[layers[i].name].get());
|
|
|
|
+ newKey.value.set(local.values.newGroup.layersValues[layers[i].name].get());
|
|
|
|
+ layers[i].automation.reorderItems();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // seq = seq.getItems();
|
|
|
|
+
|
|
}
|
|
}
|