private void QueueBones(SBBone Bone, List <SBBone> Bones) { Bones.Add(Bone); foreach (var child in Bone.Children) { QueueBones(child, Bones); } }
/// <summary> /// Removes a child node from the skeleton /// </summary> /// <param name="child"></param> public void RemoveChild(SBBone child) { if (_children.Contains(child)) { child.Parent = null; _children.Remove(child); } }
public int IndexOfBone(SBBone bone) { int index = 0; foreach (var b in Bones) { if (b == bone) { return(index); } index++; } return(-1); }
/// <summary> /// /// </summary> /// <param name="skeleton"></param> /// <returns></returns> public static SBSkeleton FromIOSkeleton(IOSkeleton ioskel) { SBSkeleton skel = new SBSkeleton(); Dictionary <IOBone, SBBone> iotosb = new Dictionary <IOBone, SBBone>(); foreach (var iobone in ioskel.BreathFirstOrder()) { SBConsole.WriteLine(iobone.Name + " " + iobone.Scale + " " + iobone.Rotation + " " + iobone.Translation); SBBone bone = new SBBone() { Name = iobone.Name, SX = iobone.ScaleX, SY = iobone.ScaleY, SZ = iobone.ScaleZ, RX = iobone.RotationEuler.X, RY = iobone.RotationEuler.Y, RZ = iobone.RotationEuler.Z, X = iobone.TranslationX, Y = iobone.TranslationY, Z = iobone.TranslationZ, }; SBConsole.WriteLine(bone.Name + " " + bone.Translation.ToString() + " " + bone.Scale.ToString() + " " + bone.RotationQuaternion.ToString()); iotosb.Add(iobone, bone); if (iobone.Parent == null) { skel.AddRoot(bone); } else { bone.Parent = iotosb[iobone.Parent]; } } return(skel); }
public void AddRoot(SBBone bone) { RootBones.Add(bone); }
/// <summary> /// Adds a child node to the skeleton /// </summary> /// <param name="child"></param> public void AddChild(SBBone child) { _children.Add(child); }