Exemplo n.º 1
0
    // saves the specified fbx file
    private bool SaveFile()
    {
        if (saveFilePath == string.Empty)
        {
            saveFilePath = loadFilePath;
        }

        // delete the old csv file
        if (saveFilePath != string.Empty && File.Exists(saveFilePath))
        {
            File.Delete(saveFilePath);

#if UNITY_EDITOR
            UnityEditor.AssetDatabase.Refresh();             //.ImportAsset(saveFilePath);
#endif
        }

        if (saveFilePath != string.Empty)
        {
            if (MocapFbxWrapper.SaveFbxFile(saveFilePath, outputFileFormat))
            {
#if UNITY_EDITOR
                UnityEditor.AssetDatabase.Refresh();                  //.ImportAsset(saveFilePath);
#endif

                bFbxDirty = false;

                // play the animation
                AnimationPlayer animPlayer = AnimationPlayer.Instance;
                if (animPlayer)
                {
                    animPlayer.PlayAnimationClip(saveFilePath, animationName);
                }

                return(true);
            }
            else
            {
                Debug.LogError("Could not save mo-cap to: " + saveFilePath);
            }
        }

        return(false);
    }