示例#1
0
    private void Run(string[] args)
    {
        ImportSettings settings;

        if (args.Length > 0 && args[0] == "release")
        {
            settings = ImportSettings.MakeReleaseSettings();
        }
        else
        {
            settings = ImportSettings.MakeFromViewerInitialSettings();
        }

        new UiImporter().Run();
        new EnvironmentCubeGenerator().Run(settings);

        OutfitImporter.ImportAll();

        var loader = new FigureRecipeLoader(objectLocator);

        FigureRecipe genesis3FemaleRecipe = loader.LoadFigureRecipe("genesis-3-female", null);
        FigureRecipe genitaliaRecipe      = loader.LoadFigureRecipe("genesis-3-female-genitalia", genesis3FemaleRecipe);
        FigureRecipe genesis3FemaleWithGenitaliaRecipe = new FigureRecipeMerger(genesis3FemaleRecipe, genitaliaRecipe).Merge();
        Figure       genesis3FemaleWithGenitalia       = genesis3FemaleWithGenitaliaRecipe.Bake(null);

        Figure parentFigure = genesis3FemaleWithGenitalia;

        List <Figure> childFigures = settings.FiguresToImport
                                     .Where(figureName => figureName != parentFigure.Name)
                                     .Select(figureName => loader.LoadFigureRecipe(figureName, genesis3FemaleRecipe).Bake(parentFigure))
                                     .ToList();

        List <Figure> figuresToDump = Enumerable.Repeat(parentFigure, 1)
                                      .Concat(childFigures)
                                      .ToList();

        Console.WriteLine($"Dumping parent...");
        AnimationDumper.DumpAllAnimations(parentFigure);

        var textureProcessorSharer = new TextureProcessorSharer(device, shaderCache, settings.CompressTextures);

        foreach (Figure figure in figuresToDump)
        {
            bool[] channelsToInclude = figure != parentFigure?ChannelShaker.MakeChannelsToIncludeFromShapes(figure) : null;

            Console.WriteLine($"Dumping {figure.Name}...");
            SystemDumper.DumpFigure(figure, channelsToInclude);
            GeometryDumper.DumpFigure(figure);
            UVSetDumper.DumpFigure(figure);

            MaterialSetDumper.DumpAllForFigure(settings, device, shaderCache, fileLocator, objectLocator, figure, textureProcessorSharer);

            ShapeDumper.DumpAllForFigure(settings, fileLocator, device, shaderCache, parentFigure, figure);
        }

        textureProcessorSharer.Finish();
    }
示例#2
0
    private void Run(string[] args)
    {
        ImportSettings settings;

        if (args.Length > 0 && args[0] == "release")
        {
            settings = ImportSettings.MakeReleaseSettings();
        }
        else
        {
            settings = ImportSettings.MakeFromViewerInitialSettings();
        }

        var contentDestDir = CommonPaths.WorkDir.Subdirectory("content");

        var contentPackConfs = ContentPackImportConfiguration.LoadAll(CommonPaths.ConfDir);
        var pathManager      = ImporterPathManager.Make(contentPackConfs);

        var figureDumperLoader = new FigureDumperLoader(fileLocator, objectLocator, pathManager, device, shaderCache);

        foreach (var contentPackConf in contentPackConfs)
        {
            var destDir = contentDestDir.Subdirectory(contentPackConf.Name);

            if (contentPackConf.IsCore)
            {
                new UiImporter(destDir).Run();
                new EnvironmentCubeGenerator().Run(settings, destDir);
            }

            var texturesDir      = destDir.Subdirectory("textures").Subdirectory(contentPackConf.Name);
            var textureProcessor = new TextureProcessor(device, shaderCache, texturesDir, contentPackConf.Name, settings.CompressTextures);

            bool shouldImportAnything = false;

            foreach (var figureConf in contentPackConf.Figures)
            {
                string figureName = figureConf.Name;

                if (!settings.FiguresToImport.Contains(figureName))
                {
                    continue;
                }

                var figureDumper = figureDumperLoader.LoadDumper(figureName);

                MaterialSetImportConfiguration[] materialSetConfigurations = MaterialSetImportConfiguration.Load(figureConf.Directory);
                ShapeImportConfiguration[]       shapeImportConfigurations = ShapeImportConfiguration.Load(figureConf.Directory);

                var figureDestDir = destDir.Subdirectory("figures").Subdirectory(figureName);

                if (figureConf.IsPrimary)
                {
                    shouldImportAnything = true;
                    figureDumper.DumpFigure(shapeImportConfigurations, figureDestDir);
                }

                foreach (var materialSetConf in materialSetConfigurations)
                {
                    if (!settings.ShouldImportMaterialSet(figureConf.Name, materialSetConf.name))
                    {
                        continue;
                    }

                    shouldImportAnything = true;
                    figureDumper.DumpMaterialSet(settings, textureProcessor, figureDestDir, materialSetConf);
                }

                if (figureConf.IsPrimary)
                {
                    shouldImportAnything = true;
                    figureDumper.DumpBaseShape(figureDestDir);
                }

                foreach (var shapeConf in shapeImportConfigurations)
                {
                    if (!settings.ShouldImportShape(figureConf.Name, shapeConf.name))
                    {
                        continue;
                    }

                    shouldImportAnything = true;
                    figureDumper.DumpShape(textureProcessor, figureDestDir, shapeConf);
                }
            }

            if (shouldImportAnything)
            {
                foreach (var characterConf in contentPackConf.Characters)
                {
                    CharacterImporter.Import(pathManager, characterConf.File, destDir);
                }

                foreach (var outfitConf in contentPackConf.Outfits)
                {
                    OutfitImporter.Import(pathManager, outfitConf.File, destDir);
                }
            }

            textureProcessor.ImportAll();
        }
    }