예제 #1
0
        public BRRESNode NewBrres()
        {
            BRRESNode   node = ((U8FolderNode)_resource).CreateResource <BRRESNode>("NewBrres");
            BaseWrapper res  = FindResource(node, true);

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
            return(node);
        }
예제 #2
0
        private void NewCLR()
        {
            CLR0MaterialEntryNode n = ((CLR0Node)_resource).CreateEntry();

            if (n != null)
            {
                BaseWrapper b = FindResource(n, true);
                b?.EnsureVisible();
            }
        }
예제 #3
0
        public ItmFreqEntryNode NewEntry()
        {
            ItmFreqEntryNode node = new ItmFreqEntryNode();
            node.UpdateName();
            _resource.AddChild(node);

            BaseWrapper w = FindResource(node, false);
            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return node;
        }
예제 #4
0
        public void NewClr()
        {
            CLR0Node node = ((BRRESNode)_resource).CreateResource <CLR0Node>("NewCLR");

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

            res = res.FindResource(node, false);
            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
예제 #5
0
        public void ImportClr()
        {
            if (Program.OpenFile(FileFilters.CLR0, out string path) > 0)
            {
                CLR0Node node = NodeFactory.FromFile(null, path) as CLR0Node;
                ((BRRESNode)_resource).GetOrCreateFolder <CLR0Node>().AddChild(node);

                BaseWrapper w = FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
        }
예제 #6
0
        public GITMNode NewGITM()
        {
            GITMNode node = new GITMNode();

            _resource.AddChild(node);

            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
예제 #7
0
        public void ImportBrres()
        {
            if (Program.OpenFile(FileFilters.BRES, out string path) > 0)
            {
                BRRESNode node = NodeFactory.FromFile(null, path) as BRRESNode;
                ((U8FolderNode)_resource).AddChild(node);

                BaseWrapper w = FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
        }
예제 #8
0
        public void Clear()
        {
            while (_resource.HasChildren)
            {
                _resource.RemoveChild(_resource.Children[0]);
            }

            BaseWrapper w = FindResource(_resource, false);

            w.EnsureVisible();
            w.Expand();
        }
예제 #9
0
        public void ImportChr()
        {
            if (Program.OpenFile(FileFilters.CHR0Import, out string path) > 0)
            {
                CHR0Node node = CHR0Node.FromFile(path);
                ((BRRESNode)_resource).GetOrCreateFolder <CHR0Node>().AddChild(node);

                BaseWrapper w = FindResource(node, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
        }
예제 #10
0
        public RawDataNode NewEntry()
        {
            RawDataNode node = new RawDataNode
            {
                _name = (((STEXNode)Resource).IsOldSubstage ? "_" : "") + $"{Resource.Children.Count:D2}"
            };

            _resource.AddChild(node);
            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            return(node);
        }
예제 #11
0
        public ADSJNode NewADSJ()
        {
            ADSJNode node = new ADSJNode {
                FileType = ARCFileType.MiscData
            };

            _resource.AddChild(node);

            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
예제 #12
0
        public U8FolderNode NewFolder()
        {
            U8FolderNode node = new U8FolderNode {
                Name = _resource.FindName("NewFolder")
            };

            _resource.AddChild(node);

            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
예제 #13
0
        public HavokNode NewHavok()
        {
            HavokNode node = new HavokNode {
                Name = _resource.FindName("NewHavokData"), FileType = ARCFileType.MiscData
            };

            _resource.AddChild(node);

            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
예제 #14
0
        public void NewMaterial()
        {
            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;

            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];
            MDL0MaterialRefNode mr = new MDL0MaterialRefNode();

            mat.AddChild(mr);
            mr.Name = "MatRef0";
            mat.Rebuild(true);

            BaseWrapper b = FindResource(mat, true);

            if (b != null)
            {
                b.EnsureVisible();
            }
        }
예제 #15
0
        public ADSJNode NewADSJ()
        {
            ADSJNode node = new ADSJNode()
            {
                Name = _resource.FindName("NewADSJ")
            };

            _resource.AddChild(node);

            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
예제 #16
0
        public ItmTableGroupNode NewEntry()
        {
            int childCount         = _resource.Children == null ? 0 : _resource.Children.Count;
            ItmTableGroupNode node = new ItmTableGroupNode {
                Name = "Group [" + childCount + "]"
            };

            _resource.AddChild(node);

            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
예제 #17
0
        public void ImportModel()
        {
            if (Program.OpenFile(FileFilters.MDL0Import, out string path) > 0)
            {
                MDL0Node node = MDL0Node.FromFile(path);
                if (node != null)
                {
                    ((BRRESNode)_resource).GetOrCreateFolder <MDL0Node>().AddChild(node);

                    BaseWrapper w = FindResource(node, true);
                    w.EnsureVisible();
                    w.TreeView.SelectedNode = w;
                }
            }
        }
예제 #18
0
        public ARCEntryNode NewRedirect()
        {
            ARCEntryNode node = new ARCEntryNode
            {
                FileType = ARCFileType.MiscData, _resourceType = ResourceType.Redirect
            };

            _resource.AddChild(node);
            node.RedirectIndex = 0;

            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
예제 #19
0
 public void ImportTexture()
 {
     if (Program.OpenFile(FileFilters.Images, out string path))
     {
         using (TextureConverterDialog dlg = new TextureConverterDialog())
         {
             dlg.ImageSource = path;
             if (dlg.ShowDialog(MainForm.Instance, Resource as REFTNode) == DialogResult.OK)
             {
                 BaseWrapper w = FindResource(dlg.REFTTextureNode, true);
                 w.EnsureVisible();
                 w.TreeView.SelectedNode = w;
             }
         }
     }
 }
예제 #20
0
        public T NewStageTable <T>(int numEntries) where T : StageTableNode, new()
        {
            T node = new T {
                FileType = ARCFileType.MiscData
            };

            while (node.NumEntries < numEntries)
            {
                node.EntryList.Add(0);
            }

            _resource.AddChild(node);

            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
            return(node);
        }
예제 #21
0
        public void ImportU8()
        {
            if (Program.OpenFile(FileFilters.U8Import, out string 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 = FindResource(n, true);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
            }
        }
예제 #22
0
        //public override string ExportFilter { get { return FileFilters.RSTCGroup; } }

        public void NewEntry()
        {
            if (_resource.Children.Count >= 100)
            {
                return;
            }

            RSTCEntryNode node = new RSTCEntryNode
            {
                FighterID = 0x0,
                _name     = "Mario"
            };

            _resource.AddChild(node);
            BaseWrapper w = FindResource(node, false);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
        }
예제 #23
0
        public ASLSEntryNode NewEntry()
        {
            StringInputDialog d = new StringInputDialog("New ASLS Entry", Resource.HasChildren ? Resource.Children[0].Name : "");

            if (d.ShowDialog() == DialogResult.OK)
            {
                ASLSEntryNode node = new ASLSEntryNode
                {
                    _name = d.resultString
                };

                _resource.AddChild(node);
                BaseWrapper w = FindResource(node, false);
                w.EnsureVisible();
                w.TreeView.SelectedNode = w;
                return(node);
            }

            return(null);
        }
예제 #24
0
        public void Clear()
        {
            while (((RSTCNode)_resource).cssList.HasChildren)
            {
                ((RSTCNode)_resource).cssList.RemoveChild(((RSTCNode)_resource).cssList.Children[0]);
            }

            while (((RSTCNode)_resource).randList.HasChildren)
            {
                ((RSTCNode)_resource).randList.RemoveChild(((RSTCNode)_resource).randList.Children[0]);
            }

            BaseWrapper w = FindResource(((RSTCNode)_resource).cssList, false);

            w.EnsureVisible();
            w.Expand();
            w = FindResource(((RSTCNode)_resource).randList, false);
            w.EnsureVisible();
            w.Expand();
        }
예제 #25
0
        public static BaseWrapper[] GetAllNodes(BaseWrapper root)
        {
            List <BaseWrapper> result = new List <BaseWrapper>();

            result.Add(root);
            foreach (TreeNode child in root.Nodes)
            {
                if (child is BaseWrapper b && b.Resource != null)
                {
                    bool expanded = b.IsExpanded;
                    b.Expand();
                    result.AddRange(GetAllNodes(b));
                    if (!expanded)
                    {
                        b.Collapse();
                    }
                }
            }
            return(result.ToArray());
        }
예제 #26
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 = FindResource(e, true);

            w.EnsureVisible();
            w.TreeView.SelectedNode = w;
        }
예제 #27
0
        public void Merge()
        {
            OpenFileDialog o = new OpenFileDialog
            {
                Filter = ImportFilter,
                Title  = "Please select an animation to merge with."
            };

            if (o.ShowDialog() == DialogResult.OK)
            {
                CHR0Node external;
                if ((external = CHR0Node.FromFile(o.FileName)) != null)
                {
                    ((CHR0Node)_resource).MergeWith(external);
                }
            }

            BaseWrapper res = FindResource(_resource, false);

            res.EnsureVisible();
            res.TreeView.SelectedNode = res;
        }
예제 #28
0
        public void CreateParentNode()
        {
            if (Parent == null)
            {
                return;
            }

            CreateNode();
            TreeView.BeginUpdate();
            BaseWrapper parent    = Parent as BaseWrapper;
            BaseWrapper newParent = Nodes[Nodes.Count - 1] as BaseWrapper;

            newParent.Remove();
            Remove();
            parent.Nodes.Insert(Index, newParent);
            newParent.Nodes.Add(this);
            newParent.Resource.Parent = parent.Resource;
            _resource.Parent          = newParent.Resource;
            _resource.OnMoved();
            TreeView.SelectedNode = this;
            TreeView.EndUpdate();
            EnsureVisible();
        }
        private unsafe void Import()
        {
            if (Program.OpenFile("PCM Audio (*.wav)|*.wav", out string 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 = FindResource(n, true);
                res.EnsureVisible();
                res.TreeView.SelectedNode = res;
            }
        }
예제 #30
0
        public MDL0ShaderNode 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();
                }

                return shader;
            }

            MessageBox.Show("Shader could not be added. Make sure that you do not have more shaders than materials",
                "Error");
            return null;
        }