Jelajahi Sumber

import/export file sequence

lacks a mecanism to hold sequence duration and other options
eLandon 4 tahun lalu
induk
melakukan
e342961bab
1 mengubah file dengan 28 tambahan dan 4 penghapusan
  1. 28 4
      SequenceMgr.js

+ 28 - 4
SequenceMgr.js

@@ -289,6 +289,28 @@ function importSequenceFile(loadFile){
 		}
 	}
 
+	//recreate groups
+	var groupList = util.getObjectProperties(loadData.values.groups, true, false);
+	if(groupList.length){
+		for(var i=0; i<groupList.length; i++){
+			var group = local.getChild("Values").groups.addContainer(groupList[i]);
+			var groupLayers = util.getObjectProperties(loadData.values.groups[groupList[i]], true, false);
+			group.addFloatParameter("cue", "", 0., 0.);
+			cue.setName(cuesList[i]);
+			cue.time.set(loadData.values.keys.cues[cuesList[i]].time);
+
+			var groupKeysList = util.getObjectProperties(loadData.values.groups[groupList[i]].groupKeys, true, false);
+			if (groupKeysList.length){
+				var keysContainer = group.addContainer("keys");
+				keysContainer.setCollapsed(true);
+				for (var j=0; j<groupKeysList.length; j++){
+					group.addFloatParameter(groupKeysList[j], "", 0., 0., 1.);
+					keysContainer.addStringParameter(groupKeysList[j], "", loadData.values.groups[groupList[i]]['groupKeys'][groupKeysList[j]]['key']);
+				}
+			}
+		}
+	}
+
 	// script.log(layersList[0]);
 	doSync = true;
 	// updateSynchronize() ;
@@ -311,15 +333,17 @@ function exportSequenceFile(fileObj){
 	var groupsList=util.getObjectProperties(groups, true, false);
 	if(groupsList.length){
 		for(var i=0; i<groupsList.length; i++){
-			var exportGroup = exportData.values.groups[groupsList[i]] = {};
+			var exportGroup = exportData.values.groups[groupsList[i]] = {cue:"", time:0., groupKeys:{}};
 			var currentGroup = groups.getChild(groupsList[i]);
+			exportGroup.cue = currentGroup.cue.name;
+			exportGroup.time = currentGroup.cue.get();
 			var currentGroupLayers = util.getObjectProperties(currentGroup.keys, true, false);
 			if (currentGroupLayers.length){
 				for(var j=0; j<currentGroupLayers.length; j++){
 					// script.log(groupsList[i]+ "  "+ currentGroupLayers[j]);
-					exportGroup[currentGroupLayers[j]] = {key:"", value:0.};
-					exportGroup[currentGroupLayers[j]].value = currentGroup.getChild(currentGroupLayers[j]).get();
-					exportGroup[currentGroupLayers[j]].key = currentGroup.keys.getChild(currentGroupLayers[j]).get();
+					exportGroup.groupKeys[currentGroupLayers[j]] = {key:"", value:0};
+					exportGroup.groupKeys[currentGroupLayers[j]].value = currentGroup.getChild(currentGroupLayers[j]).get();
+					exportGroup.groupKeys[currentGroupLayers[j]].key = currentGroup.keys.getChild(currentGroupLayers[j]).get();
 				}
 			}
 		}