Improved the culling result of HizCulling;
Added custom inspector for VolumeObject; Change the name of AoVolume to VolumeObject;
This commit is contained in:
36
Editor/PropertyDrawer/PopupBooleanDrawer.cs
Normal file
36
Editor/PropertyDrawer/PopupBooleanDrawer.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Misaki.AoVolume.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(PopupBooleanAttribute))]
|
||||
public class PopupBooleanDrawer : PropertyDrawer
|
||||
{
|
||||
private static readonly GUIContent[] _popupContent = { new("False"), new("True") };
|
||||
private static readonly List<bool> _popupOptions = new() { false, true };
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var value = property.boolValue;
|
||||
var index = value ? 1 : 0;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
index = EditorGUI.Popup(position, label, index, _popupContent);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
property.boolValue = index == 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override VisualElement CreatePropertyGUI(SerializedProperty property)
|
||||
{
|
||||
var popupField = new PopupField<bool>(property.displayName, _popupOptions, false);
|
||||
popupField.AddToClassList(PopupField<bool>.alignedFieldUssClassName);
|
||||
popupField.bindingPath = property.propertyPath;
|
||||
|
||||
return popupField;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Editor/PropertyDrawer/PopupBooleanDrawer.cs.meta
Normal file
2
Editor/PropertyDrawer/PopupBooleanDrawer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60948f0da82ab5849b3df0b869031b01
|
||||
Reference in New Issue
Block a user