-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
2,785 additions
and
655 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 57d0c11168277cf4eb3b4b89706e6aa5, type: 3} | ||
m_Name: TestOutlineLayers | ||
m_EditorClassIdentifier: | ||
_layers: | ||
- _settings: | ||
_outlineSettings: {fileID: 11400000, guid: 45705bbb29366194eb01ca517d80967c, | ||
type: 2} | ||
_outlineColor: {r: 1, g: 0, b: 0, a: 1} | ||
_outlineWidth: 5 | ||
_outlineIntensity: 2 | ||
_outlineMode: 0 | ||
- _settings: | ||
_outlineSettings: {fileID: 0} | ||
_outlineColor: {r: 1, g: 1, b: 0, a: 1} | ||
_outlineWidth: 15 | ||
_outlineIntensity: 2 | ||
_outlineMode: 1 | ||
- _settings: | ||
_outlineSettings: {fileID: 0} | ||
_outlineColor: {r: 1, g: 0, b: 1, a: 1} | ||
_outlineWidth: 4 | ||
_outlineIntensity: 2 | ||
_outlineMode: 0 |
File renamed without changes.
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,17 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: b579424fd3338724cba3155ee4d53475, type: 3} | ||
m_Name: TestOutlineSettings | ||
m_EditorClassIdentifier: | ||
_outlineColor: {r: 1, g: 0, b: 0, a: 1} | ||
_outlineWidth: 5 | ||
_outlineIntensity: 2 | ||
_outlineMode: 0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
166 changes: 166 additions & 0 deletions
166
Assets/Plugins/UnityFx.Outline/Editor/Scripts/OutlineEditorUtility.cs
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,166 @@ | ||
// Copyright (C) 2019 Alexander Bogarsukov. All rights reserved. | ||
// See the LICENSE.md file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace UnityFx.Outline | ||
{ | ||
internal static class OutlineEditorUtility | ||
{ | ||
public static void RenderDivider(Color color, int thickness = 1, int padding = 5) | ||
{ | ||
var r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); | ||
|
||
r.height = thickness; | ||
r.y += padding / 2; | ||
r.x -= 2; | ||
r.width += 6; | ||
|
||
EditorGUI.DrawRect(r, color); | ||
} | ||
|
||
public static void Render(IOutlineSettingsEx settings, UnityEngine.Object undoContext) | ||
{ | ||
var obj = (OutlineSettings)EditorGUILayout.ObjectField("Outline Settings", settings.OutlineSettings, typeof(OutlineSettings), true); | ||
|
||
if (settings.OutlineSettings != obj) | ||
{ | ||
Undo.RecordObject(undoContext, "Settings"); | ||
settings.OutlineSettings = obj; | ||
} | ||
|
||
if (obj) | ||
{ | ||
EditorGUI.BeginDisabledGroup(true); | ||
EditorGUI.indentLevel += 1; | ||
|
||
Render((IOutlineSettings)settings, undoContext); | ||
|
||
EditorGUILayout.HelpBox(string.Format("Outline settings are overriden with values from {0}.", obj.name), MessageType.Info, true); | ||
EditorGUI.indentLevel -= 1; | ||
EditorGUI.EndDisabledGroup(); | ||
} | ||
else | ||
{ | ||
EditorGUI.indentLevel += 1; | ||
|
||
Render((IOutlineSettings)settings, undoContext); | ||
|
||
EditorGUI.indentLevel -= 1; | ||
} | ||
} | ||
|
||
public static void Render(IOutlineSettings settings, UnityEngine.Object undoContext) | ||
{ | ||
var color = EditorGUILayout.ColorField("Color", settings.OutlineColor); | ||
|
||
if (settings.OutlineColor != color) | ||
{ | ||
Undo.RecordObject(undoContext, "Color"); | ||
settings.OutlineColor = color; | ||
} | ||
|
||
var width = EditorGUILayout.IntSlider("Width", settings.OutlineWidth, OutlineRenderer.MinWidth, OutlineRenderer.MaxWidth); | ||
|
||
if (settings.OutlineWidth != width) | ||
{ | ||
Undo.RecordObject(undoContext, "Width"); | ||
settings.OutlineWidth = width; | ||
} | ||
|
||
var blurred = EditorGUILayout.Toggle("Blurred", settings.OutlineMode == OutlineMode.Blurred); | ||
|
||
if (blurred) | ||
{ | ||
EditorGUI.indentLevel += 1; | ||
|
||
var i = EditorGUILayout.Slider("Blur Intensity", settings.OutlineIntensity, OutlineRenderer.MinIntensity, OutlineRenderer.MaxIntensity); | ||
|
||
if (!Mathf.Approximately(settings.OutlineIntensity, i)) | ||
{ | ||
Undo.RecordObject(undoContext, "Blur Intensity"); | ||
settings.OutlineIntensity = i; | ||
} | ||
|
||
EditorGUI.indentLevel -= 1; | ||
} | ||
|
||
if (blurred != (settings.OutlineMode == OutlineMode.Blurred)) | ||
{ | ||
Undo.RecordObject(undoContext, "Blur"); | ||
settings.OutlineMode = blurred ? OutlineMode.Blurred : OutlineMode.Solid; | ||
} | ||
} | ||
|
||
public static void RenderPreview(OutlineLayer layer, int layerIndex, bool showObjects) | ||
{ | ||
if (layer != null) | ||
{ | ||
var goIndex = 1; | ||
|
||
EditorGUILayout.BeginHorizontal(); | ||
EditorGUI.indentLevel += 1; | ||
EditorGUILayout.PrefixLabel("Layer #" + layerIndex.ToString()); | ||
EditorGUI.indentLevel -= 1; | ||
EditorGUILayout.IntField(layer.OutlineWidth, GUILayout.MaxWidth(100)); | ||
EditorGUILayout.ColorField(layer.OutlineColor, GUILayout.MinWidth(100)); | ||
EditorGUILayout.EndHorizontal(); | ||
|
||
if (showObjects) | ||
{ | ||
if (layer.Count > 0) | ||
{ | ||
foreach (var go in layer) | ||
{ | ||
EditorGUI.indentLevel += 2; | ||
EditorGUILayout.ObjectField("#" + goIndex.ToString(), go, typeof(GameObject), true); | ||
EditorGUI.indentLevel -= 2; | ||
|
||
goIndex++; | ||
} | ||
} | ||
else | ||
{ | ||
EditorGUI.indentLevel += 2; | ||
EditorGUILayout.LabelField("No objects."); | ||
EditorGUI.indentLevel -= 2; | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
EditorGUILayout.BeginHorizontal(); | ||
EditorGUI.indentLevel += 1; | ||
EditorGUILayout.PrefixLabel("Layer #" + layerIndex.ToString()); | ||
EditorGUI.indentLevel -= 1; | ||
EditorGUILayout.LabelField("Null"); | ||
EditorGUILayout.EndHorizontal(); | ||
} | ||
} | ||
|
||
public static void RenderPreview(IList<OutlineLayer> layers, bool showObjects) | ||
{ | ||
EditorGUI.BeginDisabledGroup(true); | ||
|
||
if (layers.Count > 0) | ||
{ | ||
for (var i = 0; i < layers.Count; ++i) | ||
{ | ||
RenderPreview(layers[i], i, showObjects); | ||
} | ||
} | ||
else | ||
{ | ||
EditorGUI.indentLevel += 1; | ||
EditorGUILayout.LabelField("No layers."); | ||
EditorGUI.indentLevel -= 1; | ||
} | ||
|
||
EditorGUI.EndDisabledGroup(); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...untime/Scripts/OutlineBehaviourRt.cs.meta → ...itor/Scripts/OutlineEditorUtility.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.