From 7559fb2dde7201ff5d5a9732bd14703c97d93119 Mon Sep 17 00:00:00 2001 From: Kohei-Yanagida Date: Tue, 17 Dec 2019 21:29:30 +0900 Subject: [PATCH] fix RecordDisposer when export VRM --- .../VRM/UniVRM/Scripts/Format/VRMExportSettings.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs b/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs index c96f71c7f..f1acd2860 100644 --- a/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs +++ b/Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs @@ -236,14 +236,21 @@ namespace VRM #if UNITY_EDITOR public struct RecordDisposer : IDisposable { + int _group; public RecordDisposer(UnityEngine.Object[] objects, string msg) { + Debug.Log("[Record] Undo.GetCurrentGroup() = " + Undo.GetCurrentGroup()); + Undo.IncrementCurrentGroup(); + _group = Undo.GetCurrentGroup(); + Debug.Log("[Record] Undo.GetCurrentGroup() = " + Undo.GetCurrentGroup()); Undo.RecordObjects(objects, msg); } public void Dispose() { - Undo.PerformUndo(); + Debug.Log("[Dispose] Undo.GetCurrentGroup() = " + Undo.GetCurrentGroup()); + Undo.RevertAllDownToGroup(_group); + Debug.Log("[Dispose] Undo.GetCurrentGroup() = " + Undo.GetCurrentGroup()); } } @@ -287,7 +294,7 @@ namespace VRM } } - // remove unused blendShape + // remove unused blendShape if (ReduceBlendshapeSize) { var proxy = target.GetComponent(); @@ -389,11 +396,10 @@ namespace VRM } #if UNITY_2018_3_OR_NEWER - PrefabUtility.RevertPrefabInstance(target, InteractionMode.AutomatedAction); + PrefabUtility.RevertPrefabInstance(Source, InteractionMode.AutomatedAction); #else PrefabUtility.RevertPrefabInstance(target); #endif - if (path.StartsWithUnityAssetPath()) { AssetDatabase.ImportAsset(path.ToUnityRelativePath());