Skip to content

Commit

Permalink
add PropertyDrawer for MA.RendererFirstPersonFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikoga committed Dec 30, 2023
1 parent 4e62aec commit a9f82b3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Editor/Inspector/VRM/RendererFirstPersonFlagsDrawer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using nadena.dev.modular_avatar.core.vrm;
using UnityEditor;
using UnityEngine;

namespace nadena.dev.modular_avatar.core.editor.vrm
{
[CustomPropertyDrawer(typeof(ModularAvatarMergeVRMFirstPerson.RendererFirstPersonFlags))]
internal class RendererFirstPersonFlagsDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var rendererProp = property.FindPropertyRelative(nameof(ModularAvatarMergeVRMFirstPerson.RendererFirstPersonFlags.renderer));
var flagProp = property.FindPropertyRelative(nameof(ModularAvatarMergeVRMFirstPerson.RendererFirstPersonFlags.firstPersonFlag));

const float rightSideWidth = 140.0f;

var leftSide = position;
leftSide.xMax -= rightSideWidth;
EditorGUI.PropertyField(leftSide, rendererProp, GUIContent.none);

var rightSide = position;
rightSide.xMin = rightSide.xMax - rightSideWidth;
EditorGUI.PropertyField(rightSide, flagProp, GUIContent.none);
}
}
}
3 changes: 3 additions & 0 deletions Editor/Inspector/VRM/RendererFirstPersonFlagsDrawer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9f82b3

Please sign in to comment.