public static void DumpAllForFigure(ImportSettings settings, ContentFileLocator fileLocator, Device device, ShaderCache shaderCache, Figure parentFigure, Figure figure) { ShapeImportConfiguration[] configurations = ShapeImportConfiguration.Load(figure.Name); var baseConf = configurations.SingleOrDefault(conf => conf.name == "Base"); ShapeDumper dumper = new ShapeDumper(fileLocator, device, shaderCache, parentFigure, figure, baseConf); foreach (var conf in configurations) { if (!settings.ShouldImportShape(figure.Name, conf.name)) { continue; } dumper.Dump(conf); } dumper.DumpUnmorphed(); MaterialSetImportConfiguration[] materialSetImportConfigurations = MaterialSetImportConfiguration.Load(figure.Name); foreach (var materialSetConf in materialSetImportConfigurations) { if (!settings.ShouldImportMaterialSet(figure.Name, materialSetConf.name)) { continue; } if (!materialSetConf.useCustomOcclusion) { continue; } dumper.DumpOcclusionForMaterialSet(materialSetConf.name); } }
public FigureDumper LoadDumper(string figureName) { var figure = figureName == parentFigure.Name ? parentFigure : figureRecipeLoader.LoadFigureRecipe(figureName, parentFigureRecipe).Bake(parentFigure); var figureConfDir = pathManager.GetConfDirForFigure(figure.Name); MaterialSetImportConfiguration baseMaterialSetConfiguration = MaterialSetImportConfiguration.Load(figureConfDir).Single(conf => conf.name == "Base"); ShapeImportConfiguration baseShapeImportConfiguration = ShapeImportConfiguration.Load(figureConfDir).SingleOrDefault(conf => conf.name == "Base"); SurfaceProperties surfaceProperties = SurfacePropertiesJson.Load(pathManager, figure); ShapeDumper shapeDumper = new ShapeDumper(fileLocator, device, shaderCache, parentFigure, parentFaceTransparencies, figure, surfaceProperties, baseShapeImportConfiguration); return(new FigureDumper(fileLocator, objectLocator, device, shaderCache, parentFigure, figure, surfaceProperties, baseMaterialSetConfiguration, baseShapeImportConfiguration, shapeDumper)); }
public static ChannelShaker InitializeFromShapes(Figure figure) { var shaker = new ChannelShaker(figure.ChannelSystem); ShapeImportConfiguration[] shapeConfigurations = ShapeImportConfiguration.Load(figure.Name); foreach (var conf in shapeConfigurations) { foreach (var entry in conf.morphs) { string channelName = entry.Key + "?value"; var channel = figure.ChannelsByName[channelName]; shaker.TagDirectUse(channel); } } return(shaker); }
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(); } }