Example #1
0
        public RootModelDirectory GatherAllModelFiles()
        {
            var rootModelDirectory = new RootModelDirectory();

            var gatherers = new IModelFileGatherer[] {
                new BattalionWars1FileGatherer(),
                new BattalionWars2FileGatherer(),
                new GloverModelFileGatherer(),
                new GreatAceAttorneyModelFileGatherer(),
                new HaloWarsModelFileGatherer(),
                new LuigisMansion3dModelFileGatherer(),
                new MajorasMask3dFileGatherer(),
                new MarioKartDoubleDashFileGatherer(),
                new OcarinaOfTime3dFileGatherer(),
                new Pikmin1ModelFileGatherer(),
                new Pikmin2FileGatherer(),
                new SuperMarioSunshineModelFileGatherer(),
                new SuperSmashBrosMeleeModelFileGatherer(),
            };

            foreach (var gatherer in gatherers)
            {
                rootModelDirectory.AddSubdirIfNotNull(
                    gatherer.GatherModelFileBundles(false));
            }

            rootModelDirectory.RemoveEmptyChildren();

            return(rootModelDirectory);
        }
Example #2
0
        public static void ExtractAll <T>(
            IModelFileGatherer <T> gatherer,
            IModelLoader <T> loader)
            where T : IModelFileBundle
        {
            var logger = Logging.Create <T>();

            var root = gatherer.GatherModelFileBundles(true);

            root.ForEachTyped(fileBundle => {
                var mainFile = fileBundle.MainFile;

                var parentOutputDirectory =
                    GameFileHierarchyUtil.GetOutputDirectoryForFile(mainFile);
                var outputDirectory =
                    parentOutputDirectory.GetSubdir(mainFile.NameWithoutExtension,
                                                    true);

                var existingOutputFile =
                    outputDirectory.GetExistingFiles()
                    .Where(file => file.Extension is ".fbx" or ".glb")
                    .SingleOrDefault(
                        file => file.NameWithoutExtension ==
                        mainFile.NameWithoutExtension);

                if (existingOutputFile != null)
                {
                    MessageUtil.LogAlreadyProcessed(logger, mainFile);
                    return;
                }

                MessageUtil.LogExtracting(logger, mainFile);

                try {
                    var model = loader.LoadModel(fileBundle);

                    new AssimpIndirectExporter().Export(
                        new FinFile(Path.Join(outputDirectory.FullName,
                                              mainFile.NameWithoutExtension +
                                              ".fbx")),
                        model);
                } catch (Exception e) {
                    logger.LogError(e.ToString());
                }
                logger.LogInformation(" ");
            });
        }