Browse Source

chataigne dev

eLandon 4 years ago
parent
commit
17da9aaa41
2 changed files with 44 additions and 32 deletions
  1. 43 31
      soft/keyframes.js
  2. 1 1
      soft/lyreCam.noisette

+ 43 - 31
soft/keyframes.js

@@ -75,25 +75,25 @@ function refresh_tl_keys_list(){
 
 
 	// tl_keyframes['cues']
-	if(root.sequences.keys.cues.items.length){
-		for (var i = 0 ; i < root.sequences.keys.cues.items.length ; i++){
+	if(root.sequences.keys.cues.getItems().length){
+		for (var i = 0 ; i < root.sequences.keys.cues.getItems().length ; i++){
 			tl_keyframes['cues']['cue'+i] = {index : i};
-			tl_keyframes['cues']['cue'+i]['name'] = root.sequences.keys.cues.items[i].name;
-			tl_keyframes['cues']['cue'+i]['time'] = root.sequences.keys.cues.items[i].time.get();
+			tl_keyframes['cues']['cue'+i]['name'] = root.sequences.keys.cues.getItems()[i].name;
+			tl_keyframes['cues']['cue'+i]['time'] = root.sequences.keys.cues.getItems()[i].time.get();
 			// script.log(tl_keyframes['cues']['cue'+i].time);
 		}
 	}
-	if(root.sequences.keys.layers.items.length){
-		for (var i = 0 ; i < root.sequences.keys.layers.items.length ; i++){
-			var currentLayer = root.sequences.keys.layers.items[i] ;
+	if(root.sequences.keys.layers.getItems().length){
+		for (var i = 0 ; i < root.sequences.keys.layers.getItems().length ; i++){
+			var currentLayer = root.sequences.keys.layers.getItems()[i] ;
 			tl_keyframes['keys'][currentLayer.name] = {};
 			// script.log(currentLayer.name);
 
-			if(currentLayer.automation.items.length){
+			if(currentLayer.automation.getItems().length){
 				// script.log(currentLayer.automation.items.length);
-				for (var j = 0 ; j < currentLayer.automation.items.length ; j++){
+				for (var j = 0 ; j < currentLayer.automation.getItems().length ; j++){
 
-					var currentkey = currentLayer.automation.items[j] ;
+					var currentkey = currentLayer.automation.getItems()[j] ;
 					tl_keyframes['keys'][currentLayer.name][currentkey.name] = {
 																																			position : currentkey.position.get(),
 																																			value : currentkey.value.get()
@@ -107,13 +107,21 @@ function refresh_tl_keys_list(){
 	// myFile.writeFile(JSON.stringify(tl_keyframes), 1);
 }
 
+function reorderLayers(){
+	if(root.sequences.keys.layers.getItems().length){
+		for (var i = 0 ; i < root.sequences.keys.layers.getItems().length ; i++){
+			root.sequences.keys.layers.getItems()[i].automation.reorderItems(10);
+		}
+	}
+}
+
 function apply_tl_groups() {
 	if(tl_groups.groups){
 		for(var i=0 ; i<tl_groups.groups ; i++){
 			//set all keys in a group to its cue time
 			var tempGroup = tl_groups['group'+i];
 			var hasOut= typeof tempGroup.cueOut.pan!='undefined' ;
-			var layers = root.sequences.keys.layers.items ;
+			var layers = root.sequences.keys.layers.getItems() ;
 			var inTime = root.sequences.keys.cues[tempGroup.cueIn.cue].time.get();
 			var outTime;
 			if(hasOut){ outTime = root.sequences.keys.cues[tempGroup.cueOut.cue].time.get();}
@@ -139,9 +147,9 @@ function apply_tl_groups() {
 }
 
 function clear_tl_cues(){
-	if(root.sequences.keys.cues.items.length){
-		for (var i = root.sequences.keys.cues.items.length-1 ; i>=0 ; i--){
-			root.sequences.keys.cues.removeItem(root.sequences.keys.cues.items[i].name);
+	if(root.sequences.keys.cues.getItems().length){
+		for (var i = root.sequences.keys.cues.getItems().length-1 ; i>=0 ; i--){
+			root.sequences.keys.cues.removeItem(root.sequences.keys.cues.getItems()[i].name);
 		}
 		script.log("Cleared all cues");
 	}
@@ -149,11 +157,12 @@ function clear_tl_cues(){
 }
 
 function clear_tl_keys(){
-	if(root.sequences.keys.layers.items.length){
-		for (var i = root.sequences.keys.layers.items.length-1 ; i >=0  ; i--){
-			if(root.sequences.keys.layers.items[i].automation.items.length){
-				for (var j = root.sequences.keys.layers.items[i].automation.items.length-1 ; j >= 0 ; j--){
-					root.sequences.keys.layers.items[i].automation.removeItem(root.sequences.keys.layers.items[i].automation.items[j].name);
+	script.log(root.sequences.keys.layers.getItems().length);
+	if(root.sequences.keys.layers.getItems().length){
+		for (var i = root.sequences.keys.layers.getItems().length-1 ; i >=0  ; i--){
+			if(root.sequences.keys.layers.getItems()[i].automation.getItems().length){
+				for (var j = root.sequences.keys.layers.getItems()[i].automation.getItems().length-1 ; j >= 0 ; j--){
+					root.sequences.keys.layers.getItems()[i].automation.removeItem(root.sequences.keys.layers.getItems()[i].automation.getItems()[j].name);
 				}
 			}
 			// root.sequences.keys.cues.removeItem(root.sequences.keys.cues.items[i].name);
@@ -200,19 +209,19 @@ function create_keyGroup(mode){ //mode=0 single cue, mode=1 dual cues
 		tl_groups['group'+groupIndex].cueOut.cue = outCue.name;
 	}
 	//create keys
-	var layers = root.sequences.keys.layers.items ;
+	var layers = root.sequences.keys.layers.getItems() ;
 	if(layers.length){
 		for(var i = 0 ; i<layers.length ; i++){
-				tempKeyIn = root.sequences.keys.layers.items[i].automation.addItem();
-				tempKeyIn.value.set(tempValues[root.sequences.keys.layers.items[i].name]);
+				tempKeyIn = root.sequences.keys.layers.getItems()[i].automation.addItem();
+				tempKeyIn.value.set(tempValues[root.sequences.keys.layers.getItems()[i].name]);
 				tempKeyIn.position.set(inCue.time.get());
-				tl_groups['group'+groupIndex].cueIn[root.sequences.keys.layers.items[i].name]=tempKeyIn.name;
+				tl_groups['group'+groupIndex].cueIn[root.sequences.keys.layers.getItems()[i].name]=tempKeyIn.name;
 
 				if(mode) {
-					tempKeyOut = root.sequences.keys.layers.items[i].automation.addItem();
-					tempKeyOut.value.set(tempValues[root.sequences.keys.layers.items[i].name]);
+					tempKeyOut = root.sequences.keys.layers.getItems()[i].automation.addItem();
+					tempKeyOut.value.set(tempValues[root.sequences.keys.layers.getItems()[i].name]);
 					tempKeyOut.position.set(outCue.time.get());
-					tl_groups['group'+groupIndex].cueOut[root.sequences.keys.layers.items[i].name]=tempKeyOut.name;
+					tl_groups['group'+groupIndex].cueOut[root.sequences.keys.layers.getItems()[i].name]=tempKeyOut.name;
 				}
 
 				//script.log(layers[i].name);
@@ -226,6 +235,7 @@ function create_keyGroup(mode){ //mode=0 single cue, mode=1 dual cues
 				// 		script.log(root.sequences.keys.layers.items[i].automation.items[j].name);
 				// 	}
 				// }
+
 			}
 		}
 		tl_groups.groups += 1;
@@ -244,8 +254,9 @@ function init()
 {
 	script.log("Reading key group file");
 	tl_groups = JSON.parse(myFile.readFile());
-	script.log (tl_groups.groups);
-
+	//script.log (tl_groups.groups);
+	script.log(root.sequences.keys.layers.pan.automation.getItems()[0]);
+//root.sequences.keys.layers.pan.value
 	// script.log(root.reference);
 	// script.log(root.sequences.keys.addCueAt(1.11));
 	// root.sequences.keys.layers[0].getObjectProperties();
@@ -272,9 +283,9 @@ function scriptParameterChanged(param)
 	//You can use the script.log() function to show an information inside the logger panel. To be able to actuallt see it in the logger panel, you will have to turn on "Log" on this script.
 	script.log("Parameter changed : "+param.name); //All parameters have "name" property
 	if(param.is(myTrigger)){
-		script.log(root.sequences.keys.layers.items[0].automation.items.length);
-		for (var j = 0 ; j<root.sequences.keys.layers.items[0].automation.items.length ; j++){
-			script.log(root.sequences.keys.layers.items[0].automation.items[j].name);
+		script.log(root.sequences.keys.layers.getItems()[0].automation.getItems().length);
+		for (var j = 0 ; j<root.sequences.keys.layers.getItems()[0].automation.getItems().length ; j++){
+			script.log(root.sequences.keys.layers.getItems()[0].automation.getItems()[j].name);
 		}
 		//  for (var i = tl.cues.items.length-1 ; i>=0 ; i--){
 	 	// 	script.log(tl.cues.items[i].name);
@@ -307,6 +318,7 @@ function update(deltaTime)
 			tl_refresh_delta = 0. ;
 			refresh_tl_keys_list();
 			apply_tl_groups();
+			reorderLayers();
 			// script.log("Update : "+util.getTime()+", delta = "+deltaTime); //deltaTime is the time between now and last update() call, util.getTime() will give you a timestamp relative to either the launch time of the software, or the start of the computer.
 	}
 

File diff suppressed because it is too large
+ 1 - 1
soft/lyreCam.noisette