fix: change attachment mode causes non-undoable transform movement (#710)

Closes: #655
This commit is contained in:
bd_ 2024-02-27 02:27:24 -08:00 committed by GitHub
parent 97fe8075a6
commit 6c4c0afb06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,9 +1,13 @@
using System;
#region
using System;
using UnityEditor;
using UnityEngine;
using static nadena.dev.modular_avatar.core.editor.Localization;
using Object = UnityEngine.Object;
#endregion
namespace nadena.dev.modular_avatar.core.editor
{
internal class TempObjRef : ScriptableObject
@ -104,7 +108,18 @@ namespace nadena.dev.modular_avatar.core.editor
serializedObject.UpdateIfRequiredOrScript();
var p_attachmentMode = serializedObject.FindProperty(nameof(ModularAvatarBoneProxy.attachmentMode));
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(p_attachmentMode, G("boneproxy.attachment"));
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
foreach (var target in targets)
{
var t = (ModularAvatarBoneProxy)target;
Undo.RecordObject(t.transform, "");
t.Update();
}
}
foldout = EditorGUILayout.Foldout(foldout, G("boneproxy.foldout.advanced"));
if (foldout)
@ -122,7 +137,7 @@ namespace nadena.dev.modular_avatar.core.editor
serializedObject.ApplyModifiedProperties();
Localization.ShowLanguageUI();
ShowLanguageUI();
}
private void CheckAttachmentMode(ModularAvatarBoneProxy boneProxy)