mirror of
https://github.com/maxartz15/InteractiveMask.git
synced 2025-06-14 15:56:14 +02:00
Mask Camera
- MaskCamera. - MaskDrawer. - Settings. - Prefab.
This commit is contained in:
48
Editor/MaskDrawer.cs
Normal file
48
Editor/MaskDrawer.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TAO.InteractiveMask.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Mask))]
|
||||
public class MaskDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
// Using BeginProperty / EndProperty on the parent property means that
|
||||
// prefab override logic works on the entire property.
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
|
||||
int indent = EditorGUI.indentLevel;
|
||||
Color color = GUI.color;
|
||||
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
float width = position.width / 4;
|
||||
Rect rectR = new Rect(position.x + (width * 0), position.y, width, position.height);
|
||||
Rect rectG = new Rect(position.x + (width * 1), position.y, width, position.height);
|
||||
Rect rectB = new Rect(position.x + (width * 2), position.y, width, position.height);
|
||||
Rect rectA = new Rect(position.x + (width * 3), position.y, width, position.height);
|
||||
|
||||
GUI.color = Color.red;
|
||||
EditorGUI.PropertyField(rectR, property.FindPropertyRelative("r"), new GUIContent(""));
|
||||
GUI.color = Color.green;
|
||||
EditorGUI.PropertyField(rectG, property.FindPropertyRelative("g"), new GUIContent(""));
|
||||
GUI.color = Color.cyan;
|
||||
EditorGUI.PropertyField(rectB, property.FindPropertyRelative("b"), new GUIContent(""));
|
||||
GUI.color = Color.gray;
|
||||
EditorGUI.PropertyField(rectA, property.FindPropertyRelative("a"), new GUIContent(""));
|
||||
|
||||
GUI.color = color;
|
||||
EditorGUI.indentLevel = indent;
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return base.GetPropertyHeight(property, label);
|
||||
}
|
||||
}
|
||||
}
|
11
Editor/MaskDrawer.cs.meta
Normal file
11
Editor/MaskDrawer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f8624dd5f85530428dd00f913026c1b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user