-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to Unity 2020.1.15f1 version; Added Rainbow Folders 2 and Enh…
…janced Hierarchy 2.0 plugins.
- Loading branch information
SMARTIUM
committed
Nov 28, 2020
1 parent
29720b4
commit 3ff9264
Showing
169 changed files
with
6,145 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using UnityEditor; | ||
|
||
namespace EnhancedHierarchy { | ||
/// <summary>Utility class for running async tasks within the main thread.</summary> | ||
public static class After { | ||
|
||
/// <summary>Wait for a condition to become true, then executes the callback.</summary> | ||
/// <param name="condition">Function that will be called every frame that returns whether to invoke the callback or not.</param> | ||
/// <param name="callback">The callback to be called when the condition becomes true.</param> | ||
/// <param name="timeoutMs">Maximum time to wait in milliseconds before cancelling the callback.</param> | ||
public static void Condition(Func<bool> condition, Action callback, double timeoutMs = 0d) { | ||
var update = new EditorApplication.CallbackFunction(() => { }); | ||
var timeoutsAt = EditorApplication.timeSinceStartup + (timeoutMs / 1000d); | ||
var stack = new StackFrame(1, true); | ||
|
||
update = () => { | ||
if (timeoutMs > 0d && EditorApplication.timeSinceStartup >= timeoutsAt) { | ||
EditorApplication.update -= update; | ||
UnityEngine.Debug.LogErrorFormat("Condition timedout at {0}:{1}", stack.GetFileName(), stack.GetFileLineNumber()); | ||
return; | ||
} | ||
|
||
if (condition()) { | ||
EditorApplication.update -= update; | ||
callback(); | ||
} | ||
}; | ||
|
||
EditorApplication.update += update; | ||
} | ||
|
||
/// <summary>Wait for the given amount of editor frames, then executes the callback.</summary> | ||
/// <param name="frames">The number of frames to wait for.</param> | ||
/// <param name="callback">The callback to be called after the specified frames.</param> | ||
public static void Frames(int frames, Action callback) { | ||
var f = 0; | ||
Condition(() => f++ >= frames, callback); | ||
} | ||
|
||
/// <summary>Wait for the given time, then executes the callback.</summary> | ||
/// <param name="milliseconds">How long to wait until calling the callback, in milliseconds.</param> | ||
/// <param name="callback">The callback to be called after the specified time.</param> | ||
public static void Milliseconds(double milliseconds, Action callback) { | ||
var end = EditorApplication.timeSinceStartup + (milliseconds / 1000f); | ||
Condition(() => EditorApplication.timeSinceStartup >= end, callback); | ||
} | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
using System; | ||
using UnityEditor; | ||
using UnityEditor.AnimatedValues; | ||
using UnityEngine; | ||
|
||
namespace EnhancedHierarchy { | ||
|
||
public struct GUIBackgroundColor : IDisposable { | ||
private readonly Color before; | ||
|
||
public GUIBackgroundColor(Color color) { | ||
before = GUI.backgroundColor; | ||
GUI.backgroundColor = color; | ||
} | ||
|
||
public void Dispose() { | ||
GUI.backgroundColor = before; | ||
} | ||
} | ||
|
||
public struct GUIContentColor : IDisposable { | ||
private readonly Color before; | ||
|
||
public GUIContentColor(Color color) { | ||
before = GUI.contentColor; | ||
GUI.contentColor = color; | ||
} | ||
|
||
public void Dispose() { | ||
GUI.contentColor = before; | ||
} | ||
} | ||
|
||
public struct GUIColor : IDisposable { | ||
private readonly Color before; | ||
|
||
public GUIColor(Color color) { | ||
before = GUI.color; | ||
GUI.color = color; | ||
} | ||
|
||
public GUIColor(Color color, float alpha) { | ||
before = GUI.color; | ||
color.a = alpha; | ||
GUI.color = color; | ||
} | ||
|
||
public void Dispose() { | ||
GUI.color = before; | ||
} | ||
} | ||
|
||
public sealed class GUIIndent : IDisposable { | ||
public GUIIndent() { | ||
EditorGUI.indentLevel++; | ||
} | ||
|
||
public GUIIndent(string label) { | ||
EditorGUILayout.LabelField(label); | ||
EditorGUI.indentLevel++; | ||
} | ||
|
||
public void Dispose() { | ||
EditorGUI.indentLevel--; | ||
EditorGUILayout.Separator(); | ||
} | ||
} | ||
|
||
public struct GUIEnabled : IDisposable { | ||
private readonly bool before; | ||
|
||
public GUIEnabled(bool enabled) { | ||
before = GUI.enabled; | ||
GUI.enabled = before && enabled; | ||
} | ||
|
||
public void Dispose() { | ||
GUI.enabled = before; | ||
} | ||
} | ||
|
||
public sealed class GUIFade : IDisposable { | ||
private AnimBool anim; | ||
|
||
public bool Visible { get; private set; } | ||
|
||
public GUIFade() { | ||
Visible = true; | ||
} | ||
|
||
public void SetTarget(bool target) { | ||
if (anim == null) { | ||
anim = new AnimBool(target); | ||
anim.valueChanged.AddListener(() => { | ||
if (EditorWindow.focusedWindow) | ||
EditorWindow.focusedWindow.Repaint(); | ||
}); | ||
} | ||
|
||
anim.target = target; | ||
Visible = EditorGUILayout.BeginFadeGroup(anim.faded); | ||
} | ||
|
||
public void Dispose() { | ||
EditorGUILayout.EndFadeGroup(); | ||
} | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "EnhancedHierarchyEditor", | ||
"references": [], | ||
"optionalUnityReferences": [], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [] | ||
} |
7 changes: 7 additions & 0 deletions
7
Assets/Enhanced Hierarchy/Editor/EnhancedHierarchy.asmdef.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.