Sfoglia il codice sorgente

bugfixes + added leyerHeight method

eLandon 4 anni fa
parent
commit
12804bd1af
1 ha cambiato i file con 34 aggiunte e 8 eliminazioni
  1. 34 8
      SequenceMgr.js

+ 34 - 8
SequenceMgr.js

@@ -54,6 +54,8 @@ var followCursor = false ;
 var followZoom = 0.5 ;
 var followRatems = 1.;
 var followDelta = 0.;
+
+var layerHeight = script.addFloatParameter("layer height", "", 70., 10., 150.); //part of sequence time to show
 // var sequence_structure = {	params: {}, 
 // 							groups:{},
 // 							keys:{
@@ -89,7 +91,7 @@ function init() {
 	// newClip.setName("testAudio");
 	// newClip.startTime.set(12);
 
-	// printMethodsAndProperties(root.sequences.truc);
+	printMethodsAndProperties(root.sequences.keys.layers.pan);
 	// script.log(local.getChild("values").groups.group0.cue.get());
 
 	//test if a sequence is already choosen else refresh and unlock sequence enum
@@ -124,6 +126,8 @@ function scriptParameterChanged(param){
 
 	else if(param.is(rebuildValues)){struct_updateValuesFromSeq();}
 
+	else if (param.is(layerHeight)){setLayerHeight();}
+
 	else if (param.is(refreshKeys)){
 		script.log("refreshKeys");
 		refreshKeysList();
@@ -599,7 +603,7 @@ function struct_rebuildValues(){
 	//build layers if needed
 	var layersChanged = false ;
 	var tl_layers = tl_seq.layers.getItems();
-	layers = local.getChild("values").keys.layers ;
+	var layers = local.getChild("values").keys.layers ;
 	var layersList = util.getObjectProperties(layers, true, false);
 	if (layersList.length != tl_layers.length){
 		layersChanged = true ;
@@ -762,11 +766,12 @@ function struct_rebuildValues(){
 }
 
 function struct_rebuildGroupLayers(){
+	var groupsUpdated = 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){
-		
+		groupsUpdated = true;
 		var delta = layersList.length-tl_layers.length;
 		var addRemove = delta > 0 ? false : true ; //0 to remove, 1 to add
 		delta = Math.abs(delta);
@@ -796,12 +801,16 @@ function struct_rebuildGroupLayers(){
 	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);
+	if (groupsUpdated){
+		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);
+				
+			}
 		}
 	}
+		
 	
 }
 
@@ -1110,7 +1119,7 @@ function createNewGroup(isInOut){
 	// var struc_layers = util.getObjectProperties(sequence_structure.keys.layers);
 	if(tl_layers.length){
 		for(var i=0;i<tl_layers.length; i++ ){
-			if(tl_layers[i].automation!=undefined){//only for mapping layers
+			if(tl_layers[i].automation!=undefined){//only for mapping layers    
 				// script.log(sequence_structure.keys.layers[layers[i].name]);
 				var newKeyValue = local.getChild("values").newGroup.layers.getChild(tl_layers[i].name).get();
 				script.log(newKeyValue);
@@ -1180,3 +1189,20 @@ function seq_readZoomValue(){
 	}
 	
 }
+
+function setLayerHeight(){
+	if(sequence!=""){
+		var tl_seq = root.sequences.getItemWithName(sequence);
+		var tl_layers = tl_seq.layers.getItems() ;
+		if(tl_layers.length){
+			var height = layerHeight.get();
+			for(var i=0; i< tl_layers.length ; i++){
+				tl_layers[i].uiHeight.set(height);
+			}
+		}
+
+	}
+	
+
+	root.sequences.keys.layers.pan.uiHeight.set(layerHeight.get());
+}