public List <WeightedHdMorph> LoadActiveHdMorphs(ChannelOutputs channelOutputs)
    {
        List <WeightedHdMorph> hdMorphs = new List <WeightedHdMorph>();

        foreach (var morph in morphs)
        {
            float weight = (float)morph.Channel.GetValue(channelOutputs);
            if (weight == 0)
            {
                continue;
            }

            var hdFile = morph.HdFile;
            if (hdFile == null)
            {
                continue;
            }

            var hdMorph = HdMorphSerialization.LoadHdMorph(hdFile);

            hdMorphs.Add(new WeightedHdMorph(hdMorph, weight));
        }

        return(hdMorphs);
    }
Ejemplo n.º 2
0
    public void Run()
    {
        //FileInfo file = CommonPaths.SourceAssetsDir.File("daz-assets/FWSAAdalineHDforVictoria7/Content/data/DAZ 3D/Genesis 3/Female/Morphs/FWSA/Adaline/FBM-FWSAAdaline.dhdm");
        //FileInfo file = CommonPaths.SourceAssetsDir.File("daz-assets/FWSAAdalineHDforVictoria7/Content/data/DAZ 3D/Genesis 3/Female/Morphs/FWArt/FW_PBMNails.dhdm");
        FileInfo file = CommonPaths.SourceAssetsDir.File("daz-assets/Rune7HDAddOn/Content/data/DAZ 3D/Genesis 3/Female/Morphs/Daz 3D/Rune 7/FBMRune7HD.dhdm");

        HdMorph hdMorph = HdMorphSerialization.LoadHdMorph(file);

        ValidateHdMorph(hdMorph);
        PrintHdMorph(hdMorph);
    }
    public static HdMorph LoadHdMorph(FileInfo file)
    {
        using (var stream = file.OpenRead())
            using (var reader = new BinaryReader(stream)) {
                var hdMorph = HdMorphSerialization.ReadHdMorph(reader);

                if (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    throw new InvalidOperationException("not at end of file");
                }

                return(hdMorph);
            }
    }
    public void Run()
    {
        var delta      = new Vector3(10, 20, 30);
        var vertexEdit = new HdMorph.VertexEdit(HdMorph.VertexEdit.PackPath(0, 2, 1), delta);
        var faceEdit   = new HdMorph.FaceEdit(200, ImmutableArray.Create(vertexEdit));

        var     level1  = new HdMorph.Level(G3FControlFaceCount, 1, ImmutableArray <HdMorph.FaceEdit> .Empty);
        var     level2  = new HdMorph.Level(G3FControlFaceCount, 2, ImmutableArray.Create(faceEdit));
        var     levels  = ImmutableArray.Create(level1, level2);
        HdMorph hdMorph = new HdMorph(levels);

        var outFile = new FileInfo(@"C:\Users\Public\Documents\My DAZ 3D Library\data\DAZ 3D\Genesis 3\Female\Morphs\GregTest\FBM-GregHDTest.dhdm");

        HdMorphSerialization.SaveHdMorph(outFile, hdMorph);
    }