public void ModifyKeyframe(List <SplineNode> nodes, int index) { if (Keyframes.Count > index) { List <SplineNode> list = new List <SplineNode>(); foreach (SplineNode node in nodes) { list.Add(new SplineNode(node.position, node.direction)); } PBSplineKeyframe keyframe = Keyframes[index]; keyframe.nodes = list; } }
protected override string SaveString(string format) { StringBuilder sb = new StringBuilder(SaveStrHead()); //save all keyframe nodes PBSplineAnimator animator = GetComponent <PBSplineAnimator>(); if (animator.KeyframeCount == 0) { //default add current spline node as first keyframe animator.AddKeyframe(spline.nodes); } for (int i = 0; i < animator.KeyframeCount; i++) { PBSplineKeyframe keyframe = animator.Keyframes[i]; for (int j = 0; j < keyframe.nodes.Count; j++) { SplineNode node = keyframe.nodes[j]; sb.Append(node.position.x.ToString(format) + ","); sb.Append(node.position.y.ToString(format) + ","); sb.Append(node.position.z.ToString(format) + ","); sb.Append(node.direction.x.ToString(format) + ","); sb.Append(node.direction.y.ToString(format) + ","); sb.Append(node.direction.z.ToString(format)); if (j < keyframe.nodes.Count - 1) { sb.Append(";"); } } if (i < animator.KeyframeCount - 1) { sb.Append("|"); } } return(sb.ToString()); }