/* SEQUENCE GROUPING MANAGEMENT MODULE this module builds a representation of a sequence in values using containers It allows to create groups of keys, a group being a cue and one key per layer. In a group, all keys sync their time on cue's time, only value can be modified The sequence with grouping can then be exported and reloaded. The module checks periodicaly if timeline sequence structure (cues, layers and keys) and module values structure are in sync. If out of sync, you may either rebuild values structure from sequence or rebuild sequence from values */ var syncRatems = 10; var syncDelta = 0.; var doSync = false ; var debug = true; var debugFile; var parametersPath = local.parameters ; var sequence ; var sequencePath = local.parameters.sequence ; var file ; var filePath = local.parameters.sequenceFile ; var newGroupLayers = local.values.newGroup.layers ; var groups = local.values.groups ; var cues = local.getChild("values").keys.cues ; // var cuesList = []; //holds cues containers reference var layers = local.values.keys.layers ; var layerList = {}; //holds layer container as object with reference and an array of keys containers references var rebuildValues = script.addTrigger("rebuild values", "adds a key at current cursor position" ); var refreshKeys = script.addTrigger("refresh keys", "truc"); var printKeys = script.addTrigger("printKeys","truc"); var clearSeq = script.addTrigger("clear Sequence","truc"); var sequence_structure = { params: {}, groups:{}, keys:{ cues:{}, layers:{} } }; //WAS tl_groups /*group0 : { inCue : {pan : "key", tilt : "key", zoom : "key", dim : "key", focus : "key"}, outCue : {pan : "key", tilt : "key", zoom : "key", dim : "key", focus : "key"} }*/ ///////////////////// SCRIPT FUNCTIONS ////////////////////////////// function init() { script.log("LOADED SEQUENCE GROUPING MANAGEMENT MODULE "); //adapt update rate updateSyncRate(); updateSynchronize(); //test if a sequence is already choosen else refresh and unlock sequence enum sequence = sequencePath.getKey(); if(sequence == ""){refreshSequenceEnum();} else{sequencePath.setAttribute("readonly", true);} } function scriptParameterChanged(param){ if (param.is(printKeys) ){printKeys();} else if(param.is(rebuildValues)){struct_buildValuesFromSeq();} else if (param.is(refreshKeys)){ script.log("refreshKeys"); refreshKeysList(); } else if (param.is(clearSeq)){seq_clearSequence();} else {script.log("scriptparamchanged" + param.name);} } function update(deltaTime){ if(doSync){ syncDelta += deltaTime ; // script.log(syncDelta); if (syncDelta >= syncRatems){ syncDelta = 0. ; struct_buildValuesFromSeq(); } } } /////////////////////////// HELPERS ///////////////////////////////// function printMethodsAndProperties(obj){ script.log(" "); 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> "+seq[i].name + " " + seq[i].position.get() + " " + seq[i].listSize.get() ); } } else{script.log("nothing to print");} } /////////////////////// PARAMETERS FUNCTIONS /////////////////////// // Module callback function moduleParameterChanged(param){ if (param.is(parametersPath.importExport.sequenceFile)) {} else if (param.is(parametersPath.importExport.loadSequence)){importSequenceFile();} else if (param.is(parametersPath.importExport.exportSequence)) { exportSequenceFile();} else if (param.is(parametersPath.synchronize)){updateSynchronize();} else if (param.is(parametersPath.syncRate)){updateSyncRate();} else if (param.is(parametersPath.changeSequence)){refreshSequenceEnum();} else if (param.is(parametersPath.sequence)){ sequence = sequencePath.getKey(); script.log("watching "+ sequence); } else{script.log("received module param :" + param.name);} } function updateSynchronize(){ doSync = parametersPath.synchronize.get(); script.log(doSync ? "sync ON" : "sync OFF" ); } function updateSyncRate(){ syncRatems = parametersPath.syncRate.get() / 1000.; script.log("new sync rate : " + syncRatems); // script.setUpdateRate(syncRatems); } //refresh Enum function refreshSequenceEnum(){ script.log("refresh list of sequences"); local.parameters.sequence.setAttribute("readonly",false); if(root.sequences.getItems().length){ local.parameters.sequence.removeOptions(); for(var i=0 ; i 0 ? false : true ; //0 to remove, 1 to add delta = Math.abs(delta); script.log("change "+ delta + (addRemove ? " up" : " down")); for(var i=0; i