示例#1
0
        public void ImportFolder(string inFolder)
        {
            DirectoryInfo dir = new DirectoryInfo(inFolder);

            FileInfo[] files;

            files = dir.GetFiles();
            foreach (FileInfo info in files)
            {
                string ext = Path.GetExtension(info.FullName).ToUpper();
                if (ext == ".PNG" || ext == ".TGA" || ext == ".BMP" || ext == ".JPG" || ext == ".JPEG" || ext == ".GIF" || ext == ".TIF" || ext == ".TIFF")
                {
                    using (TextureConverterDialog dlg = new TextureConverterDialog())
                    {
                        dlg.ImageSource = info.FullName;
                        dlg.ShowDialog(null, this);
                    }
                }
                else if (ext == ".TEX0")
                {
                    TEX0Node node = NodeFactory.FromFile(null, info.FullName) as TEX0Node;
                    GetOrCreateFolder <TEX0Node>().AddChild(node);
                }
                else if (ext == ".MDL0")
                {
                    MDL0Node node = NodeFactory.FromFile(null, info.FullName) as MDL0Node;
                    GetOrCreateFolder <MDL0Node>().AddChild(node);
                }
                else if (ext == ".CHR0")
                {
                    CHR0Node node = NodeFactory.FromFile(null, info.FullName) as CHR0Node;
                    GetOrCreateFolder <CHR0Node>().AddChild(node);
                }
                else if (ext == ".CLR0")
                {
                    CLR0Node node = NodeFactory.FromFile(null, info.FullName) as CLR0Node;
                    GetOrCreateFolder <CLR0Node>().AddChild(node);
                }
                else if (ext == ".SRT0")
                {
                    SRT0Node node = NodeFactory.FromFile(null, info.FullName) as SRT0Node;
                    GetOrCreateFolder <SRT0Node>().AddChild(node);
                }
                else if (ext == ".SHP0")
                {
                    SHP0Node node = NodeFactory.FromFile(null, info.FullName) as SHP0Node;
                    GetOrCreateFolder <SHP0Node>().AddChild(node);
                }
                else if (ext == ".PAT0")
                {
                    PAT0Node node = NodeFactory.FromFile(null, info.FullName) as PAT0Node;
                    GetOrCreateFolder <PAT0Node>().AddChild(node);
                }
                else if (ext == ".VIS0")
                {
                    VIS0Node node = NodeFactory.FromFile(null, info.FullName) as VIS0Node;
                    GetOrCreateFolder <VIS0Node>().AddChild(node);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(SRT0Node external)
        {
            KeyframeEntry kfe;

            int origIntCount = FrameCount;

            FrameCount += external.FrameCount;

            foreach (SRT0EntryNode w in external.Children)
            {
                foreach (SRT0TextureNode extEntry in w.Children)
                {
                    SRT0TextureNode intEntry = null;
                    if ((intEntry = (SRT0TextureNode)FindChild(w.Name + "/" + extEntry.Name, false)) == null)
                    {
                        SRT0EntryNode wi = null;
                        if ((wi = (SRT0EntryNode)FindChild(w.Name, false)) == null)
                        {
                            AddChild(wi = new SRT0EntryNode()
                            {
                                Name = FindName(null)
                            });
                        }

                        SRT0TextureNode newIntEntry = new SRT0TextureNode(extEntry.Index, extEntry.Indirect)
                        {
                            Name = extEntry.Name
                        };
                        newIntEntry.SetSize(extEntry.FrameCount + origIntCount, Loop);

                        for (int x = 0; x < extEntry.FrameCount; x++)
                        {
                            for (int i = 0; i < 5; i++)
                            {
                                if ((kfe = extEntry.GetKeyframe(i, x)) != null)
                                {
                                    newIntEntry.Keyframes.SetFrameValue(i, x + origIntCount, kfe._value)._tangent = kfe._tangent;
                                }
                            }
                        }
                        wi.AddChild(newIntEntry);
                    }
                    else
                    {
                        for (int x = 0; x < extEntry.FrameCount; x++)
                        {
                            for (int i = 0; i < 5; i++)
                            {
                                if ((kfe = extEntry.GetKeyframe(i, x)) != null)
                                {
                                    intEntry.Keyframes.SetFrameValue(i, x + origIntCount, kfe._value)._tangent = kfe._tangent;
                                }
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// Adds an animation opened by the user to the end of this one
        /// </summary>
        public void Append()
        {
            SRT0Node       external = null;
            OpenFileDialog o        = new OpenFileDialog();

            o.Filter = "SRT0 Animation (*.srt0)|*.srt0";
            o.Title  = "Please select an animation to append.";
            if (o.ShowDialog() == DialogResult.OK)
            {
                if ((external = (SRT0Node)NodeFactory.FromFile(null, o.FileName)) != null)
                {
                    Append(external);
                }
            }
        }
 public void ApplySRT(SRT0Node node, int index)
 {
     //Transform textures
     if (_matList != null)
         foreach (MDL0MaterialNode m in _matList)
             m.ApplySRT0(node, index, SRT0TextureNode._linear);
 }
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(SRT0Node external)
        {
            KeyframeEntry kfe;

            int origIntCount = FrameCount;
            FrameCount += external.FrameCount;

            foreach (SRT0EntryNode w in external.Children)
                foreach (SRT0TextureNode _extEntry in w.Children)
                {
                    SRT0TextureNode _intEntry = null;
                    if ((_intEntry = (SRT0TextureNode)FindChild(w.Name + "/" + _extEntry.Name, false)) == null)
                    {
                        SRT0EntryNode wi = null;
                        if ((wi = (SRT0EntryNode)FindChild(w.Name, false)) == null)
                            AddChild(wi = new SRT0EntryNode() { Name = FindName(null) });

                        SRT0TextureNode newIntEntry = new SRT0TextureNode(_extEntry.Index, _extEntry.Indirect) { Name = _extEntry.Name };
                        newIntEntry._numFrames = _extEntry.FrameCount + origIntCount;
                        for (int x = 0; x < _extEntry.FrameCount; x++)
                            for (int i = 0x10; i < 0x19; i++)
                                if ((kfe = _extEntry.GetKeyframe((KeyFrameMode)i, x)) != null)
                                    newIntEntry.Keyframes.SetFrameValue((KeyFrameMode)i, x + origIntCount, kfe._value)._tangent = kfe._tangent;
                        wi.AddChild(newIntEntry);
                    }
                    else
                        for (int x = 0; x < _extEntry.FrameCount; x++)
                            for (int i = 0x10; i < 0x19; i++)
                                if ((kfe = _extEntry.GetKeyframe((KeyFrameMode)i, x)) != null)
                                    _intEntry.Keyframes.SetFrameValue((KeyFrameMode)i, x + origIntCount, kfe._value)._tangent = kfe._tangent;
                }
        }
        internal void ApplySRT0(SRT0Node node, int index, bool linear)
        {
            SRT0EntryNode e;

            if (node == null || index == 0)
                foreach (MDL0MaterialRefNode r in Children)
                    r.ApplySRT0Texture(null, 0, linear);
            else if ((e = node.FindChild(Name, false) as SRT0EntryNode) != null)
            {
                foreach (SRT0TextureNode t in e.Children)
                    if (t._textureIndex < Children.Count)
                        ((MDL0MaterialRefNode)Children[t._textureIndex]).ApplySRT0Texture(t, index, linear);
            }
            else
                foreach (MDL0MaterialRefNode r in Children)
                    r.ApplySRT0Texture(null, 0, linear);
        }
 public void UpdateSRT0Selection(SRT0Node selection)
 {
     _srt0Selection = selection;
     if (_srt0Selection == null && _pat0Selection == null)
         overObjPnl.Visible = overTexPnl.Visible = false;
     else
     {
         overObjPnl.Visible = overTexPnl.Visible = true;
         overObjPnl.Invalidate();
         overTexPnl.Invalidate();
     }
 }