public void CopyAnims(AnimationsContainer omf_1, AnimationsContainer omf_2, List <string> list) { omf_1.RecalcAnimNum(); short new_count = (short)omf_1.AnimsCount; for (int i = 0; i < omf_2.Anims.Count; i++) { AnimVector anim = omf_2.Anims[i]; for (int ii = 0; ii < list.Count; ii++) { if (anim.MotionName == list[ii]) { omf_1.AddAnim(anim); AnimationParams anim_param = omf_2.AnimsParams[i]; anim_param.MotionID = new_count; if ((omf_1.bone_cont.OGF_V != omf_2.bone_cont.OGF_V) && omf_1.bone_cont.OGF_V == 3) { anim_param.MarksCount = 0; anim_param.m_marks = null; } omf_1.AddAnimParams(anim_param); new_count++; } } } omf_1.RecalcAnimNum(); omf_1.RecalcAllAnimIndex(); }
AnimationsContainer OpenSecondOMF(string filename) { if (Main_OMF == null) { return(null); } AnimationsContainer new_omf = editor.OpenOMF(filename); if (new_omf == null) { return(new_omf); } int error_v = editor.CompareOMF(Main_OMF, new_omf); if (error_v == 1) { DialogResult result = GetErrorCode(1); if (DialogResult == DialogResult.No) { return(null); } } else if (error_v == 2) { GetErrorCode(2); } return(new_omf); }
private void SaveOMF(AnimationsContainer omf_file, string file_name) { using (BinaryWriter writer = new BinaryWriter(File.Create(file_name))) { editor.WriteOMF(writer, omf_file); } }
public void CopyAnims(AnimationsContainer omf_1, AnimationsContainer omf_2) { //bool omf_1.bone_cont.OGF_V != omf_2.bone_cont.OGF_V omf_1.RecalcAnimNum(); foreach (AnimVector anim in omf_2.Anims) { omf_1.AddAnim(anim); } short b = (short)omf_1.AnimsCount; foreach (AnimationParams anim_param in omf_2.AnimsParams) { anim_param.MotionID = b; if ((omf_1.bone_cont.OGF_V != omf_2.bone_cont.OGF_V) && omf_1.bone_cont.OGF_V == 3) { anim_param.MarksCount = 0; anim_param.m_marks = null; } omf_1.AddAnimParams(anim_param); b++; } omf_1.RecalcAnimNum(); omf_1.RecalcAllAnimIndex(); }
AnimationsContainer OpenSecondOMF(string filename) { if (Main_OMF == null) { return(null); } AnimationsContainer new_omf = editor.OpenOMF(filename); if (new_omf == null) { return(new_omf); } int error_v = editor.CompareOMF(Main_OMF, new_omf); if (error_v == 1) { DialogResult result = MessageBox.Show(rm.GetString("MERGE_ERROR_1"), "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult == DialogResult.No) { return(null); } } else if (error_v == 2) { MessageBox.Show(rm.GetString("MERGE_ERROR_2"), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(new_omf); }
private void OpenFile(string filename) { Main_OMF = editor.OpenOMF(filename); if (Main_OMF != null) { bs.DataSource = Main_OMF.AnimsParams; listBox1.DataSource = bs; listBox1.DisplayMember = "Name"; } }
private void AppendFile(string filename) { AnimationsContainer new_omf = OpenSecondOMF(filename); if (new_omf == null) { return; } editor.CopyAnims(Main_OMF, new_omf); UpdateList(); }
public void WriteOMF(BinaryWriter writer, AnimationsContainer omf_file) { omf_file.RecalcSectionSize(); omf_file.WriteAnimationContainer(writer, this); omf_file.bone_cont.WriteBoneCont(writer, this); writer.Write(omf_file.AnimsParamsCount); foreach (AnimationParams anim_param in omf_file.AnimsParams) { anim_param.WriteAnimationParams(writer, this, omf_file.bone_cont.OGF_V); } }
private void AppendFile(string filename, List <string> list) { AnimationsContainer new_omf = OpenSecondOMF(filename); if (new_omf == null) { return; } for (int i = 0; i < Main_OMF.Anims.Count; i++) { list.Remove(Main_OMF.Anims[i].MotionName); } editor.CopyAnims(Main_OMF, new_omf, list); UpdateList(); }
public int CompareOMF(AnimationsContainer omf_1, AnimationsContainer omf_2) { int error_v = 0; if (omf_1.bone_cont.Count != omf_2.bone_cont.Count) { return(error_v = 1); } else { for (int i = 0; i < omf_1.bone_cont.Count; i++) { if (omf_1.bone_cont.parts[i].Count != omf_2.bone_cont.parts[i].Count) { return(error_v = 1); } else { for (int b = 0; b < omf_1.bone_cont.parts[i].Count; b++) { if (omf_1.bone_cont.parts[i].bones[b].Name != omf_2.bone_cont.parts[i].bones[b].Name) { return(error_v = 1); } } } } } if (omf_1.bone_cont.OGF_V != omf_2.bone_cont.OGF_V) { return(error_v = 2); } else { return(error_v); } }
public AnimationsContainer OpenOMF(string filename) { using (BinaryReader reader = new BinaryReader(File.Open(filename, FileMode.Open))) { AnimationsContainer omf_file = new AnimationsContainer(reader, this); //Загрузка костей omf_file.bone_cont = new BoneContainer(reader, this); //Загрузка параметров анимаций omf_file.AnimsParamsCount = reader.ReadInt16(); //Проверка if (omf_file.AnimsCount != omf_file.AnimsParamsCount) { return(null); } for (int i = 0; i < omf_file.AnimsParamsCount; i++) { AnimationParams anm_p = new AnimationParams(reader, this, omf_file.bone_cont.OGF_V); omf_file.AddAnimParams(anm_p); } return(omf_file); } }