AnimancerGUI Class

Summary

[Editor-Only] Various GUI utilities used throughout Animancer.
Assembly
Animancer.dll
Namespace
Animancer.Editor
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["AnimancerGUI"] class Type type-node

Syntax

public static class AnimancerGUI

Fields

Name Constant Value Summary
DontExpandWidth
UnityEngine.GUILayout.ExpandWidth(System.Boolean) set to false.
static
ErrorFieldColor
The highlight color used for fields showing an error.
static
WarningFieldColor
The highlight color used for fields showing a warning.
static

Properties

Name Value Summary
GuiOffset Vector2
The offset currently applied to the GUI by UnityEngine.GUI.BeginGroup(UnityEngine.Rect).
static
IndentSize float
The number of pixels of indentation for each UnityEditor.EditorGUI.indentLevel increment.
static
LineHeight float
Returns UnityEditor.EditorGUIUtility.singleLineHeight.
static
MiniButtonNoPadding GUIStyle
A more compact UnityEditor.EditorStyles.miniButton with no padding for its content.
static
MiniButtonStyle GUIStyle
A more compact UnityEditor.EditorStyles.miniButton with a fixed size as a tiny box.
static
NoPaddingButtonStyle GUIStyle
Animancer.Editor.AnimancerGUI.MiniButtonStyle with no UnityEngine.GUIStyle.padding.
static
RightLabelStyle GUIStyle
UnityEditor.EditorStyles.label using UnityEngine.TextAnchor.MiddleRight.
static
StandardSpacing float
Returns UnityEditor.EditorGUIUtility.standardVerticalSpacing.
static
TextColor Color
The color of the standard label text.
static
ToggleWidth float
The width of a standard UnityEngine.GUISkin.toggle with no label.
static

Methods

Name Value Summary
BeginTightLabel(string) string
Stores the UnityEditor.EditorGUIUtility.labelWidth and changes it to the exact width of the `label`.
static
BeginTriangles(Color) void
Sets up the rendering details for Animancer.Editor.AnimancerGUI.DrawLineBatched(UnityEngine.Vector2,UnityEngine.Vector2,System.Single).
static
BeginVerticalBox(GUIStyle) void
Begins a vertical layout group using the given style and decreases the UnityEditor.EditorGUIUtility.labelWidth to compensate for the indentation.
static
CalculateHeight(int) float
Calculates the number of vertical pixels required to draw the specified `lineCount` using the Animancer.Editor.AnimancerGUI.LineHeight and Animancer.Editor.AnimancerGUI.StandardSpacing.
static
CalculateLabelWidth(string) float
Calls UnityEngine.GUIStyle.CalcMinMaxWidth(UnityEngine.GUIContent,System.Single@,System.Single@) using UnityEngine.GUISkin.label and returns the max width. The result is cached for efficient reuse.
static
CalculateWidth(GUIStyle, GUIContent) float
[Animancer Extension] Calls UnityEngine.GUIStyle.CalcMinMaxWidth(UnityEngine.GUIContent,System.Single@,System.Single@) and returns the max width.
static
CalculateWidth(GUIStyle, string) float
[Animancer Extension] Calls UnityEngine.GUIStyle.CalcMinMaxWidth(UnityEngine.GUIContent,System.Single@,System.Single@) and returns the max width.
static
CompactMiniButton(GUIContent) bool
Draws a button using UnityEditor.EditorStyles.miniButton and Animancer.Editor.AnimancerGUI.DontExpandWidth.
static
CompactMiniButton(Rect, GUIContent) bool
Draws a button using UnityEditor.EditorStyles.miniButton.
static
Deselect() void
Deselects any selected IMGUI control.
static
DoDropdownObjectFieldGUI<T>(Rect, GUIContent, bool, T) bool
Draws an object reference field with a dropdown button as its label and returns true if clicked.
static
DoHashedFoldoutGUI<T>(Rect, HashSet<T>, T) bool
Draws a foldout which stores its state in a hash set.
static
DoLabelFoldoutFieldGUI(GUIContent, GUIContent, bool) bool
Draws a label field with a foldout.
static
DoLabelFoldoutFieldGUI(string, string, bool) bool
Draws a label field with a foldout.
static
DoObjectFieldGUI<T>(GUIContent, T, bool) T
Draws an object reference field.
static
DoObjectFieldGUI<T>(Rect, GUIContent, T, bool) T
Draws an object reference field.
static
DoObjectFieldGUI<T>(Rect, string, T, bool) T
Draws an object reference field.
static
DoObjectFieldGUI<T>(string, T, bool) T
Draws an object reference field.
static
DoPlayPauseToggle(Rect, bool, GUIStyle, string) bool
Draws a button which toggles between play and pause icons.
static
DoWeightLabel(Rect, float, float) void
Draws a label showing the `weight` aligned to the right side of the `area` and reduces its UnityEngine.Rect.width to remove that label from its area.
static
DrawArrowTriangleBatched(Vector2, Vector2, float, float) void
Draws triangular arrow.
static
DrawLine(Vector2, Vector2, float, Color) void
Draws a line.
static
DrawLineBatched(Vector2, Vector2, float) void
Draws a line.
static
DrawSprite(Rect, Sprite) void
Draws a `sprite` in the given `area`.
static
Encapsulate(Rect, Rect) Rect
Returns a copy of the `rect` expanded to include the `other`.
static
EndTightLabel() void
Reverts UnityEditor.EditorGUIUtility.labelWidth to its previous value.
static
EndTriangles() void
Cleans up the rendering details for Animancer.Editor.AnimancerGUI.DrawLineBatched(UnityEngine.Vector2,UnityEngine.Vector2,System.Single).
static
EndVerticalBox(GUIStyle) void
Ends a layout group started by Animancer.Editor.AnimancerGUI.BeginVerticalBox(UnityEngine.GUIStyle) and restores the UnityEditor.EditorGUIUtility.labelWidth.
static
Expand(Rect, float) Rect
Returns a copy of the `rect` expanded by the specified `amount` (or contracted if negative).
static
Expand(Rect, float, float) Rect
Returns a copy of the `rect` expanded by the specified amounts on each axis (or contracted if negative).
static
GetGUIClipRect() Rect
Returns the UnityEngine.Rect of the current UnityEngine.GUI.BeginClip(UnityEngine.Rect).
static
GetHashColor(int, float, float, float) Color
Returns a colour with its hue based on the `hash`.
static
GetPerpendicular(Vector2) Vector2
Returns a vector perpendicular to the given value with the same magnitude.
static
Grey(float, float) Color
Returns a color with uniform Red, Green, and Blue values.
static
Handle<T>(DragAndDropHandler<T>, IEnumerable, bool, DragAndDropVisualMode) bool
Handles the current event.
static
Handle<T>(DragAndDropHandler<T>, Rect, DragAndDropVisualMode) bool
Handles the current event.
static
IsMiddleClick(Event) bool
Is the `currentEvent` a Middle Click or Alt + Left Click?
static
LayoutRect(float) Rect
UnityEngine.GUILayoutUtility.GetRect(System.Single,System.Single)
static
LayoutRect(float, AnimancerGUI.SpacingMode) Rect
Uses UnityEngine.GUILayoutUtility.GetRect(System.Single,System.Single) to get a UnityEngine.Rect with the specified `height` and the Animancer.Editor.AnimancerGUI.StandardSpacing added according to the specified `spacing`.
static
LayoutRect(float, GUIStyle) Rect
UnityEngine.GUILayoutUtility.GetRect(System.Single,System.Single,UnityEngine.GUIStyle)
static
LayoutSingleLineRect(AnimancerGUI.SpacingMode) Rect
Uses UnityEngine.GUILayoutUtility.GetRect(System.Single,System.Single) to get a UnityEngine.Rect occupying a single standard line with the Animancer.Editor.AnimancerGUI.StandardSpacing added according to the specified `spacing`.
static
NextVerticalArea(Rect) void
If the UnityEngine.Rect.height is positive, this method moves the UnityEngine.Rect.y by that amount and adds the Animancer.Editor.AnimancerGUI.StandardSpacing.
static
RepaintEverything() void
Calls UnityEditorInternal.InternalEditorUtility.RepaintAllViews.
static
ReSelectCurrentObjects() void
Clears the UnityEditor.Selection.objects then returns it to its current state.
static
SetGuiChanged(bool) void
Sets UnityEngine.GUI.changed if `guiChanged` is true.
static
SplitHorizontally(Rect, string, string, float, float, Rect, Rect) void
Divides the given `area` such that the fields associated with both labels will have equal space remaining after the labels themselves.
static
StealFromLeft(Rect, float, float) Rect
Subtracts the `width` from the left side of the `area` and returns a new UnityEngine.Rect occupying the removed section.
static
StealFromRight(Rect, float, float) Rect
Subtracts the `width` from the right side of the `area` and returns a new UnityEngine.Rect occupying the removed section.
static
StealFromTop(Rect, float, float) Rect
Subtracts the `height` from the top side of the `area` and returns a new UnityEngine.Rect occupying the removed section.
static
StealLineFromTop(Rect) Rect
Subtracts the Animancer.Editor.AnimancerGUI.LineHeight from the top side of the `area` and returns a new UnityEngine.Rect occupying the removed section.
static
ToStringCached(int) string
Caches and returns System.Int32.ToString if 0 <= value < 100.
static
TryUseClickEvent(Rect, int, int) bool
Returns true and uses the current event if it is UnityEngine.EventType.MouseUp inside the specified `area`.
static
TryUseClickEventInLastRect(int) bool
Returns true and uses the current event if it is UnityEngine.EventType.MouseUp inside the last GUI Layout UnityEngine.Rect that was drawn.
static
TryUseHotControl(Event, int, bool) bool
Uses the `currentEvent` and sets UnityEngine.GUI.changed if the `controlID` matches the UnityEngine.GUIUtility.hotControl.
static
TryUseKey(Event, int, KeyCode) bool
Uses the `currentEvent` if the `controlID` has UnityEngine.GUIUtility.keyboardControl. If a `key` is specified, other keys will be ignored.
static
TryUseMouseDown(Rect, Event, int) bool
Sets the UnityEngine.GUIUtility.hotControl and uses the `currentEvent` if the mouse position is inside the `area`.
static
TryUseMouseUp(Event, int, bool) bool
Releases the UnityEngine.GUIUtility.hotControl and uses the `currentEvent` if it was the active control.
static
Use(Event, int, bool) void
Calls UnityEngine.Event.Use and sets the UnityEngine.GUI.changed and UnityEngine.GUIUtility.hotControl.
static