public static byte[] GetBytes(Data.LocationValues value, Data.ParentEffectType parentEffectType) { //if (parentEffectType != Data.ParentEffectType.NotBind) magnification = 1.0f; List <byte[]> data = new List <byte[]>(); data.Add(value.Type.GetValueAsInt().GetBytes()); if (value.Type.GetValue() == Data.LocationValues.ParamaterType.Fixed) { var bytes = Translation_Fixed_Values.Create(value.Fixed, 1.0f).GetBytes(); data.Add(bytes.Count().GetBytes()); data.Add(bytes); } else if (value.Type.GetValue() == Data.LocationValues.ParamaterType.PVA) { var bytes = Translation_PVA_Values.Create(value.PVA, 1.0f).GetBytes(); data.Add(bytes.Count().GetBytes()); data.Add(bytes); } else if (value.Type.GetValue() == Data.LocationValues.ParamaterType.Easing) { var easing = Utl.MathUtl.Easing((float)value.Easing.StartSpeed.Value, (float)value.Easing.EndSpeed.Value); List <byte[]> _data = new List <byte[]>(); _data.Add(value.Easing.Start.GetBytes(1.0f)); _data.Add(value.Easing.End.GetBytes(1.0f)); _data.Add(BitConverter.GetBytes(easing[0])); _data.Add(BitConverter.GetBytes(easing[1])); _data.Add(BitConverter.GetBytes(easing[2])); var __data = _data.ToArray().ToArray(); data.Add(__data.Count().GetBytes()); data.Add(__data); } else if (value.Type.GetValue() == Data.LocationValues.ParamaterType.LocationFCurve) { var bytes1 = value.LocationFCurve.FCurve.GetBytes(); List <byte[]> _data = new List <byte[]>(); data.Add(bytes1.Count().GetBytes()); data.Add(bytes1); } return(data.ToArray().ToArray()); }
public static byte[] GetBytes(Data.LocationValues value, Data.ParentEffectType parentEffectType, Dictionary <string, int> curveAndIndex, ExporterVersion version) { //if (parentEffectType != Data.ParentEffectType.NotBind) magnification = 1.0f; var type = value.Type.Value; // Fall back if (version < ExporterVersion.Ver16Alpha1) { if (type == Data.LocationValues.ParamaterType.NurbsCurve || type == Data.LocationValues.ParamaterType.ViewOffset) { type = Data.LocationValues.ParamaterType.Fixed; } } List <byte[]> data = new List <byte[]>(); data.Add(((int)type).GetBytes()); if (type == Data.LocationValues.ParamaterType.Fixed) { var refBuf = value.Fixed.Location.DynamicEquation.Index.GetBytes(); var mainBuf = Translation_Fixed_Values.Create(value.Fixed, 1.0f).GetBytes(); data.Add((mainBuf.Count() + refBuf.Count()).GetBytes()); data.Add(refBuf); data.Add(mainBuf); } else if (type == Data.LocationValues.ParamaterType.PVA) { var refBuf1_1 = value.PVA.Location.DynamicEquationMax.Index.GetBytes(); var refBuf1_2 = value.PVA.Location.DynamicEquationMin.Index.GetBytes(); var refBuf2_1 = value.PVA.Velocity.DynamicEquationMax.Index.GetBytes(); var refBuf2_2 = value.PVA.Velocity.DynamicEquationMin.Index.GetBytes(); var refBuf3_1 = value.PVA.Acceleration.DynamicEquationMax.Index.GetBytes(); var refBuf3_2 = value.PVA.Acceleration.DynamicEquationMin.Index.GetBytes(); var mainBuf = Translation_PVA_Values.Create(value.PVA, 1.0f).GetBytes(); data.Add((mainBuf.Count() + refBuf1_1.Count() * 6).GetBytes()); data.Add(refBuf1_1); data.Add(refBuf1_2); data.Add(refBuf2_1); data.Add(refBuf2_2); data.Add(refBuf3_1); data.Add(refBuf3_2); data.Add(mainBuf); } else if (type == Data.LocationValues.ParamaterType.Easing) { Utils.ExportEasing(value.Easing, 1.0f, data, version); } else if (type == Data.LocationValues.ParamaterType.LocationFCurve) { var bytes1 = value.LocationFCurve.FCurve.GetBytes(); List <byte[]> _data = new List <byte[]>(); data.Add(bytes1.Count().GetBytes()); data.Add(bytes1); } else if (type == Data.LocationValues.ParamaterType.NurbsCurve) { if (value.NurbsCurve.FilePath.RelativePath != string.Empty) { // export index var relative_path = value.NurbsCurve.FilePath.RelativePath; if (relative_path != System.IO.Path.GetFileName(value.NurbsCurve.FilePath.RelativePath)) { relative_path = System.IO.Path.GetDirectoryName(relative_path) + "/" + System.IO.Path.GetFileNameWithoutExtension(relative_path) + ".efkcurve"; } else { relative_path = System.IO.Path.GetFileNameWithoutExtension(relative_path) + ".efkcurve"; } data.Add(curveAndIndex[relative_path].GetBytes()); } else { data.Add((-1).GetBytes()); } data.Add(BitConverter.GetBytes(value.NurbsCurve.Scale)); data.Add(BitConverter.GetBytes(value.NurbsCurve.MoveSpeed)); data.Add(value.NurbsCurve.LoopType.GetValueAsInt().GetBytes()); } else if (type == Data.LocationValues.ParamaterType.ViewOffset) { data.Add(value.ViewOffset.Distance.Max.GetBytes()); data.Add(value.ViewOffset.Distance.Min.GetBytes()); } return(data.ToArray().ToArray()); }
public static byte[] GetBytes(Data.LocationValues value, Data.ParentEffectType parentEffectType) { //if (parentEffectType != Data.ParentEffectType.NotBind) magnification = 1.0f; List <byte[]> data = new List <byte[]>(); data.Add(value.Type.GetValueAsInt().GetBytes()); if (value.Type.GetValue() == Data.LocationValues.ParamaterType.Fixed) { var refBuf = Core.Dynamic.Equations.GetIndex(value.Fixed.Location.DynamicEquation).GetBytes(); var mainBuf = Translation_Fixed_Values.Create(value.Fixed, 1.0f).GetBytes(); data.Add((mainBuf.Count() + refBuf.Count()).GetBytes()); data.Add(refBuf); data.Add(mainBuf); } else if (value.Type.GetValue() == Data.LocationValues.ParamaterType.PVA) { var refBuf1_1 = Core.Dynamic.Equations.GetIndex(value.PVA.Location.DynamicEquationMax).GetBytes(); var refBuf1_2 = Core.Dynamic.Equations.GetIndex(value.PVA.Location.DynamicEquationMin).GetBytes(); var refBuf2_1 = Core.Dynamic.Equations.GetIndex(value.PVA.Velocity.DynamicEquationMax).GetBytes(); var refBuf2_2 = Core.Dynamic.Equations.GetIndex(value.PVA.Velocity.DynamicEquationMin).GetBytes(); var refBuf3_1 = Core.Dynamic.Equations.GetIndex(value.PVA.Acceleration.DynamicEquationMax).GetBytes(); var refBuf3_2 = Core.Dynamic.Equations.GetIndex(value.PVA.Acceleration.DynamicEquationMin).GetBytes(); var mainBuf = Translation_PVA_Values.Create(value.PVA, 1.0f).GetBytes(); data.Add((mainBuf.Count() + refBuf1_1.Count() * 6).GetBytes()); data.Add(refBuf1_1); data.Add(refBuf1_2); data.Add(refBuf2_1); data.Add(refBuf2_2); data.Add(refBuf3_1); data.Add(refBuf3_2); data.Add(mainBuf); } else if (value.Type.GetValue() == Data.LocationValues.ParamaterType.Easing) { var easing = Utl.MathUtl.Easing((float)value.Easing.StartSpeed.Value, (float)value.Easing.EndSpeed.Value); var refBuf1_1 = Core.Dynamic.Equations.GetIndex(value.Easing.Start.DynamicEquationMax).GetBytes(); var refBuf1_2 = Core.Dynamic.Equations.GetIndex(value.Easing.Start.DynamicEquationMin).GetBytes(); var refBuf2_1 = Core.Dynamic.Equations.GetIndex(value.Easing.End.DynamicEquationMax).GetBytes(); var refBuf2_2 = Core.Dynamic.Equations.GetIndex(value.Easing.End.DynamicEquationMin).GetBytes(); List <byte[]> _data = new List <byte[]>(); _data.Add(refBuf1_1); _data.Add(refBuf1_2); _data.Add(refBuf2_1); _data.Add(refBuf2_2); _data.Add(value.Easing.Start.GetBytes(1.0f)); _data.Add(value.Easing.End.GetBytes(1.0f)); _data.Add(BitConverter.GetBytes(easing[0])); _data.Add(BitConverter.GetBytes(easing[1])); _data.Add(BitConverter.GetBytes(easing[2])); var __data = _data.ToArray().ToArray(); data.Add(__data.Count().GetBytes()); data.Add(__data); } else if (value.Type.GetValue() == Data.LocationValues.ParamaterType.LocationFCurve) { var bytes1 = value.LocationFCurve.FCurve.GetBytes(); List <byte[]> _data = new List <byte[]>(); data.Add(bytes1.Count().GetBytes()); data.Add(bytes1); } return(data.ToArray().ToArray()); }
public static byte[] GetBytes(Data.LocationValues value, Data.ParentEffectType parentEffectType, Dictionary <string, int> curveAndIndex, ExporterVersion version) { //if (parentEffectType != Data.ParentEffectType.NotBind) magnification = 1.0f; var type = value.Type.Value; // Fall back if (version < ExporterVersion.Ver1600) { if (type == Data.LocationValues.ParamaterType.NurbsCurve || type == Data.LocationValues.ParamaterType.ViewOffset) { type = Data.LocationValues.ParamaterType.Fixed; } } List <byte[]> data = new List <byte[]>(); data.Add(((int)type).GetBytes()); if (type == Data.LocationValues.ParamaterType.Fixed) { var refBuf = value.Fixed.Location.DynamicEquation.Index.GetBytes(); var mainBuf = Translation_Fixed_Values.Create(value.Fixed, 1.0f).GetBytes(); data.Add((mainBuf.Count() + refBuf.Count()).GetBytes()); data.Add(refBuf); data.Add(mainBuf); } else if (type == Data.LocationValues.ParamaterType.PVA) { var refBuf1_1 = value.PVA.Location.DynamicEquationMax.Index.GetBytes(); var refBuf1_2 = value.PVA.Location.DynamicEquationMin.Index.GetBytes(); var refBuf2_1 = value.PVA.Velocity.DynamicEquationMax.Index.GetBytes(); var refBuf2_2 = value.PVA.Velocity.DynamicEquationMin.Index.GetBytes(); var refBuf3_1 = value.PVA.Acceleration.DynamicEquationMax.Index.GetBytes(); var refBuf3_2 = value.PVA.Acceleration.DynamicEquationMin.Index.GetBytes(); var mainBuf = Translation_PVA_Values.Create(value.PVA, 1.0f).GetBytes(); data.Add((mainBuf.Count() + refBuf1_1.Count() * 6).GetBytes()); data.Add(refBuf1_1); data.Add(refBuf1_2); data.Add(refBuf2_1); data.Add(refBuf2_2); data.Add(refBuf3_1); data.Add(refBuf3_2); data.Add(mainBuf); } else if (type == Data.LocationValues.ParamaterType.Easing) { var easing = Utl.MathUtl.Easing((float)value.Easing.StartSpeed.Value, (float)value.Easing.EndSpeed.Value); var refBuf1_1 = value.Easing.Start.DynamicEquationMax.Index.GetBytes(); var refBuf1_2 = value.Easing.Start.DynamicEquationMin.Index.GetBytes(); var refBuf2_1 = value.Easing.End.DynamicEquationMax.Index.GetBytes(); var refBuf2_2 = value.Easing.End.DynamicEquationMin.Index.GetBytes(); List <byte[]> _data = new List <byte[]>(); _data.Add(refBuf1_1); _data.Add(refBuf1_2); _data.Add(refBuf2_1); _data.Add(refBuf2_2); _data.Add(value.Easing.Start.GetBytes(1.0f)); _data.Add(value.Easing.End.GetBytes(1.0f)); _data.Add(BitConverter.GetBytes(easing[0])); _data.Add(BitConverter.GetBytes(easing[1])); _data.Add(BitConverter.GetBytes(easing[2])); var __data = _data.ToArray().ToArray(); data.Add(__data.Count().GetBytes()); data.Add(__data); } else if (type == Data.LocationValues.ParamaterType.LocationFCurve) { var bytes1 = value.LocationFCurve.FCurve.GetBytes(); List <byte[]> _data = new List <byte[]>(); data.Add(bytes1.Count().GetBytes()); data.Add(bytes1); } else if (type == Data.LocationValues.ParamaterType.NurbsCurve) { if (value.NurbsCurve.FilePath.RelativePath != string.Empty) { // export index var relative_path = value.NurbsCurve.FilePath.RelativePath; data.Add(curveAndIndex[relative_path].GetBytes()); } else { data.Add((-1).GetBytes()); } data.Add(BitConverter.GetBytes(value.NurbsCurve.Scale)); data.Add(BitConverter.GetBytes(value.NurbsCurve.MoveSpeed)); data.Add(value.NurbsCurve.LoopType.GetValueAsInt().GetBytes()); } else if (type == Data.LocationValues.ParamaterType.ViewOffset) { data.Add(value.ViewOffset.Distance.Max.GetBytes()); data.Add(value.ViewOffset.Distance.Min.GetBytes()); } return(data.ToArray().ToArray()); }