Пример #1
0
    public static GeometryRecipe ImportForFigure(DsonObjectLocator locator, FigureUris figureUris)
    {
        GeometryImporter importer = new GeometryImporter();

        importer.ImportFrom(locator.LocateRoot(figureUris.DocumentUri));

        return(importer.recipes.Single());
    }
    public static SkinBindingRecipe ImportForFigure(DsonObjectLocator locator, FigureUris figureUris)
    {
        SkinBindingImporter importer = new SkinBindingImporter();

        importer.ImportFrom(locator.LocateRoot(figureUris.DocumentUri));

        return(importer.recipes.Single());
    }
Пример #3
0
    public static ImportProperties Load(ImporterPathManager pathManager, string figureName)
    {
        JsonSerializerSettings settings = new JsonSerializerSettings {
            MissingMemberHandling = MissingMemberHandling.Error
        };
        string        json      = pathManager.GetConfDirForFigure(figureName).File("import-properties.json").ReadAllText();
        JsonProxy     proxy     = JsonConvert.DeserializeObject <JsonProxy>(json, settings);
        UrisJsonProxy urisProxy = proxy.uris;

        var uris = new FigureUris(
            urisProxy.basePath,
            urisProxy.documentName,
            urisProxy.geometryId,
            urisProxy.rootNodeId,
            urisProxy.skinBindingId);

        return(new ImportProperties(uris, proxy.hdCorrectionInitialValue));
    }
Пример #4
0
    public static IEnumerable <FormulaRecipe> ImportForFigure(DsonObjectLocator locator, FigureUris figureUris)
    {
        FormulaImporter importer = new FormulaImporter(locator, figureUris.RootNodeId);

        importer.ImportFrom(locator.LocateRoot(figureUris.DocumentUri));
        foreach (DsonTypes.DsonDocument doc in locator.GetAllDocumentsUnderPath(figureUris.MorphsBasePath))
        {
            importer.ImportFrom(doc);
        }

        return(importer.FormulaRecipes);
    }
 public ImportProperties(FigureUris uris, double hdCorrectionInitialValue, ImmutableHashSet <string> visibleProducts)
 {
     Uris = uris;
     HdCorrectionInitialValue = hdCorrectionInitialValue;
     VisibleProducts          = visibleProducts;
 }
Пример #6
0
    public static IEnumerable <MorphRecipe> ImportForFigure(DsonObjectLocator locator, FigureUris figureUris)
    {
        MorphImporter importer = new MorphImporter();

        foreach (DsonTypes.DsonDocument doc in locator.GetAllDocumentsUnderPath(figureUris.MorphsBasePath))
        {
            importer.ImportFrom(doc);
        }

        return(importer.MorphRecipes);
    }
    public static IEnumerable <BoneRecipe> ImportForFigure(DsonObjectLocator locator, FigureUris figureUris)
    {
        BoneImporter importer = new BoneImporter();

        importer.ImportFrom(locator.LocateRoot(figureUris.DocumentUri));

        return(importer.BoneRecipes);
    }
    public static IEnumerable <UvSetRecipe> ImportForFigure(DsonObjectLocator locator, FigureUris figureUris, GeometryRecipe geometry)
    {
        UvSetImporter importer = new UvSetImporter(geometry);

        foreach (DsonTypes.DsonDocument doc in locator.GetAllDocumentsUnderPath(figureUris.UvSetsBasePath))
        {
            importer.ImportFrom(doc);
        }

        return(importer.Recipes);
    }
Пример #9
0
 public ImportProperties(FigureUris uris, double hdCorrectionInitialValue)
 {
     Uris = uris;
     HdCorrectionInitialValue = hdCorrectionInitialValue;
 }
    public static IEnumerable <ChannelRecipe> ImportForFigure(DsonObjectLocator locator, FigureUris figureUris, ImmutableHashSet <string> visibleProducts)
    {
        ChannelImporter importer = new ChannelImporter(locator, figureUris.RootNodeId);

        importer.ImportFrom(locator.LocateRoot(figureUris.DocumentUri), false);
        foreach (DsonTypes.DsonDocument doc in locator.GetAllDocumentsUnderPath(figureUris.MorphsBasePath))
        {
            bool forceModifiersHidden = visibleProducts != null && !visibleProducts.Contains(doc.Product);
            importer.ImportFrom(doc, forceModifiersHidden);
        }

        return(importer.ChannelRecipes);
    }
Пример #11
0
    public static FigureRecipe ImportFor(string figureName, ContentFileLocator fileLocator, DsonObjectLocator locator, FigureUris figureUris, FigureRecipe parentRecipe, double hdCorrectionInitialValue, ImmutableHashSet <string> visibleProducts)
    {
        var geometryRecipe = GeometryImporter.ImportForFigure(locator, figureUris);

        FigureRecipe recipe = new FigureRecipe {
            Name        = figureName,
            Geometry    = geometryRecipe,
            Channels    = ChannelImporter.ImportForFigure(locator, figureUris, visibleProducts).ToList(),
            Formulas    = FormulaImporter.ImportForFigure(locator, figureUris).ToList(),
            Bones       = BoneImporter.ImportForFigure(locator, figureUris).ToList(),
            Morphs      = MorphImporter.ImportForFigure(fileLocator, locator, figureUris).ToList(),
            SkinBinding = SkinBindingImporter.ImportForFigure(locator, figureUris),
            UvSets      = UvSetImporter.ImportForFigure(locator, figureUris, geometryRecipe).ToList()
        };

        Geometry geometry = recipe.Geometry.Bake();

        var correctionSynthesizer = new HdCorrectionMorphSynthesizer(figureName, geometry);

        recipe.Channels.Add(correctionSynthesizer.SynthesizeChannel(hdCorrectionInitialValue));
        recipe.Morphs.Add(correctionSynthesizer.SynthesizeMorph());

        if (parentRecipe == null)
        {
            var scaleControlSynthesizer = new ScaleControlChannelSynthesizer(recipe.Bones);
            recipe.Channels.Add(scaleControlSynthesizer.SynthesizeChannel());
            recipe.Formulas.Add(scaleControlSynthesizer.SynthesizeFormula());
        }

        if (parentRecipe != null)
        {
            Geometry parentGeometry = parentRecipe.Geometry.Bake();
            recipe.Automorpher = AutomorpherRecipe.Make(parentGeometry, geometry);
        }

        return(recipe);
    }