Esempio n. 1
0
        private MeshListTreeNode createMOMNode(string name, MOMDocument momDoc)
        {
            MeshListTreeNode rootNode = new MeshListTreeNode(name, momDoc.Models.ObjectMeshes,
                                                             contextMenu: new ContextMenu(
                                                                 new Dictionary <string, Action>
            {
                {
                    "Export as MOM",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportOriginal(momDoc.Document, filePath); },
                            ".mom");
                    }
                }
            }));

            MeshListTreeNode modelsNode = createTMDNode("Models", momDoc.Models);

            rootNode.AddNode(modelsNode);

            AnimatedMeshListTreeNode animationsNode =
                createMOSNode("Animations", momDoc.Document.MOS, momDoc);

            rootNode.AddNode(animationsNode);

            return(rootNode);
        }
Esempio n. 2
0
        private TreeNode createMMLNode(string name, List <MOMDocument> entities, MML mml)
        {
            MeshListTreeNode rootNode = new MeshListTreeNode(name, entities[0].Models.ObjectMeshes,
                                                             contextMenu: new ContextMenu(
                                                                 new Dictionary <string, Action>
            {
                {
                    "Export as MML",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportOriginal(mml, filePath); },
                            ".mml");
                    }
                }
            }));

            for (int i = 0; i < entities.Count; i++)
            {
                MeshListTreeNode momNode = createMOMNode($"Entity {i}", entities[i]);
                rootNode.AddNode(momNode);
            }

            return(rootNode);
        }
Esempio n. 3
0
        protected MeshListTreeNode createTIMNode(string name, TIMDocument timDoc)
        {
            MeshListTreeNode rootNode = new MeshListTreeNode(name, new List <IRenderable> {
                timDoc.TextureMeshes[0]
            },
                                                             contextMenu: new ContextMenu(
                                                                 new Dictionary <string, Action>
            {
                {
                    "Export as TIM",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportOriginal(timDoc.Document, filePath); },
                            ".tim");
                    }
                },
                {
                    "Export as PNG",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath =>
                        {
                            _exportController.ExportImage(timDoc.Document, 0, filePath, ImageFormat.Png);
                        }, ".png");
                    }
                }
            }));

            int i = 0;

            foreach (var mesh in timDoc.TextureMeshes)
            {
                int clutIndex             = i;
                MeshListTreeNode clutNode = new MeshListTreeNode($"CLUT {clutIndex}", new List <IRenderable> {
                    mesh
                },
                                                                 contextMenu: new ContextMenu(
                                                                     new Dictionary <string, Action>
                {
                    {
                        "Export as PNG",
                        () =>
                        {
                            _exportController.OpenDialog(
                                filePath =>
                            {
                                _exportController.ExportImage(timDoc.Document, clutIndex, filePath,
                                                              ImageFormat.Png);
                            }, ".png");
                        }
                    }
                }));
                i++;
                rootNode.AddNode(clutNode);
            }

            return(rootNode);
        }
Esempio n. 4
0
        protected MeshListTreeNode createTIXNode(string name, TIXDocument tixDoc)
        {
            MeshListTreeNode rootNode = new MeshListTreeNode(name,
                                                             new List <IRenderable> {
                tixDoc.TIMs[0].TextureMeshes[0]
            },
                                                             contextMenu: new ContextMenu(
                                                                 new Dictionary <string, Action>
            {
                {
                    "Export as TIX",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportOriginal(tixDoc.Document, filePath); },
                            ".tix");
                    }
                },
                {
                    "Export as PNGs",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath =>
                        {
                            _exportController.ExportImages(tixDoc.Document, filePath, false,
                                                           ImageFormat.Png);
                        }, ".png");
                    }
                }
            }));

            for (int i = 0; i < tixDoc.TIMs.Count; i++)
            {
                MeshListTreeNode timNode = createTIMNode($"Texture {i}", tixDoc.TIMs[i]);
                rootNode.AddNode(timNode);
            }

            return(rootNode);
        }
Esempio n. 5
0
        private MeshListTreeNode createTMDNode(string name, TMDDocument tmdDoc)
        {
            MeshListTreeNode rootNode = new MeshListTreeNode(name, tmdDoc.ObjectMeshes, contextMenu: new ContextMenu(
                                                                 new Dictionary <string, Action>
            {
                {
                    "Export as TMD",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportOriginal(tmdDoc.Document, filePath); }, ".tmd");
                    }
                },
                {
                    "Export as OBJ",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportOBJ(tmdDoc.ObjectMeshes, filePath); }, ".obj");
                    }
                },
                {
                    "Export as PLY",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportPLY(tmdDoc.ObjectMeshes, filePath); }, ".ply");
                    }
                },
            }));

            for (int i = 0; i < tmdDoc.Document.Header.NumObjects; i++)
            {
                IRenderable      objMesh = tmdDoc.ObjectMeshes[i];
                MeshListTreeNode objNode =
                    new MeshListTreeNode($"Object {i}", new List <IRenderable> {
                    objMesh
                },
                                         contextMenu: new ContextMenu(
                                             new Dictionary <string, Action>
                {
                    {
                        "Export as OBJ",
                        () =>
                        {
                            _exportController.OpenDialog(
                                filePath => { _exportController.ExportOBJ(objMesh, filePath); }, ".obj");
                        }
                    },
                    {
                        "Export as PLY",
                        () =>
                        {
                            _exportController.OpenDialog(
                                filePath => { _exportController.ExportPLY(objMesh, filePath); }, ".ply");
                        }
                    }
                }));
                rootNode.AddNode(objNode);
            }

            return(rootNode);
        }
Esempio n. 6
0
        private MeshListTreeNode createLBDNode(string name, LBDDocument lbdDoc)
        {
            MeshListTreeNode rootNode = new MeshListTreeNode(name, lbdDoc.TileLayout, contextMenu: new ContextMenu(
                                                                 new Dictionary <string, Action>
            {
                {
                    "Export as LBD",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportOriginal(lbdDoc.Document, filePath); }, ".lbd");
                    }
                },
                {
                    "Export as OBJ",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportOBJ(lbdDoc.TileLayout, filePath); }, ".obj");
                    }
                },
                {
                    "Export as PLY",
                    () =>
                    {
                        _exportController.OpenDialog(
                            filePath => { _exportController.ExportPLY(lbdDoc.TileLayout, filePath); }, ".ply");
                    }
                }
            }));

            TreeNode tilesNode = createTMDNode("Tiles", lbdDoc.TilesTMD);

            rootNode.AddNode(tilesNode);

            TreeNode tileInfoNode = new TreeNode("Tile info");

            rootNode.AddNode(tileInfoNode);
            int tileNo = 0;
            int i      = 0;

            foreach (LBDTile tile in lbdDoc.Document.TileLayout)
            {
                if (tile.DrawTile)
                {
                    int             x        = tileNo / lbdDoc.Document.Header.TileWidth;
                    int             y        = tileNo % lbdDoc.Document.Header.TileWidth;
                    var             tileMesh = lbdDoc.TileLayout[i];
                    LBDTileTreeNode tileNode =
                        new LBDTileTreeNode($"({x}, {y})", tileMesh, tile, lbdDoc.TileLayout);
                    tileInfoNode.AddNode(tileNode);
                    LBDTile currentTile = tile;
                    int     j           = 0;
                    while (currentTile.ExtraTileIndex >= 0 && j <= 1)
                    {
                        LBDTile extraTile = lbdDoc.Document.ExtraTiles[currentTile.ExtraTileIndex];
                        tileMesh = lbdDoc.TileLayout[i + j + 1];
                        tileNode =
                            new LBDTileTreeNode($"({x}, {y}) extra", tileMesh, tile, lbdDoc.TileLayout);
                        tileInfoNode.AddNode(tileNode);
                        currentTile = extraTile;
                        j++;
                    }

                    i += j + 1;
                }

                tileNo++;
            }

            if (lbdDoc.Entities != null)
            {
                TreeNode objectsNode = createMMLNode("Entities", lbdDoc.Entities, lbdDoc.Document.MML.Value);
                rootNode.AddNode(objectsNode);
            }

            return(rootNode);
        }