public void ImportTexture()
        {
            string path;
            int    index = Program.OpenFile(FileFilters.Images, out path);

            if (index == 8)
            {
                TPLTextureNode t = new TPLTextureNode()
                {
                    Name = "Texture"
                };
                _resource.AddChild(t);
                t.Replace(path);

                BaseWrapper w = this.FindResource(t, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
            else if (index > 0)
            {
                using (TextureConverterDialog dlg = new TextureConverterDialog())
                {
                    dlg.ImageSource = path;
                    if (dlg.ShowDialog(MainForm.Instance, Resource as TPLNode) == DialogResult.OK)
                    {
                        BaseWrapper w = this.FindResource(dlg.TPLTextureNode, true);
                        w.EnsureVisible();
                        w.TreeView.SelectedNode = w;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void NewShader()
        {
            MDL0Node model = ((MDL0Node)_resource);

            if (model._shadGroup == null)
            {
                MDL0GroupNode g = model._shadGroup;
                if (g == null)
                {
                    model.AddChild(g = new MDL0GroupNode(MDLResourceType.Shaders), true);
                    model._shadGroup = g; model._shadList = g.Children;
                }
            }

            if (model._shadList != null &&
                model._matList != null &&
                model._shadList.Count < model._matList.Count)
            {
                MDL0ShaderNode shader = new MDL0ShaderNode();
                model._shadGroup.AddChild(shader);
                shader.Default();
                shader.Rebuild(true);

                BaseWrapper b = FindResource(shader, true);
                if (b != null)
                {
                    b.EnsureVisible();
                }
            }
        }
Ejemplo n.º 3
0
        private unsafe void Import()
        {
            string path;

            if (Program.OpenFile("PCM Audio (*.wav)|*.wav", out path) > 0)
            {
                RSARFileAudioNode n;

                if ((_resource.Parent as NW4RNode).VersionMinor >= 3)
                {
                    n = new RWAVNode();
                }
                else
                {
                    n = new WAVESoundNode();
                }

                _resource.AddChild(n);
                n.Replace(path);

                BaseWrapper res = this.FindResource(n, true);
                res.EnsureVisible();
                res.TreeView.SelectedNode = res;
            }
        }
Ejemplo n.º 4
0
        public void ImportTexture()
        {
            string path;
            int    index = Program.OpenFile(FileFilters.TEX0, out path);

            if (index == 8)
            {
                TEX0Node node = NodeFactory.FromFile(null, path) as TEX0Node;
                ((BRRESNode)_resource).GetOrCreateFolder <TEX0Node>().AddChild(node);

                string palette = Path.ChangeExtension(path, ".plt0");
                if (File.Exists(palette) && node.HasPalette)
                {
                    PLT0Node n = NodeFactory.FromFile(null, palette) as PLT0Node;
                    ((BRRESNode)_resource).GetOrCreateFolder <PLT0Node>().AddChild(n);
                }

                BaseWrapper w = this.FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
            else if (index > 0)
            {
                using (TextureConverterDialog dlg = new TextureConverterDialog())
                {
                    dlg.ImageSource = path;
                    if (dlg.ShowDialog(MainForm.Instance, Resource as BRRESNode) == DialogResult.OK)
                    {
                        BaseWrapper w = this.FindResource(dlg.TEX0TextureNode, true);
                        w.EnsureVisible();
                        w.TreeView.SelectedNode = w;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void NewEntry()
        {
            SHP0EntryNode node = ((SHP0Node)_resource).FindOrCreateEntry(_resource.FindName(null));
            BaseWrapper   res  = this.FindResource(node, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 6
0
        public void Reverse(bool appendReverse)
        {
            ((CHR0Node)_resource).Reverse(appendReverse);
            BaseWrapper res = this.FindResource(_resource, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 7
0
        public void newCamera()
        {
            SCN0EntryNode node = ((SCN0Node)_resource).CreateResource <SCN0CameraNode>("NewCamera");
            BaseWrapper   res  = this.FindResource(node, true);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 8
0
        public void NewBone()
        {
            CHR0EntryNode node = ((CHR0Node)_resource).CreateEntry();
            BaseWrapper   res  = this.FindResource(node, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 9
0
        private void Append()
        {
            ((PAT0Node)_resource).Append();
            BaseWrapper res = this.FindResource(_resource, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 10
0
        public void Merge()
        {
            ((CHR0Node)_resource).MergeWith();
            BaseWrapper res = this.FindResource(_resource, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 11
0
        public void KeyFrameGen(int framesToGenerate, bool allowDuplicates, bool generateOrigin)
        {
            ((CHR0Node)_resource).KeyFrameGen(framesToGenerate, allowDuplicates, generateOrigin);
            BaseWrapper res = this.FindResource(_resource, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 12
0
        public void newAmbLight()
        {
            SCN0EntryNode node = ((SCN0Node)_resource).CreateResource <SCN0AmbientLightNode>("NewAmbientLight");
            BaseWrapper   res  = this.FindResource(node, true);

            res.EnsureVisible();
            //res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 13
0
        public void NewModel()
        {
            MDL0Node    node = ((BRRESNode)_resource).CreateResource <MDL0Node>("NewModel");
            BaseWrapper res  = this.FindResource(node, true);

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 14
0
        public void NewTpl()
        {
            TPLNode     node = ((U8FolderNode)_resource).CreateResource <TPLNode>("TPL");
            BaseWrapper res  = this.FindResource(node, true);

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 15
0
        public BRRESNode NewBrres()
        {
            BRRESNode   node = ((U8FolderNode)_resource).CreateResource <BRRESNode>("NewBrres");
            BaseWrapper res  = this.FindResource(node, true);

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
            return(node);
        }
Ejemplo n.º 16
0
        public void Loop(int timesToLoop)
        {
            CHR0Node temp = ((CHR0Node)_resource);

            ((CHR0Node)_resource).Append(temp, timesToLoop);
            BaseWrapper res = this.FindResource(_resource, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 17
0
        public void NewClr()
        {
            CLR0Node node = ((BRRESNode)_resource).CreateResource <CLR0Node>("NewCLR");

            node.Version = 3;
            BaseWrapper res = this.FindResource(node, true);

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
Ejemplo n.º 18
0
        public void NewMaterial()
        {
            if (_modelViewerOpen)
            {
                return;
            }

            MDL0Node model = ((MDL0Node)_resource);

            if (model._matGroup == null)
            {
                MDL0GroupNode g = model._matGroup;
                if (g == null)
                {
                    model.AddChild(g = new MDL0GroupNode(MDLResourceType.Materials), true);
                    model._matGroup  = g; model._matList = g.Children;
                }
            }

            MDL0MaterialNode mat = new MDL0MaterialNode();

            model._matGroup.AddChild(mat);
            mat.Name = "Material" + mat.Index;
            mat.New  = true;
            if (model._shadGroup == null)
            {
                MDL0GroupNode g = model._shadGroup;
                if (g == null)
                {
                    model.AddChild(g = new MDL0GroupNode(MDLResourceType.Shaders), true);
                    model._shadGroup = g; model._shadList = g.Children;
                }
            }
            if (model._shadList.Count == 0)
            {
                NewShader();
            }

            mat.ShaderNode = (MDL0ShaderNode)model._shadList[0];
            mat.AddChild(new MDL0MaterialRefNode()
            {
                Name = "MatRef0"
            });
            mat.Rebuild(true);

            BaseWrapper b = FindResource(mat, true);

            if (b != null)
            {
                b.EnsureVisible();
            }
        }
Ejemplo n.º 19
0
        private void NewCLR()
        {
            CLR0MaterialEntryNode n = ((CLR0Node)this._resource).CreateEntry();

            if (n != null)
            {
                BaseWrapper b = FindResource(n, true);
                if (b != null)
                {
                    b.EnsureVisible();
                }
            }
        }
Ejemplo n.º 20
0
        public void ImportChr()
        {
            string path;

            if (Program.OpenFile(FileFilters.CHR0Import, out path) > 0)
            {
                CHR0Node node = CHR0Node.FromFile(path);
                ((BRRESNode)_resource).GetOrCreateFolder <CHR0Node>().AddChild(node);

                BaseWrapper w = this.FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
        }
Ejemplo n.º 21
0
        public void ImportClr()
        {
            string path;

            if (Program.OpenFile(FileFilters.CLR0, out path) > 0)
            {
                CLR0Node node = NodeFactory.FromFile(null, path) as CLR0Node;
                ((BRRESNode)_resource).GetOrCreateFolder <CLR0Node>().AddChild(node);

                BaseWrapper w = this.FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
        }
Ejemplo n.º 22
0
        public void ImportBrres()
        {
            string path;

            if (Program.OpenFile(FileFilters.BRES, out path) > 0)
            {
                BRRESNode node = NodeFactory.FromFile(null, path) as BRRESNode;
                ((U8FolderNode)_resource).AddChild(node);

                BaseWrapper w = this.FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
        }
Ejemplo n.º 23
0
        public U8FolderNode NewFolder()
        {
            U8FolderNode node = new U8FolderNode()
            {
                Name = _resource.FindName("NewFolder")
            };

            _resource.AddChild(node);

            BaseWrapper w = this.FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
Ejemplo n.º 24
0
        public ARCNode NewARC()
        {
            ARCNode node = new ARCNode()
            {
                Name = _resource.FindName("NewARChive"), FileType = ARCFileType.MiscData
            };

            _resource.AddChild(node);

            BaseWrapper w = this.FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
Ejemplo n.º 25
0
        public MSBinNode NewMSBin()
        {
            MSBinNode node = new MSBinNode()
            {
                FileType = ARCFileType.MiscData
            };

            _resource.AddChild(node);

            BaseWrapper w = this.FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
        public void ImportTexture()
        {
            string path;
            int    index = Program.OpenFile(FileFilters.Images, out path);

            if (index > 0)
            {
                using (TextureConverterDialog dlg = new TextureConverterDialog())
                {
                    dlg.ImageSource = path;
                    if (dlg.ShowDialog(MainForm.Instance, ResourceNode as REFTNode) == DialogResult.OK)
                    {
                        BaseWrapper w = this.FindResource(dlg.REFTTextureNode, true);
                        w.EnsureVisible();
                        w.TreeView.SelectedNode = w;
                    }
                }
            }
        }
Ejemplo n.º 27
0
        public void ImportU8()
        {
            string path;

            if (Program.OpenFile("U8 Archive (*.arc)|*.arc|" +
                                 "Compressed U8 Archive (*.szs)|*.szs|" +
                                 "Archive Pair (*.pair)|*.pair", out path) > 0)
            {
                U8Node       node = NodeFactory.FromFile(null, path) as U8Node;
                U8FolderNode n    = new U8FolderNode();
                foreach (ResourceNode r in node.Children)
                {
                    n.AddChild(r);
                }
                n.Name = node.Name;
                ((U8FolderNode)_resource).AddChild(n);

                BaseWrapper w = this.FindResource(n, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
        }
Ejemplo n.º 28
0
        public void NewEntry()
        {
            REFFEntryNode e = new REFFEntryNode();

            REFFNode     node = _resource as REFFNode;
            ResourceNode emitter;

            if (node.VersionMinor == 9)
            {
                e.AddChild(emitter = new REFFEmitterNode9()
                {
                    _name = "Emitter"
                });
            }
            else
            {
                e.AddChild(emitter = new REFFEmitterNode7()
                {
                    _name = "Emitter"
                });
            }
            emitter.AddChild(new REFFTEVStage(0));
            emitter.AddChild(new REFFTEVStage(1));
            emitter.AddChild(new REFFTEVStage(2));
            emitter.AddChild(new REFFTEVStage(3));
            e.AddChild(new REFFParticleNode()
            {
                _name = "Particle"
            });
            e.AddChild(new REFFAnimationListNode()
            {
                _name = "Animations"
            });
            _resource.AddChild(e);
            BaseWrapper w = this.FindResource(e, true);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
        }