コード例 #1
0
    public static GeometryRecipe ImportForFigure(DsonObjectLocator locator, FigureUris figureUris)
    {
        GeometryImporter importer = new GeometryImporter();

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

        return(importer.recipes.Single());
    }
コード例 #2
0
    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);
    }
コード例 #5
0
 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);
    }
コード例 #7
0
    public static IEnumerable <BoneRecipe> ImportForFigure(DsonObjectLocator locator, FigureUris figureUris)
    {
        BoneImporter importer = new BoneImporter();

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

        return(importer.BoneRecipes);
    }
コード例 #8
0
    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;
 }
コード例 #10
0
    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);
    }