// UpdateFrameDisplay is used to toggle the current states of each frameTexture, // iterating through them and determining if it should be toggled. This fixes the removal // or addition of keyframes, and is called when a selection is changed. private void updateFrameDisplay() { for (int i = 0; i < keyInfo.Count; i++) { KeyframeTexture key = (KeyframeTexture)keys[i]; if (keyInfo[i].isKeyed) { key.isKeyed = true; } else { key.isKeyed = false; } } for (int i = 0; i < keyInfo.Count; i++) { KeyframeTexture key = (KeyframeTexture)keys[i]; if (keyInfo[i].isPectKey) { key.isPectKey = true; } else { key.isPectKey = false; } } }
private void UpdateSelectedKeys() { for (int i = 0; i < keyInfo.Count; i++) { KeyframeTexture key = (KeyframeTexture)keys[i]; key.isSelected = false; for (int j = 0; j < selectedKeys.Count; j++) { if (i == selectedKeys[j]) { key.isSelected = true; } } } }
// When new data is loaded in, rebuild the frames and the text labels over the timeline // to appropriate size public void respawnWithFrameCount(int count) { UpdateKeyInfoList(); if (count == 0) { count = 55; } if (hasBeenResized == false) { hasBeenResized = true; } //Updated by Chengde to reserve keyframe data when changing total number of frames ArrayList oldKeys = new ArrayList(); List <KeyframeInfo> oldKeyInfo = new List <KeyframeInfo>(); /////////////// 12.09.2013 ////////////////////// if (keys != null) { //saveKeyframeData() //Updated by CHENGDE to reserve keyframe data when changing total number of frames for (int i = 0; i < keys.Count; i++) { oldKeys.Add(keys[i]); } /////////////// 12.09.2013 ////////////////////// maxScrollLength = count; for (int i = 0; i < keys.Count; i++) { keys[i] = null; } } //Updated by CHENGDE to reserve keyframe data when changing total number of frames if (keyInfo.Count > 0) { for (int i = 0; i < keyInfo.Count; i++) { oldKeyInfo.Add(keyInfo[i]); } } /////////////// 12.09.2013 ////////////////////// keyInfo = new List <KeyframeInfo>(count); keys = new ArrayList(); for (int i = 0; i < count; i++) { KeyframeTexture keyTexture = new KeyframeTexture(); keyTexture.x = i * 8; keyTexture.y = 20; if (i % 5 == 0) { keyTexture.isMultipleFive = true; } keys.Add(keyTexture); keyInfo.Add(new KeyframeInfo()); } currentFrame = 1; labelBar = new LabelBarTexture(count); keyInfo[0] = new KeyframeInfo(); keyInfo[0].position(new Vector3(150f, 50f, 0f)); keyInfo[0].rotation(new Quaternion(0.0f, 0.0f, 0.0f, 0.0f)); keyInfo[0].isKeyed = true; keyInfo[count - 1] = new KeyframeInfo(); keyInfo[count - 1].position(new Vector3(0f, 0f, 0f)); keyInfo[count - 1].rotation(new Quaternion(0.0f, 0.0f, 0.0f, 0.0f)); keyInfo[count - 1].isKeyed = true; //Updated by CHENGDE to reserve keyframe data when changing total number of frames if (keys != null) { int keyInfoCnt = (oldKeyInfo.Count < keyInfo.Count)?oldKeyInfo.Count:keyInfo.Count; for (int i = 0; i < keyInfoCnt; i++) { keyInfo[i] = oldKeyInfo[i]; } int keyCnt = (oldKeys.Count < keys.Count)? oldKeys.Count: keys.Count; for (int i = 0; i < keyCnt; i++) { keys[i] = oldKeys[i]; } } /////////////// 12.09.2013 ////////////////////// gotoFrame(1); updateFrameDisplay(); //Debug.Log("Rebuilding the Keyframebar took: " + (startTime - endTime) + " ms"); }
// When new data is loaded in, rebuild the frames and the text labels over the timeline // to appropriate size public void respawnWithFrameCount(int count) { UpdateKeyInfoList(); if(count == 0) count = 55; if(hasBeenResized == false) { hasBeenResized = true; } //Updated by Chengde to reserve keyframe data when changing total number of frames ArrayList oldKeys = new ArrayList(); List<KeyframeInfo> oldKeyInfo = new List<KeyframeInfo>(); /////////////// 12.09.2013 ////////////////////// if(keys != null) { //saveKeyframeData() //Updated by CHENGDE to reserve keyframe data when changing total number of frames for(int i = 0; i < keys.Count; i++) oldKeys.Add(keys[i]); /////////////// 12.09.2013 ////////////////////// maxScrollLength = count; for(int i = 0; i < keys.Count; i++) { keys[i] = null; } } //Updated by CHENGDE to reserve keyframe data when changing total number of frames if(keyInfo.Count > 0) for(int i=0; i<keyInfo.Count; i++) oldKeyInfo.Add (keyInfo[i]); /////////////// 12.09.2013 ////////////////////// keyInfo = new List<KeyframeInfo>(count); keys = new ArrayList(); for(int i = 0; i < count; i++) { KeyframeTexture keyTexture = new KeyframeTexture(); keyTexture.x = i * 8; keyTexture.y = 20; if(i % 5 == 0) keyTexture.isMultipleFive = true; keys.Add(keyTexture); keyInfo.Add(new KeyframeInfo()); } currentFrame = 1; labelBar = new LabelBarTexture(count); keyInfo[0] = new KeyframeInfo(); keyInfo[0].position(new Vector3(150f, 50f, 0f)); keyInfo[0].rotation(new Quaternion(0.0f, 0.0f, 0.0f, 0.0f)); keyInfo[0].isKeyed = true; keyInfo[count-1 ] = new KeyframeInfo(); keyInfo[count-1].position(new Vector3(0f, 0f, 0f)); keyInfo[count-1].rotation(new Quaternion(0.0f, 0.0f, 0.0f, 0.0f)); keyInfo[count-1].isKeyed = true; //Updated by CHENGDE to reserve keyframe data when changing total number of frames if(keys != null) { int keyInfoCnt = (oldKeyInfo.Count<keyInfo.Count)?oldKeyInfo.Count:keyInfo.Count; for(int i=0; i<keyInfoCnt; i++) keyInfo[i] = oldKeyInfo[i]; int keyCnt = (oldKeys.Count<keys.Count)? oldKeys.Count: keys.Count; for(int i=0; i<keyCnt; i++) keys[i] = oldKeys[i]; } /////////////// 12.09.2013 ////////////////////// gotoFrame(1); updateFrameDisplay(); //Debug.Log("Rebuilding the Keyframebar took: " + (startTime - endTime) + " ms"); }