-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add PropertyDrawer for MA.RendererFirstPersonFlags
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.