initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
// OutlineFx © NullTale - https://x.com/NullTale/
|
||||
namespace OutlineFx.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Optional<>))]
|
||||
public class OptionalDrawer : PropertyDrawer
|
||||
{
|
||||
private const float k_ToggleWidth = 18;
|
||||
|
||||
// =======================================================================
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var valueProperty = property.FindPropertyRelative("value");
|
||||
return EditorGUI.GetPropertyHeight(valueProperty);
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var valueProperty = property.FindPropertyRelative("value");
|
||||
var enabledProperty = property.FindPropertyRelative("enabled");
|
||||
|
||||
OnGui(position, label, enabledProperty, valueProperty);
|
||||
}
|
||||
|
||||
public static void OnGui(Rect position, GUIContent label, SerializedProperty enabledProperty, SerializedProperty valueProperty)
|
||||
{
|
||||
position.width -= k_ToggleWidth;
|
||||
using (new EditorGUI.DisabledGroupScope(!enabledProperty.boolValue))
|
||||
EditorGUI.PropertyField(position, valueProperty, label, true);
|
||||
|
||||
int indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
var togglePos = new Rect(position.x + position.width + EditorGUIUtility.standardVerticalSpacing, position.y, k_ToggleWidth, EditorGUIUtility.singleLineHeight);
|
||||
enabledProperty.boolValue = EditorGUI.Toggle(togglePos, GUIContent.none, enabledProperty.boolValue);
|
||||
|
||||
EditorGUI.indentLevel = indent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f5183bcac50faa4ca8eadb901bbd215
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 290431
|
||||
packageName: Outline 2D/3D
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/Outline/Editor/OptionalDrawer.cs
|
||||
uploadId: 678360
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "OutlineFx.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:bdbbf3324f8e871489bfc4305a67110a"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc8d4d28a11c62c439d34471170d3450
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 290431
|
||||
packageName: Outline 2D/3D
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/Outline/Editor/OutlineFx.Editor.asmdef
|
||||
uploadId: 678360
|
||||
@@ -0,0 +1,48 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
// OutlineFx © NullTale - https://x.com/NullTale/
|
||||
namespace OutlineFx.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(OutlineFxFeature.SolidMask))]
|
||||
public class SolidMaskDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var lines = 3;
|
||||
|
||||
if (property.isExpanded == false)
|
||||
lines = 1;
|
||||
|
||||
return lines * EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var enabled = property.FindPropertyRelative(nameof(OutlineFxFeature.SolidMask._enabled));
|
||||
var pattern = property.FindPropertyRelative(nameof(OutlineFxFeature.SolidMask._pattern));
|
||||
var scale = property.FindPropertyRelative(nameof(OutlineFxFeature.SolidMask._scale));
|
||||
var velocity = property.FindPropertyRelative(nameof(OutlineFxFeature.SolidMask._velocity));
|
||||
|
||||
var line = 0;
|
||||
OptionalDrawer.OnGui(_fieldRect(line ++), label, enabled, pattern);
|
||||
property.isExpanded = EditorGUI.Foldout(_fieldRect(line - 1), property.isExpanded, GUIContent.none, true);
|
||||
|
||||
if (property.isExpanded == false)
|
||||
return;
|
||||
EditorGUI.indentLevel ++;
|
||||
using (new EditorGUI.DisabledGroupScope(!enabled.boolValue))
|
||||
{
|
||||
EditorGUI.PropertyField(_fieldRect(line ++), scale, true);
|
||||
EditorGUI.PropertyField(_fieldRect(line ++), velocity, true);
|
||||
}
|
||||
EditorGUI.indentLevel --;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
Rect _fieldRect(int line)
|
||||
{
|
||||
return new Rect(position.x, position.y + line * EditorGUIUtility.singleLineHeight, position.width, EditorGUIUtility.singleLineHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23f3aacd265c4e309d33c46d1253d4b9
|
||||
timeCreated: 1694189677
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 290431
|
||||
packageName: Outline 2D/3D
|
||||
packageVersion: 1.0
|
||||
assetPath: Assets/Outline/Editor/SolidMaskDrawer.cs
|
||||
uploadId: 678360
|
||||
Reference in New Issue
Block a user