Exemplo n.º 1
0
        public void ExportAvatarAsFbx()
        {
            var    haircutRecoloring = GetComponent <HaircutRecoloring>();
            string haircutName       = string.Empty;

            if (avatarHaircuts != null && string.Compare(avatarHaircuts[currentHaircut], BALD_HAIRCUT_NAME) != 0)
            {
                haircutName = avatarHaircuts[currentHaircut];
            }

            var exportDir     = AvatarSdkMgr.Storage().GetAvatarSubdirectory(currentAvatarCode, AvatarSubdirectory.FBX_EXPORT);
            var outputFbxFile = Utils.CombinePaths(exportDir, "model.fbx");

            CoreTools.ExportAvatarAsFbx(currentAvatarCode, outputFbxFile);

            if (!string.IsNullOrEmpty(haircutName))
            {
                var haircutFbxFile = Path.Combine(Path.GetDirectoryName(outputFbxFile), HaircutIdToFileName(haircutName, "fbx"));
                CoreTools.HaircutPlyToFbx(currentAvatarCode, haircutName, haircutFbxFile, haircutRecoloring.CurrentColor, haircutRecoloring.CurrentTint);
            }

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
            System.Diagnostics.Process.Start(exportDir);
#else
            progressText.text = string.Format("FBX file was saved to avatar directory");
#endif
        }