Exemple #1
0
        public void ExportAvatarWithBlendshapesWeightsAsFbx()
        {
            var exportDir     = AvatarSdkMgr.Storage().GetAvatarSubdirectory(selectedAvatarInfo.code, AvatarSubdirectory.FBX_EXPORT);
            var outputFbxFile = Utils.CombinePaths(exportDir, "model.fbx");

            string haircutName = selectedAvatarInfo.SelectedHairstyleName;

            if (!string.IsNullOrEmpty(haircutName))
            {
                CoreTools.SaveAvatarMesh(selectedAvatarInfo.headMeshRenderer, selectedAvatarInfo.code, outputFbxFile, MeshFileFormat.FBX, true, false, haircutName,
                                         selectedAvatarInfo.HaircutColor, selectedAvatarInfo.HaircutColorTint);
            }
            else
            {
                CoreTools.SaveAvatarMesh(selectedAvatarInfo.headMeshRenderer, selectedAvatarInfo.code, outputFbxFile, MeshFileFormat.FBX, true, false);
            }

            System.Diagnostics.Process.Start(exportDir);
        }
Exemple #2
0
        public void ExportAvatarAsObj()
        {
            var outputObjDir  = AvatarSdkMgr.Storage().GetAvatarSubdirectory(selectedAvatarInfo.code, AvatarSubdirectory.OBJ_EXPORT);
            var outputObjFile = Utils.CombinePaths(outputObjDir, "model.obj");

            string haircutName = selectedAvatarInfo.SelectedHairstyleName;

            if (!string.IsNullOrEmpty(haircutName))
            {
                CoreTools.SaveAvatarMesh(selectedAvatarInfo.headMeshRenderer, selectedAvatarInfo.code, outputObjFile, MeshFileFormat.OBJ, true, false, haircutName,
                                         selectedAvatarInfo.HaircutColor, selectedAvatarInfo.HaircutColorTint);
            }
            else
            {
                CoreTools.SaveAvatarMesh(selectedAvatarInfo.headMeshRenderer, selectedAvatarInfo.code, outputObjFile, MeshFileFormat.OBJ, true, false);
            }

            System.Diagnostics.Process.Start(outputObjDir);
        }
Exemple #3
0
        public static string ExportAvatarAsFbx(AvatarInfo avatarInfo, bool includeBlendshapes)
        {
            string fbxFilePath = EditorUtility.SaveFilePanel("Export As", "", "model", "fbx");

            if (!string.IsNullOrEmpty(fbxFilePath))
            {
                string haircutName = avatarInfo.SelectedHairstyleName;
                if (!string.IsNullOrEmpty(haircutName))
                {
                    CoreTools.SaveAvatarMesh(avatarInfo.headMeshRenderer, avatarInfo.code, fbxFilePath, MeshFileFormat.FBX, !includeBlendshapes, includeBlendshapes,
                                             haircutName, avatarInfo.HaircutColor, avatarInfo.HaircutColorTint, avatarInfo.levelOfDetails);
                }
                else
                {
                    CoreTools.SaveAvatarMesh(avatarInfo.headMeshRenderer, avatarInfo.code, fbxFilePath, MeshFileFormat.FBX,
                                             !includeBlendshapes, includeBlendshapes, levelOfDetails: avatarInfo.levelOfDetails);
                }
            }
            return(fbxFilePath);
        }
Exemple #4
0
        public static string ExportAvatarAsObj(AvatarInfo avatarInfo)
        {
            string objFilePath = EditorUtility.SaveFilePanel("Export As", "", "model", "obj");

            if (!string.IsNullOrEmpty(objFilePath))
            {
                string haircutName = avatarInfo.SelectedHairstyleName;
                if (!string.IsNullOrEmpty(haircutName))
                {
                    CoreTools.SaveAvatarMesh(avatarInfo.headMeshRenderer, avatarInfo.code, objFilePath, MeshFileFormat.OBJ, true, false, haircutName,
                                             avatarInfo.HaircutColor, avatarInfo.HaircutColorTint, avatarInfo.levelOfDetails);
                }
                else
                {
                    CoreTools.SaveAvatarMesh(avatarInfo.headMeshRenderer, avatarInfo.code, objFilePath, MeshFileFormat.OBJ, true, false,
                                             levelOfDetails: avatarInfo.levelOfDetails);
                }
            }
            return(objFilePath);
        }