예제 #1
0
        public static AnimationClip FromConfigFileLine( string line )
        {
            AnimationClip ret = new AnimationClip();

            try
            {
                string[] strs = line.Split( (char[])null, StringSplitOptions.RemoveEmptyEntries );

                if( strs.Length != 5 )
                    return null;

                ret.Name = strs[0];
                ret.FirstFrame = int.Parse( strs[1] );
                ret.LastFrame = ret.FirstFrame + int.Parse( strs[2] );

                int nLoop = int.Parse( strs[3] );

                ret.IsLooping = true;
                ret.FirstLoopingFrame = ret.LastFrame - nLoop;
                ret.LastLoopingFrame = ret.LastFrame;

                ret.FrameRate = (float)int.Parse( strs[4] );
            }
            catch
            {
                return null;
            }

            return ret;
        }
예제 #2
0
        private void AddAnimItem( AnimationClip clip )
        {
            ListViewItem lvi = lvAnims.Items.Add( clip.Name, 0 );
            lvi.SubItems.Add( clip.FirstFrame.ToString() );
            lvi.SubItems.Add( clip.LastFrame.ToString() );

            if( clip.IsLooping )
            {
                lvi.SubItems.Add( clip.FirstLoopingFrame.ToString() );
                lvi.SubItems.Add( clip.LastLoopingFrame.ToString() );
            }
            else
            {
                lvi.SubItems.Add( string.Empty );
                lvi.SubItems.Add( string.Empty );
            }

            lvi.SubItems.Add( clip.FrameRate.ToString() );

            lvi.Tag = clip;
        }
예제 #3
0
        public void SetAnimations( IEnumerable<AnimationClip> clips )
        {
            lvAnims.BeginUpdate();
            lvAnims.Items.Clear();

            if( model != null && model.Model != null )
            {
                Libx42.Model m = model.Model;

                AnimationClip clip = new AnimationClip();
                clip.Name = "[All Frames]";
                clip.FirstFrame = m.BaseFrame;
                clip.LastFrame = m.FrameCount;
                clip.IsLooping = true;
                clip.FirstLoopingFrame = clip.FirstFrame;
                clip.LastLoopingFrame = clip.LastFrame;
                clip.FrameRate = 30;

                AddAnimItem( clip );
            }

            foreach( AnimationClip clip in clips )
                AddAnimItem( clip );

            lvAnims.EndUpdate();
        }
예제 #4
0
 public AnimationClipEventArgs( AnimationClip clip )
 {
     this.clip = clip;
 }
예제 #5
0
        public static AnimationClip FromModelClip( Libx42.AnimationClip clip )
        {
            AnimationClip ret = new AnimationClip();

            ret.Name = clip.Name;

            ret.FirstFrame = clip.FirstFrame;
            ret.LastFrame = clip.LastFrame;

            ret.IsLooping = clip.IsLoopingAnimation;

            if( clip.IsLoopingAnimation )
            {
                ret.FirstLoopingFrame = clip.LoopStart;
                ret.LastLoopingFrame = clip.LoopEnd;
            }

            ret.FrameRate = clip.FrameRate;

            return ret;
        }
예제 #6
0
 public void SetAnimation( AnimationClip clip )
 {
     SetAnimation( clip.FirstFrame, clip.LastFrame, clip.IsLooping, clip.FirstLoopingFrame, clip.LastLoopingFrame, clip.FrameRate );
 }