private Bone BuildBone(Resource.Skeletons.Bone bone, Bone parent) { var dataBone = new Bone(bone, parent); _bonesByIndex.Add(dataBone.Index, dataBone); var childBone = bone.FirstChild; while(childBone != null) { dataBone.Children.Add( BuildBone(childBone, dataBone) ); childBone = childBone.NextSibling; } return dataBone; }
internal Bone(Resource.Skeletons.Bone bone, Bone parent) { Parent = parent; Name = bone.Name; Index = bone.BoneIndex; Position = bone.Position; Rotation = bone.RotationEuler; AbsolutePosition = bone.AbsolutePosition; AbsoluteRotation = bone.AbsoluteRotationEuler; Children = new List<Bone>(); }
private static void ExportSkeleton(TextWriter sw, Bone bone) { sw.WriteLine("{0} {1} {2} {3} {4} {5} {6}", bone.Index, F(bone.Position.X), F(bone.Position.Y), F(bone.Position.Z), F(bone.Rotation.X), F(bone.Rotation.Y), F(bone.Rotation.Z)); foreach (var childBone in bone.Children) { ExportSkeleton(sw, childBone); } }
private static void ExportNodes(TextWriter sw, Bone bone, Bone parentBone) { sw.WriteLine("{0} \"{1}\" {2}", bone.Index, bone.Name, parentBone == null ? -1 : parentBone.Index); foreach (var childBone in bone.Children) { ExportNodes(sw, childBone, bone); } }
internal Skeleton(Resource.Skeletons.Skeleton skeleton) { _bonesByIndex = new Dictionary<int, Bone>(); RootBone = BuildBone(skeleton.Bones[0], null); }