Esempio n. 1
0
        private void removeAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (SelectedAnimation == null || type == 0)
            {
                return;
            }

            SRT0TextureNode _target = SelectedAnimation.FindChild(TargetTexRef.Parent.Name + "/Texture" + TargetTexRef.Index, true) as SRT0TextureNode;

            if (_target != null)
            {
                _target.Keyframes._keyRoots[type & 0xF]  = new KeyframeEntry(-1, type >= 0x10 && type <= 0x12 ? 1 : 0);
                _target.Keyframes._keyCounts[type & 0xF] = 0;
                _target.SignalPropertyChange();
                ResetBox(type - 0x10);
                _mainWindow.UpdateModel();
            }
        }
Esempio n. 2
0
        private void toolStripMenuItem4_Click(object sender, EventArgs e)
        {
            if (SelectedAnimation == null || type == 0)
            {
                return;
            }

            KeyframeEntry   kfe;
            SRT0TextureNode _target = SelectedAnimation.FindChild(TargetTexRef.Parent.Name + "/Texture" + TargetTexRef.Index, true) as SRT0TextureNode;

            for (int x = 0; x < _target.FrameCount; x++)                        //Loop thru each frame
            {
                if ((kfe = _target.GetKeyframe((KeyFrameMode)type, x)) != null) //Check for a keyframe
                {
                    kfe._value += 90;
                }
            }
            ResetBox(type - 0x10);
            _mainWindow.UpdateModel();
        }
Esempio n. 3
0
        public void RootChanged()
        {
            ResourceNode node = _targetNode;

            if (node is ISCN0KeyframeHolder)
            {
                if (node is SCN0LightNode)
                {
                    SCN0LightNode n = node as SCN0LightNode;

                    interpolationViewer.FrameLimit = n.FrameCount;
                    interpolationViewer.KeyRoot    = n.GetKeys(SelectedMode)._keyRoot;
                }
                else if (node is SCN0FogNode)
                {
                    SCN0FogNode n = node as SCN0FogNode;

                    interpolationViewer.FrameLimit = n.FrameCount;
                    interpolationViewer.KeyRoot    = n.GetKeys(SelectedMode)._keyRoot;
                }
                else if (node is SCN0CameraNode)
                {
                    SCN0CameraNode n = node as SCN0CameraNode;

                    interpolationViewer.FrameLimit = n.FrameCount;
                    interpolationViewer.KeyRoot    = n.GetKeys(SelectedMode)._keyRoot;
                }
            }
            else if (node is IKeyframeHolder)
            {
                if (node is CHR0EntryNode)
                {
                    CHR0EntryNode n = node as CHR0EntryNode;

                    interpolationViewer.FrameLimit = n._keyframes._frameCount;
                    interpolationViewer.KeyRoot    = n._keyframes._keyRoots[SelectedMode];
                }
                else if (node is SRT0TextureNode)
                {
                    SRT0TextureNode n = node as SRT0TextureNode;

                    interpolationViewer.FrameLimit = n._keyframes._frameCount;
                    int i = SelectedMode;
                    if (i == 2)
                    {
                        i = 3;
                    }
                    else if (i > 2)
                    {
                        i += 3;
                    }
                    interpolationViewer.KeyRoot = n._keyframes._keyRoots[i];
                }
            }
            else if (node is IKeyframeArrayHolder)
            {
                comboBox1.Enabled = false;

                if (node is SHP0VertexSetNode)
                {
                    SHP0VertexSetNode n = node as SHP0VertexSetNode;

                    interpolationViewer.FrameLimit = n._keyframes._frameLimit;
                    interpolationViewer.KeyRoot    = n._keyframes._keyRoot;
                }
            }
        }
Esempio n. 4
0
        internal unsafe void BoxChanged(object sender, EventArgs e)
        {
            if (TargetTexRef == null || sender == null)
            {
                return;
            }

            NumericInputBox box   = sender as NumericInputBox;
            int             index = (int)box.Tag;

            if (index == 2 || index == 4 || index == 5 || index == 8)
            {
                return;
            }

            MDL0MaterialRefNode mr = TargetTexRef;

            if ((SelectedAnimation != null) && (CurrentFrame > 0))
            {
                SRT0TextureNode entry = SelectedAnimation.FindChild(mr.Parent.Name + "/Texture" + mr.Index, true) as SRT0TextureNode;

                if (entry == null)
                {
                    if (!float.IsNaN(box.Value))
                    {
                        entry = SelectedAnimation.FindOrCreateEntry(mr.Parent.Name, mr.Index);

                        //Set initial values (so they aren't null)
                        FrameState state = mr._bindState; //Get the texture's bindstate
                        float *    p     = (float *)&state;
                        for (int i = 0; i < 3; i++)       //Get the scale
                        {
                            if (p[i] != 1.0f)             //Check for default values
                            {
                                entry.SetKeyframe(KeyFrameMode.ScaleX + i, 0, p[i]);
                            }
                        }
                        for (int i = 3; i < 9; i++) //Get rotation and translation respectively
                        {
                            if (p[i] != 0.0f)       //Check for default values
                            {
                                entry.SetKeyframe(KeyFrameMode.ScaleX + i, 0, p[i]);
                            }
                        }
                        if (p[10] != 0.0f)
                        {
                            entry.SetKeyframe(KeyFrameMode.ScaleX + 10, 0, p[10]);
                        }

                        //Finally, replace with the changed value
                        entry.SetKeyframe(KeyFrameMode.ScaleX + index, CurrentFrame - 1, box.Value);
                    }
                }
                else //Set to existing SRT0 texture
                if (float.IsNaN(box.Value))
                {
                    entry.RemoveKeyframe(KeyFrameMode.ScaleX + index, CurrentFrame - 1);
                }
                else
                {
                    entry.SetKeyframe(KeyFrameMode.ScaleX + index, CurrentFrame - 1, box.Value);
                }
            }
            else
            {
                //Change base transform
                FrameState state = mr._bindState;
                float *    p     = (float *)&state;
                p[index]      = float.IsNaN(box.Value) ? (index > 2 ? 0.0f : 1.0f) : box.Value;
                mr._bindState = state;
                //mr.RecalcBindState();
                mr.SignalPropertyChange();
            }
            TargetModel.ApplySRT(SelectedAnimation, CurrentFrame);
            ResetBox(index);
            _mainWindow.modelPanel1.Invalidate();
        }