Пример #1
0
    public static FigureRecipe ImportFor(string figureName, DsonObjectLocator locator, FigureUris figureUris, FigureRecipe parentRecipe, double hdCorrectionInitialValue)
    {
        var geometryRecipe = GeometryImporter.ImportForFigure(locator, figureUris);

        FigureRecipe recipe = new FigureRecipe {
            Name        = figureName,
            Geometry    = geometryRecipe,
            Channels    = ChannelImporter.ImportForFigure(locator, figureUris).ToList(),
            Formulas    = FormulaImporter.ImportForFigure(locator, figureUris).ToList(),
            Bones       = BoneImporter.ImportForFigure(locator, figureUris).ToList(),
            Morphs      = MorphImporter.ImportForFigure(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)
        {
            Geometry parentGeometry = parentRecipe.Geometry.Bake();
            recipe.Automorpher = AutomorpherRecipe.Make(parentGeometry, geometry);
        }

        return(recipe);
    }
Пример #2
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);
    }