コード例 #1
0
        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();
        }
コード例 #2
0
        private void WriteAllFlags()
        {
            if (Main_OMF == null)
            {
                return;
            }
            AnimationParams CurrentAnim = listBox1.SelectedItem as AnimationParams;

            for (int i = 1; i < 8; i++)
            {
                CurrentAnim.Flags = BitSet(CurrentAnim.Flags, (1 << i), Boxes[i - 1].Checked);
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: mrnotbadguy/omf_editor
        private void TextBoxFilter(object sender, EventArgs e)
        {
            if (Main_OMF == null || !bTextBoxEnabled)
            {
                return;
            }

            TextBox current = sender as TextBox;

            if (bKeyIsDown)
            {
                string mask  = current.Tag.ToString() == "MotionName" ? @"^[A-Za-z0-9_$]*$" : number_mask;
                Match  match = Regex.Match(current.Text, mask);
                if (!match.Success)
                {
                    int temp = current.SelectionStart;
                    current.Text           = current.Text.Remove(current.SelectionStart - 1, 1);
                    current.SelectionStart = temp - 1;
                }
            }

            bKeyIsDown = false;

            AnimationParams CurrentAnim = listBox1.SelectedItem as AnimationParams;

            switch (current.Tag.ToString())
            {
            case "Speed": CurrentAnim.Speed = Convert.ToSingle(current.Text); break;

            case "Power": CurrentAnim.Power = Convert.ToSingle(current.Text); break;

            case "Accrue": CurrentAnim.Accrue = Convert.ToSingle(current.Text); break;

            case "Falloff": CurrentAnim.Falloff = Convert.ToSingle(current.Text); break;

            case "MotionName":
            {
                if (CurrentAnim.Name == current.Text)
                {
                    return;
                }
                CurrentAnim.Name = current.Text;
                int index = CurrentAnim.MotionID;
                Main_OMF.Anims[index].Name = current.Text;
                UpdateList(true);
            }
            break;

            default: break;
            }
        }
コード例 #4
0
        private void FillFlagsStates()
        {
            if (Main_OMF == null)
            {
                return;
            }

            AnimationParams CurrentAnim = listBox1.SelectedItem as AnimationParams;
            int             Flags       = CurrentAnim.Flags;

            for (int i = 1; i < 8; i++)
            {
                Boxes[i - 1].Checked = (Flags & (1 << i)) == (1 << i);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
 public void AddAnimParams(AnimationParams param)
 {
     AnimsParams.Add(param);
 }