Пример #1
0
 public DialogResult ShowDialog(IWin32Window owner, int type, IKeyframeSource target)
 {
     _target = target;
     _type   = type;
     comboBox1.Items.Add("Add");
     comboBox1.Items.Add("Subtract");
     comboBox1.SelectedIndex = 0;
     return(ShowDialog(owner));
 }
Пример #2
0
        public void SetTarget(IKeyframeSource node)
        {
            if ((_targetNode = node) != null)
            {
                panel1.Enabled      = true;
                cbTransform.Enabled = true;
                if (node is SCN0EntryNode)
                {
                    if (node is SCN0LightNode)
                    {
                        //chkGenTans.Checked = SCN0LightNode._generateTangents;

                        if (_modes.Count != 10)
                        {
                            _updating = true;
                            _modes.Clear();
                            _modes.Add("Start X");
                            _modes.Add("Start Y");
                            _modes.Add("Start Z");
                            _modes.Add("End X");
                            _modes.Add("End Y");
                            _modes.Add("End Z");
                            _modes.Add("Spotlight Cutoff");
                            _modes.Add("Spotlight Brightness");
                            _modes.Add("Reference Distance");
                            _modes.Add("Reference Brightness");

                            cbTransform.SelectedIndex = 0;
                            _updating = false;
                        }
                    }
                    else if (node is SCN0FogNode)
                    {
                        //chkGenTans.Checked = SCN0FogNode._generateTangents;

                        if (_modes.Count != 2)
                        {
                            _updating = true;
                            _modes.Clear();
                            _modes.Add("Start Z");
                            _modes.Add("End Z");

                            cbTransform.SelectedIndex = 0;
                            _updating = false;
                        }
                    }
                    else if (node is SCN0CameraNode)
                    {
                        //chkGenTans.Checked = SCN0CameraNode._generateTangents;

                        if (_modes.Count != 15)
                        {
                            _updating = true;
                            _modes.Clear();
                            _modes.Add("Position X");
                            _modes.Add("Position Y");
                            _modes.Add("Position Z");
                            _modes.Add("Aspect");
                            _modes.Add("Near Z");
                            _modes.Add("Far Z");
                            _modes.Add("Rotation X");
                            _modes.Add("Rotation Y");
                            _modes.Add("Rotation Z");
                            _modes.Add("Aim X");
                            _modes.Add("Aim Y");
                            _modes.Add("Aim Z");
                            _modes.Add("Twist");
                            _modes.Add("Vertical Field of View");
                            _modes.Add("Height");

                            cbTransform.SelectedIndex = 0;
                            _updating = false;
                        }
                    }
                }
                else if (node is IKeyframeSource)
                {
                    if (node is CHR0EntryNode)
                    {
                        //chkGenTans.Checked = CHR0EntryNode._generateTangents;

                        if (_modes.Count != 9)
                        {
                            _updating = true;
                            _modes.Clear();
                            _modes.Add("Scale X");
                            _modes.Add("Scale Y");
                            _modes.Add("Scale Z");
                            _modes.Add("Rotation X");
                            _modes.Add("Rotation Y");
                            _modes.Add("Rotation Z");
                            _modes.Add("Translation X");
                            _modes.Add("Translation Y");
                            _modes.Add("Translation Z");

                            cbTransform.SelectedIndex = 0;
                            _updating = false;
                        }
                    }
                    else if (node is SRT0TextureNode)
                    {
                        //chkGenTans.Checked = SRT0TextureNode._generateTangents;

                        if (_modes.Count != 5)
                        {
                            _updating = true;
                            _modes.Clear();
                            _modes.Add("Scale X");
                            _modes.Add("Scale Y");
                            _modes.Add("Rotation");
                            _modes.Add("Translation X");
                            _modes.Add("Translation Y");

                            cbTransform.SelectedIndex = 0;
                            _updating = false;
                        }
                    }
                    else if (node is SHP0VertexSetNode)
                    {
                        //chkGenTans.Checked = SHP0VertexSetNode._generateTangents;

                        if (_modes.Count != 1)
                        {
                            _updating = true;

                            _modes.Clear();
                            _modes.Add("Percentage");

                            cbTransform.SelectedIndex = 0;

                            _updating = false;
                        }
                    }
                }
                if (cbTransform.Items.Count > 0)
                {
                    cbTransform.SelectedIndex = 0;
                }
                else
                {
                    cbTransform.SelectedIndex = -1;
                }
                cbTransform.Enabled = cbTransform.Items.Count > 1;
                RootChanged();
            }
            else
            {
                interpolationViewer.KeyRoot = null;
                panel1.Enabled = false;
            }
        }
Пример #3
0
        public void UpdateKeyframes()
        {
            listKeyframes.Items.Clear();
            bool t = _updating;

            _updating = true;
            if (_target is CHR0EntryNode || _target is SRT0TextureNode)
            {
                IKeyframeSource entry = _target as IKeyframeSource;
                if (entry.FrameCount > 0)
                {
                    if (_target is CHR0EntryNode)
                    {
                        CHRAnimationFrame a;
                        for (int x = 0; x < entry.FrameCount; x++)
                        {
                            if ((a = ((CHR0EntryNode)entry).GetAnimFrame(x)).HasKeys)
                            {
                                listKeyframes.Items.Add(a);
                            }
                        }
                    }
                    else if (_target is SRT0TextureNode)
                    {
                        SRTAnimationFrame a;
                        for (int x = 0; x < entry.FrameCount; x++)
                        {
                            if ((a = ((SRT0TextureNode)entry).GetAnimFrame(x)).HasKeys)
                            {
                                listKeyframes.Items.Add(a);
                            }
                        }
                    }
                }
            }
            else if (_target is SHP0VertexSetNode)
            {
                SHP0VertexSetNode e = _target as SHP0VertexSetNode;
                if (e.FrameCount > 0)
                {
                    for (KeyframeEntry entry = e.Keyframes._keyRoot._next; entry != e.Keyframes._keyRoot; entry = entry._next)
                    {
                        listKeyframes.Items.Add(new FloatKeyframe(entry));
                    }
                }
            }
            else if (_target is SCN0EntryNode)
            {
                if (_target is SCN0CameraNode)
                {
                    CameraAnimationFrame a;
                    SCN0CameraNode       entry = _target as SCN0CameraNode;
                    if (entry.FrameCount > 0)
                    {
                        for (int x = 0; x < entry.FrameCount; x++)
                        {
                            if ((a = entry.GetAnimFrame(x)).HasKeys)
                            {
                                listKeyframes.Items.Add(a);
                            }
                        }
                    }
                }
                else if (_target is SCN0LightNode)
                {
                    LightAnimationFrame a;
                    SCN0LightNode       entry = _target as SCN0LightNode;
                    if (entry.FrameCount > 0)
                    {
                        for (int x = 0; x < entry.FrameCount; x++)
                        {
                            if ((a = entry.GetAnimFrame(x)).HasKeys)
                            {
                                listKeyframes.Items.Add(a);
                            }
                        }
                    }
                }
                else if (_target is SCN0FogNode)
                {
                    FogAnimationFrame a;
                    SCN0FogNode       entry = _target as SCN0FogNode;
                    if (entry.FrameCount > 0)
                    {
                        for (int x = 0; x < entry.FrameCount; x++)
                        {
                            if ((a = entry.GetAnimFrame(x)).HasKeys)
                            {
                                listKeyframes.Items.Add(a);
                            }
                        }
                    }
                }
            }
            _updating = t;
        }
Пример #4
0
        public void UpdateKeyframe(int x)
        {
            if (!Visible)
            {
                return;
            }

            _updating = true;
            if (_target is CHR0EntryNode || _target is SRT0TextureNode)
            {
                IKeyframeSource entry = _target as IKeyframeSource;
                for (int w = 0; w < listKeyframes.Items.Count; w++)
                {
                    if (_target is CHR0EntryNode)
                    {
                        CHRAnimationFrame a = (CHRAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            CHRAnimationFrame r = ((CHR0EntryNode)entry).GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }
                    else if (_target is SRT0TextureNode)
                    {
                        SRTAnimationFrame a = (SRTAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            SRTAnimationFrame r = ((SRT0TextureNode)entry).GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }
                }

                UpdateKeyframes();
            }
            else if (_target is SHP0VertexSetNode)
            {
                SHP0VertexSetNode entry = _target as SHP0VertexSetNode;
                int w = 0;
                foreach (FloatKeyframe a in listKeyframes.Items)
                {
                    if (a.Index == x)
                    {
                        KeyframeEntry e = entry.GetKeyframe(x);

                        if (e != null)
                        {
                            listKeyframes.Items[w] = new FloatKeyframe(e);
                        }
                        else
                        {
                            listKeyframes.Items.RemoveAt(w);
                        }

                        _updating = false;
                        return;
                    }
                    w++;
                }

                UpdateKeyframes();
            }
            else if (_target is SCN0EntryNode)
            {
                if (_target is SCN0CameraNode)
                {
                    SCN0CameraNode entry = _target as SCN0CameraNode;
                    for (int w = 0; w < listKeyframes.Items.Count; w++)
                    {
                        CameraAnimationFrame a = (CameraAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            CameraAnimationFrame r = entry.GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }

                    UpdateKeyframes();
                }
                else if (_target is SCN0LightNode)
                {
                    SCN0LightNode entry = _target as SCN0LightNode;
                    for (int w = 0; w < listKeyframes.Items.Count; w++)
                    {
                        LightAnimationFrame a = (LightAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            LightAnimationFrame r = entry.GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }

                    UpdateKeyframes();
                }
                else if (_target is SCN0FogNode)
                {
                    SCN0FogNode entry = _target as SCN0FogNode;
                    for (int w = 0; w < listKeyframes.Items.Count; w++)
                    {
                        FogAnimationFrame a = (FogAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            FogAnimationFrame r = entry.GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }

                    UpdateKeyframes();
                }
            }
            _updating = false;
        }