/// <summary> /// /// </summary> /// <param name="root"></param> /// <param name="nodes"></param> /// <param name="flags"></param> /// <returns></returns> private HSD_AnimJoint ToAnimJointRecursive(HSD_JOBJ root, AOBJ_Flags flags) { HSD_AnimJoint joint = new HSD_AnimJoint(); joint.Flags = 1; AnimNode n = null; if (index >= Nodes.Count) { n = new AnimNode(); } else { n = Nodes[index++]; } // set flags if (n.Tracks.Count > 0) { joint.AOBJ = new HSD_AOBJ(); joint.AOBJ.Flags = flags; } // add all tracks foreach (var t in n.Tracks) { joint.AOBJ.EndFrame = Math.Max(joint.AOBJ.EndFrame, t.FrameCount); HSD_FOBJDesc fobj = t.ToFobjDesc(); if (joint.AOBJ.FObjDesc == null) { joint.AOBJ.FObjDesc = fobj; } else { joint.AOBJ.FObjDesc.Add(fobj); } } // set particle flag if (n.Tracks.Any(e => e.JointTrackType == JointTrackType.HSD_A_J_PTCL)) { joint.AOBJ.EndFrame += 0.1f; } foreach (var c in root.Children) { joint.AddChild(ToAnimJointRecursive(c, flags)); } return(joint); }
/// <summary> /// /// </summary> /// <param name="root"></param> /// <param name="nodes"></param> /// <param name="flags"></param> /// <returns></returns> private HSD_AnimJoint ToAnimJointRecursive(HSD_JOBJ root, AOBJ_Flags flags) { HSD_AnimJoint joint = new HSD_AnimJoint(); joint.Flags = 1; AnimNode n = null; if (index >= Nodes.Count) { n = new AnimNode(); } else { n = Nodes[index++]; } if (n.Tracks.Count > 0) { joint.AOBJ = new HSD_AOBJ(); joint.AOBJ.Flags = flags; } foreach (var t in n.Tracks) { joint.AOBJ.EndFrame = Math.Max(joint.AOBJ.EndFrame, t.FrameCount); HSD_FOBJDesc fobj = new HSD_FOBJDesc(); fobj.SetKeys(t.Keys, (byte)t.TrackType); if (joint.AOBJ.FObjDesc == null) { joint.AOBJ.FObjDesc = fobj; } else { joint.AOBJ.FObjDesc.Add(fobj); } } foreach (var c in root.Children) { joint.AddChild(ToAnimJointRecursive(c, flags)); } return(joint); }
/// <summary> /// /// </summary> /// <param name="root"></param> /// <param name="nodes"></param> /// <param name="flags"></param> /// <returns></returns> public HSD_AnimJoint ToAnimJoint(HSD_JOBJ root, AOBJ_Flags flags) { index = 0; return(ToAnimJointRecursive(root, flags)); }