public static void Write(BinaryWriter writer, SoftwareAction softwareAction) { writer.Write(softwareAction.Name); writer.Write(softwareAction.FrameStart); writer.Write(softwareAction.FrameEnd); writer.Write(softwareAction.FCurves.Count); foreach (var curve in softwareAction.FCurves) { FCurve.Write(writer, curve); } }
public Action(BinaryReader reader) { Name = reader.ReadString(); FrameStart = reader.ReadSingle(); FrameEnd = reader.ReadSingle(); FCurves = new FCurve[reader.ReadInt32()]; for (int i = 0; i != FCurves.Length; ++i) { FCurves[i] = new FCurve(reader); } calculatedValues = new float[FCurves.Length]; }
protected override void linkObjects(string dataPath, FCurve curve, int i) { bool pass = false; for (int bi = 0; bi != Armature.Bones.Length; ++bi) { if (dataPath == Armature.Bones[bi].Name) { boneIndices[i] = bi; if (curve.Index == 0) { bindActionDatas[i] = bindBoneRotationX; } else if (curve.Index == 1) { bindActionDatas[i] = bindBoneRotationY; } else if (curve.Index == 2) { bindActionDatas[i] = bindBoneRotationZ; } else if (curve.Index == 3) { bindActionDatas[i] = bindBoneRotationW; } pass = true; break; } } if (!pass) { Debug.ThrowError("InstanceObjectArmature", "Failed to find Armature Bone: " + dataPath); } // link bones foreach (var bone in Bones) { bone.linkObjects(Bones); } // link bone childeren foreach (var bone in Bones) { bone.linkChilderen(Bones); } }
protected virtual void linkObjects(string dataPath, FCurve curve, int i) { // place holder... }
protected override void linkObjects(string dataPath, FCurve curve, int i) { bool pass = false; for (int bi = 0; bi != Armature.Bones.Length; ++bi) { if (dataPath == Armature.Bones[bi].Name) { boneIndices[i] = bi; if (curve.Index == 0) bindActionDatas[i] = bindBoneRotationX; else if (curve.Index == 1) bindActionDatas[i] = bindBoneRotationY; else if (curve.Index == 2) bindActionDatas[i] = bindBoneRotationZ; else if (curve.Index == 3) bindActionDatas[i] = bindBoneRotationW; pass = true; break; } } if (!pass) Debug.ThrowError("InstanceObjectArmature", "Failed to find Armature Bone: " + dataPath); // link bones foreach (var bone in Bones) { bone.linkObjects(Bones); } // link bone childeren foreach (var bone in Bones) { bone.linkChilderen(Bones); } }