public static List <KeyFrameC> GetKFList(int channel) { List <KeyFrameC> carKFList = new List <KeyFrameC> (); int kfCount = GetListCount(2, channel); for (int i = 0; i < kfCount; i++) { IntPtr pkfLinks1 = new IntPtr(); IntPtr pkfLinks2 = new IntPtr(); IntPtr pkfLinks3 = new IntPtr(); IntPtr pkfLinksVal1 = new IntPtr(); IntPtr pkfLinksVal2 = new IntPtr(); IntPtr pkfLinksVal3 = new IntPtr(); IntPtr pmpLinks = new IntPtr(); KeyFrameCpp item = GetKFListCpp(channel, i, ref pkfLinks1, ref pkfLinks2, ref pkfLinks3, ref pkfLinksVal1, ref pkfLinksVal2, ref pkfLinksVal3, ref pmpLinks); if (item.id != -1) { KeyFrameC itemKF = new KeyFrameC(); itemKF.id = item.id; itemKF.pos = new Vector3(item.x, item.y, item.z); itemKF.pos = itemKF.pos * scale; itemKF.right = new Vector3(item.r00, item.r10, item.r20); itemKF.forward = new Vector3(item.r02, item.r12, item.r22); itemKF.up = new Vector3(item.r01, item.r11, item.r21); itemKF.color = new Color32((byte)item.r, (byte)item.g, (byte)item.b, 255); itemKF.filter1 = item.filter1; itemKF.filter2 = item.filter2; itemKF.filter3 = item.filter3; if (item.mpLinksCount > 0) { itemKF.mpLinks = new int[item.mpLinksCount]; Marshal.Copy(pmpLinks, itemKF.mpLinks, 0, item.mpLinksCount); } if (item.kfLinksCount1 > 0) { itemKF.kfLinks1 = new int[item.kfLinksCount1]; Marshal.Copy(pkfLinks1, itemKF.kfLinks1, 0, item.kfLinksCount1); itemKF.kfLinksVal1 = new int[item.kfLinksCount1]; Marshal.Copy(pkfLinksVal1, itemKF.kfLinksVal1, 0, item.kfLinksCount1); } if (item.kfLinksCount2 > 0) { itemKF.kfLinks2 = new int[item.kfLinksCount2]; Marshal.Copy(pkfLinks2, itemKF.kfLinks2, 0, item.kfLinksCount2); itemKF.kfLinksVal2 = new int[item.kfLinksCount2]; Marshal.Copy(pkfLinksVal2, itemKF.kfLinksVal2, 0, item.kfLinksCount2); } //Debug.Log ("item.kfLinksCount3:"+item.kfLinksCount3); if (item.kfLinksCount3 > 0) { itemKF.kfLinks3 = new int[item.kfLinksCount3]; Marshal.Copy(pkfLinks3, itemKF.kfLinks3, 0, item.kfLinksCount3); itemKF.kfLinksVal3 = new int[item.kfLinksCount3]; Marshal.Copy(pkfLinksVal3, itemKF.kfLinksVal3, 0, item.kfLinksCount3); } carKFList.Add(itemKF); } } return(carKFList); }
public void ConnectKF(int minVal, int maxVal, int kfId, int con_type, Color32 color) { int ind = findKFInd(kfId); int[] list; int[] listVal; if (con_type == 0) { list = KFList [ind].kfLinks1; listVal = KFList [ind].kfLinksVal1; } else if (con_type == 1) { list = KFList [ind].kfLinks2; listVal = KFList [ind].kfLinksVal2; } else if (con_type == 2) { list = KFList [ind].kfLinks3; listVal = KFList [ind].kfLinksVal3; } else { return; } if (list == null) { Debug.LogError("There is no data for this connection of keyframe. Id:" + kfId); return; } lineMesh tempObj = lineMesh.create(); tempObj.transform.SetParent(kfConnectionRoot); tempObj.color = color; for (int i = 0; i < list.Length; i++) { if (maxVal >= listVal [i] && minVal <= listVal [i]) { int kfInd = findKFInd(list [i]); if (kfInd != -1) { KeyFrameC item = KFList [kfInd]; GetMarkObj(kfInd).ChangeColor(color); tempObj.addLine(KFList [ind].pos, item.pos); } else { Debug.LogError("keyframe " + list [i] + "is not found!!"); } } } tempObj.createMesh(); }
public void changeScale(int scale) { kfTrajRoot.GetComponent <lineMesh> ().changeScale(scale); for (int i = 0; i < KFList.Count; i++) { KeyFrameC item = KFList [i]; item.pos = item.pos * scale / 100.0f; KFList [i] = item; Transform child = kfMarkRoot.GetChild(i); child.position = KFList [i].pos; } ClearKFConnection(); }
public string GetKFInfo(int kfId) { int ind = findKFInd(kfId); KeyFrameC item = KFList [ind]; if (item == null) { Debug.LogError("keyframe id: " + kfId + "not found!"); return(""); } string re = "kfId:" + item.id + " pos:" + item.pos.ToString(); re = re + " filter1:" + item.filter1 + " filter2:" + item.filter2 + " filter3:" + item.filter3 + '\n'; if (item.kfLinks1 != null) { re = re + " linkVal1: "; for (int i = 0; i < item.kfLinks1.Length; i++) { re = re + "[" + item.kfLinks1 [i] + ":" + item.kfLinksVal1 [i] + "]"; } re = re + '\n'; } if (item.kfLinks2 != null) { re = re + " linkVal2: "; for (int i = 0; i < item.kfLinks2.Length; i++) { re = re + "[" + item.kfLinks2 [i] + ":" + item.kfLinksVal2 [i] + "]"; } re = re + '\n'; } if (item.kfLinks3 != null) { re = re + " linkVal3: "; for (int i = 0; i < item.kfLinks3.Length; i++) { re = re + "[" + item.kfLinks3 [i] + ":" + item.kfLinksVal3 [i] + "]"; } re = re + '\n'; } re = re + "================================\n"; return(re); }