Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 64 additions & 40 deletions Aspid.FastTools/Assets/Aspid/FastTools/CHANGELOG.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Aspid.FastTools.UIElements.Editors
public static class EnumFlagsFieldExtensions
{
/// <summary>
/// Initializes the field with a default enum flags value.
/// Initializes the field with a default enum flags value via <see cref="EnumFlagsField.Init(Enum, bool)"/>.
/// </summary>
/// <param name="element">The element to modify.</param>
/// <param name="defaultValue">The default enum flags value to display.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,30 @@ public static T BindTo<T>(this T element, SerializedObject serializedObject, str
}

/// <summary>
/// Binds the bindable to the specified <see cref="SerializedProperty"/>.
/// Binds the element to the specified <see cref="SerializedProperty"/>.
/// </summary>
/// <param name="element">The bindable to bind.</param>
/// <param name="element">The element to bind.</param>
/// <param name="property">The serialized property to bind to.</param>
/// <returns>The bindable, for chaining.</returns>
/// <returns>The element, for chaining.</returns>
public static T BindPropertyTo<T>(this T element, SerializedProperty property)
where T : IBindable
where T : VisualElement, IBindable
{
element.BindProperty(property);
return element;
}

/// <summary>
/// Sets the binding path of the element.
/// </summary>
/// <typeparam name="T">The element type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The binding path to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetBindingPath<T>(this T element, string value)
where T : VisualElement, IBindable
{
element.bindingPath = value;
return element;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,19 @@ public static T RemoveValueChanged<T>(this T element, EventCallback<SerializedPr
element.UnregisterCallback(value);
return element;
}

/// <summary>
/// Sets the label of the property field.
/// </summary>
/// <typeparam name="T">The element type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : PropertyField
{
element.label = value;
return element;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,18 @@ public static T BindTo<T>(this T element, SerializedObject obj)
element.Bind(obj);
return element;
}

/// <summary>
/// Unbinds the element from its serialized object.
/// </summary>
/// <typeparam name="T">The element type.</typeparam>
/// <param name="element">The element to unbind.</param>
/// <returns>The element, for chaining.</returns>
public static T UnbindFrom<T>(this T element)
where T : VisualElement
{
element.Unbind();
return element;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ public static T SetClickable<T>(this T element, Clickable value)
element.clickable = value;
return element;
}

/// <summary>
/// Sets the click handler of the button by replacing the clickable manipulator.
/// </summary>
/// <typeparam name="T">The element type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="action">The action to invoke on click.</param>
/// <returns>The element, for chaining.</returns>
public static T SetClickable<T>(this T element, Action action)
where T : Button
{
element.clickable = new Clickable(action);
return element;
}

/// <summary>
/// Sets <see cref="Button.iconImage"/> and returns the element for chaining.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using UnityEngine;
using UnityEngine.UIElements;

namespace Aspid.FastTools.UIElements
{
public static partial class BaseFieldExtensionsSetLabelQuaternion
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<Quaternion>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelAnimationCurve
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<AnimationCurve>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelBounds
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<Bounds>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelBoundsInt
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<BoundsInt>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelByte
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<byte>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelChar
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<char>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelColor
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<Color>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelColor32
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<Color32>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelDecimal
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<decimal>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using UnityEngine.UIElements;

// ReSharper disable once CheckNamespace
namespace Aspid.FastTools.UIElements
{
public static class BaseFieldExtensionsSetLabelDouble
{
/// <summary>
/// Sets the label of the field via <see cref="BaseField{TValueType}.label"/>.
/// </summary>
/// <typeparam name="T">The field type.</typeparam>
/// <param name="element">The element to modify.</param>
/// <param name="value">The label text to set.</param>
/// <returns>The element, for chaining.</returns>
public static T SetLabel<T>(this T element, string value)
where T : BaseField<double>
{
element.label = value;
return element;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading