private static void AddFileInfoToDictionary(Dictionary <string, object> dictionary)
        {
            dictionary.Add("fileversion", data.fileVersion);
            dictionary.Add("hasindex", data.hasIndex);
            dictionary.Add("pointcount", data.pointCount);
            dictionary.Add("vertexcount", data.vertexCount);
            dictionary.Add("primitivecount", data.primCount);

            HoudiniGeoFileInfo fileInfo = data.fileInfo.Copy();

            fileInfo.date = DateTime.Now;

            dictionary.Add("info", fileInfo);
        }
Beispiel #2
0
        private static HoudiniGeoFileInfo ParseFileInfo(JObject infoValueToken)
        {
            //"info",{
            //	"software":"Houdini 13.0.665",
            //	"hostname":"waldos-mbp.home",
            //	"artist":"waldo",
            //	"timetocook":0.248844,
            //	"date":"2015-02-20 22:00:37",
            //	"time":0,
            //	"bounds":[-5.10615968704,5.16862106323,0,4.77225112915,-5.18210935593,5.08164167404],
            //	"primcount_summary":"     10,197 Polygons\n",
            //	"attribute_summary":"     1 point attributes:\tP\n"
            //},

            var fileInfo = new HoudiniGeoFileInfo();

            fileInfo.software   = infoValueToken["software"].Value <string>();
            fileInfo.hostname   = infoValueToken["hostname"].Value <string>();
            fileInfo.artist     = infoValueToken["artist"].Value <string>();
            fileInfo.timetocook = infoValueToken["timetocook"].Value <float>();
            fileInfo.date       = infoValueToken["date"].Value <System.DateTime>();

            float[] bv        = infoValueToken["bounds"].Values <float>().ToArray();
            Vector3 boundsMin = new Vector3(bv[0], bv[1], bv[2]);
            Vector3 boundsMax = new Vector3(bv[3], bv[4], bv[5]);

            fileInfo.bounds = new Bounds();
            fileInfo.bounds.SetMinMax(boundsMin, boundsMax);

            bool hadPrimCountSummary = infoValueToken.TryGetValue("primcount_summary", out JToken primcountSummary);

            if (hadPrimCountSummary)
            {
                fileInfo.primcount_summary = primcountSummary.Value <string>();
            }

            fileInfo.attribute_summary = infoValueToken["attribute_summary"].Value <string>();

            return(fileInfo);
        }