From c56ca52bbb27a1526ea3046133eed75e0d2076cb Mon Sep 17 00:00:00 2001 From: yutopp Date: Mon, 11 Mar 2019 16:18:02 +0900 Subject: [PATCH 1/3] Fix #208 --- .../VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs b/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs index a1d4a14e4..de6699cba 100644 --- a/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs +++ b/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs @@ -1,4 +1,5 @@ using UnityEditor; +using UnityEngine; namespace VRM @@ -16,12 +17,17 @@ namespace VRM return; } + EditorGUI.BeginChangeCheck(); var worldOffset = head.localToWorldMatrix.MultiplyPoint(component.FirstPersonOffset); worldOffset = Handles.PositionHandle(worldOffset, head.rotation); Handles.Label(worldOffset, "FirstPersonOffset"); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(component, "Changed FirstPerson"); + } component.FirstPersonOffset = head.worldToLocalMatrix.MultiplyPoint(worldOffset); } } From 0c147dd1fb694806752a8d7bedd24f0c3fa8dbf7 Mon Sep 17 00:00:00 2001 From: yutopp Date: Wed, 13 Mar 2019 19:58:08 +0900 Subject: [PATCH 2/3] Move value updation into the if block --- Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs b/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs index de6699cba..0d5021a73 100644 --- a/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs +++ b/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs @@ -27,8 +27,9 @@ namespace VRM if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(component, "Changed FirstPerson"); + + component.FirstPersonOffset = head.worldToLocalMatrix.MultiplyPoint(worldOffset); } - component.FirstPersonOffset = head.worldToLocalMatrix.MultiplyPoint(worldOffset); } } } From 3c75b38f05b79aebd5b1e36b8bb82734a195ec7a Mon Sep 17 00:00:00 2001 From: yutopp Date: Wed, 13 Mar 2019 19:58:26 +0900 Subject: [PATCH 3/3] Remove unused imports --- Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs b/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs index 0d5021a73..e0a6a1f5c 100644 --- a/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs +++ b/Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs @@ -1,6 +1,4 @@ using UnityEditor; -using UnityEngine; - namespace VRM {