Exemplo n.º 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();
    }
Exemplo n.º 2
0
    public static void DumpAllForFigure(ImportSettings settings, Device device, ShaderCache shaderCache, ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Figure figure, TextureProcessorSharer textureProcessorSharer)
    {
        MaterialSetImportConfiguration[] configurations = MaterialSetImportConfiguration.Load(figure.Name);

        var baseConf = configurations.Single(conf => conf.name == "Base");

        var surfaceProperties = SurfacePropertiesJson.Load(figure);
        TextureProcessor sharedTextureProcessor = surfaceProperties.ShareTextures != null?
                                                  textureProcessorSharer.GetSharedProcessor(surfaceProperties.ShareTextures) : null;

        foreach (var conf in configurations)
        {
            if (conf == baseConf)
            {
                continue;
            }

            if (!settings.ShouldImportMaterialSet(figure.Name, conf.name))
            {
                continue;
            }

            DumpMaterialSetAndScattering(settings, device, shaderCache, fileLocator, objectLocator, figure, baseConf, conf, sharedTextureProcessor);
        }
    }