modular-avatar/Editor/Inspector/MergeAnimationEditor.cs
kaikoga 3667dc319a
chore: Wrap VRC dependencies and VRCAvatarDescriptors (#504)
* add version defines

* refactor: prefer BuildContext.ctor() overload taking GameObject

* wrap unit tests entirely with MA_VRCSDK3_AVATARS

* wrap unit tests smart with MA_VRCSDK3_AVATARS

* wrap runtime entirely with MA_VRCSDK3_AVATARS

* wrap VRC.SDKBase.IEditorOnly with MA_VRCSDK3_AVATARS

* wrap editor entirely with MA_VRCSDK3_AVATARS

* fix AvatarObjectReference.Get(Component)

* wrap editor smart with MA_VRCSDK3_AVATARS

* wrap BuildContext smart with MA_VRCSDK3_AVATARS

* wrap PluginDefinition smart with MA_VRCSDK3_AVATARS

* style: move conditional compiles one step outside
2023-11-10 15:37:56 +09:00

52 lines
2.0 KiB
C#

#if MA_VRCSDK3_AVATARS
using UnityEditor;
using static nadena.dev.modular_avatar.core.editor.Localization;
namespace nadena.dev.modular_avatar.core.editor
{
[CustomPropertyDrawer(typeof(MergeAnimatorPathMode))]
class PathModeDrawer : EnumDrawer<MergeAnimatorPathMode>
{
protected override string localizationPrefix => "path_mode";
}
[CustomEditor(typeof(ModularAvatarMergeAnimator))]
class MergeAnimationEditor : MAEditorBase
{
private SerializedProperty prop_animator,
prop_layerType,
prop_deleteAttachedAnimator,
prop_pathMode,
prop_matchAvatarWriteDefaults;
private void OnEnable()
{
prop_animator = serializedObject.FindProperty(nameof(ModularAvatarMergeAnimator.animator));
prop_layerType = serializedObject.FindProperty(nameof(ModularAvatarMergeAnimator.layerType));
prop_deleteAttachedAnimator =
serializedObject.FindProperty(nameof(ModularAvatarMergeAnimator.deleteAttachedAnimator));
prop_pathMode = serializedObject.FindProperty(nameof(ModularAvatarMergeAnimator.pathMode));
prop_matchAvatarWriteDefaults =
serializedObject.FindProperty(nameof(ModularAvatarMergeAnimator.matchAvatarWriteDefaults));
}
protected override void OnInnerInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(prop_animator, G("merge_animator.animator"));
EditorGUILayout.PropertyField(prop_layerType, G("merge_animator.layer_type"));
EditorGUILayout.PropertyField(prop_deleteAttachedAnimator, G("merge_animator.delete_attached_animator"));
EditorGUILayout.PropertyField(prop_pathMode, G("merge_animator.path_mode"));
EditorGUILayout.PropertyField(prop_matchAvatarWriteDefaults,
G("merge_animator.match_avatar_write_defaults"));
serializedObject.ApplyModifiedProperties();
ShowLanguageUI();
}
}
}
#endif