Example #1
0
    // Use this for initialization
    void Start()
    {
        if (bakedPoints == null)
        {
            Debug.LogError("Baked points cannot be empty");
        }

        MeshGridData meshGrid = JsonUtility.FromJson <MeshGridData>(bakedPoints.text);

        _isSkinnedMesh     = meshGrid.isRigged;
        _boneWeightIndices = meshGrid.boneWeightIndices;
        _pointList         = meshGrid.points;
    }
Example #2
0
    void WriteToFile()
    {
        _meshGridData                   = new MeshGridData();
        _meshGridData.isRigged          = _isSkinnedMesh;
        _meshGridData.cellSize          = _gridCellSize;
        _meshGridData.points            = _isSkinnedMesh ? _bonePoint : _pointsList;
        _meshGridData.boneWeightIndices = _isSkinnedMesh ? _boneWeightIndices : null;

        string       json   = JsonUtility.ToJson(_meshGridData);
        StreamWriter writer = new StreamWriter(_path + _fileName, false);

        writer.WriteLine(json);
        writer.Close();
    }