From e81100ed6258acc3cdabfc085801deab3640929f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Matkowski?= Date: Fri, 29 Nov 2024 14:01:05 +0100 Subject: [PATCH] Update samples; update README.md --- .../Editor/ToolboxEditorSettings.cs | 11 ++--- Assets/Editor Toolbox/README.md | 20 +++++++- Assets/Examples/Scenes/SampleScene.unity | 48 +++++++++++++++++++ Assets/Examples/Scripts/SampleBehaviour1.cs | 12 ++--- README.md | 20 +++++++- 5 files changed, 95 insertions(+), 16 deletions(-) diff --git a/Assets/Editor Toolbox/Editor/ToolboxEditorSettings.cs b/Assets/Editor Toolbox/Editor/ToolboxEditorSettings.cs index b53f9b13..7f623c03 100644 --- a/Assets/Editor Toolbox/Editor/ToolboxEditorSettings.cs +++ b/Assets/Editor Toolbox/Editor/ToolboxEditorSettings.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; - using UnityEngine; using UnityEngine.Serialization; @@ -62,9 +61,9 @@ internal interface IToolboxSceneViewSettings [CreateAssetMenu(fileName = "Editor Toolbox Settings", menuName = "Editor Toolbox/Settings")] internal class ToolboxEditorSettings : ScriptableObject, IToolboxGeneralSettings, IToolboxHierarchySettings, IToolboxProjectSettings, IToolboxInspectorSettings, IToolboxSceneViewSettings { - [SerializeField] + [SerializeField, Tooltip("Set to false if you don't want to use Toolbox Hierarchy and related features.")] private bool useToolboxHierarchy = true; - [SerializeField] + [SerializeField, Tooltip("Set to true if you want to display horizontal lines in the Hierarchy Window.")] private bool drawHorizontalLines = true; [SerializeField] private bool showSelectionsCount; @@ -73,7 +72,7 @@ internal class ToolboxEditorSettings : ScriptableObject, IToolboxGeneralSettings [FormerlySerializedAs("rowDataItems")] private List rowDataTypes = Defaults.rowDataTypes; - [SerializeField] + [SerializeField, Tooltip("Set to false if you don't want to use Toolbox Folders and related features.")] private bool useToolboxFolders = true; [SerializeField, Clamp(0.0f, float.MaxValue)] @@ -95,7 +94,7 @@ internal class ToolboxEditorSettings : ScriptableObject, IToolboxGeneralSettings [SerializeField] private KeyCode selectorKey = KeyCode.Tab; - [SerializeField, Tooltip("Set to false if you don't want to use Toolbox attributes and related features.")] + [SerializeField, Tooltip("Set to false if you don't want to use Toolbox Attributes and related features.")] private bool useToolboxDrawers = true; [SerializeField, Tooltip("By default, Inspectors will use the built-in version of the list instead of the Toolbox-based one. " + "Keep in mind that built-in properties don't support Toolbox attributes. \n\n Changing this property will recompile the code.")] @@ -471,7 +470,7 @@ private static class Defaults internal const float smallFolderIconXPaddingDefault = 0.15f; internal const float smallFolderIconYPaddingDefault = 0.15f; - internal readonly static List rowDataTypes = new List() + internal static readonly List rowDataTypes = new List() { HierarchyItemDataType.Icon, HierarchyItemDataType.Toggle, diff --git a/Assets/Editor Toolbox/README.md b/Assets/Editor Toolbox/README.md index ea3d5d43..c5d629df 100644 --- a/Assets/Editor Toolbox/README.md +++ b/Assets/Editor Toolbox/README.md @@ -604,13 +604,29 @@ public GameObject[] largeArray = new GameObject[19]; ![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/scrollableitems.png) -##### Other ToolboxProperty attributes +##### IgnoreParentAttribute + +**IgnoreParent** allows you to hide the parent's label, foldout arrow and remove the standard indentation for nested fields. ```csharp [IgnoreParent] public Quaternion q; ``` +![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/ignoreparent.png) + +##### DynamicRangeAttribute + +```csharp +[DynamicRange(nameof(minValue), nameof(MaxValue))] +public float var1; + +public float minValue; +public float MaxValue => 15.0f; +``` + +##### DynamicMinMaxSliderAttribute + ```csharp [DynamicMinMaxSlider(nameof(minValue), nameof(MaxValue))] public Vector2 vec2; @@ -952,7 +968,7 @@ public void Usage() #### SerializedDirectory -Allows to serialize folders in form of assets and retrieve direct paths in runtime. +Allows to serialize folders in form of assets and retrieve direct paths in Runtime. ```csharp public SerializedDirectory serializeDirectory; diff --git a/Assets/Examples/Scenes/SampleScene.unity b/Assets/Examples/Scenes/SampleScene.unity index 98718f9c..afd0d538 100644 --- a/Assets/Examples/Scenes/SampleScene.unity +++ b/Assets/Examples/Scenes/SampleScene.unity @@ -1301,6 +1301,54 @@ MonoBehaviour: bigNumber: 12345678 currency: 20.41 layer: 5 + animationCurve1: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + animationCurve2: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -1 + value: -1 + inSlope: 2 + outSlope: 2 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 2 + value: 2 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 clampedValue: 6 notNullReference: {fileID: 0} childReference: {fileID: 0} diff --git a/Assets/Examples/Scripts/SampleBehaviour1.cs b/Assets/Examples/Scripts/SampleBehaviour1.cs index 281e0537..2f657de1 100644 --- a/Assets/Examples/Scripts/SampleBehaviour1.cs +++ b/Assets/Examples/Scripts/SampleBehaviour1.cs @@ -101,12 +101,6 @@ public enum FlagExample [Layer] public int layer; - [BeginGroup(Order = -2)] - - [Help("NotNullAttribute, ClampAttribute, SceneObjectOnlyAttribute, ChildObjectOnlyAttribute, PrefabObjectOnlyAttribute " + - "are part of group that will be re-implemented in future as ToolboxValidationAttributes. " + - "Unfortunately, for now, you can't use them together with any other PropertyDrawer.", UnityMessageType.Warning, Order = -1)] - [Label("Animation Curve Settings", skinStyle: SkinStyle.Box)] [AnimationCurveSettings] @@ -114,6 +108,12 @@ public enum FlagExample [AnimationCurveSettings(-1.0f, -1.0f, 2.0f, 2.0f, HexColor = "#360E45")] public AnimationCurve animationCurve2; + [BeginGroup(Order = -2)] + + [Help("NotNullAttribute, ClampAttribute, SceneObjectOnlyAttribute, ChildObjectOnlyAttribute, PrefabObjectOnlyAttribute " + + "are part of group that will be re-implemented in future as ToolboxValidationAttributes. " + + "Unfortunately, for now, you can't use them together with any other PropertyDrawer.", UnityMessageType.Warning, Order = -1)] + [Label("Validation", skinStyle: SkinStyle.Box)] [Clamp(0.0f, 11.2f)] diff --git a/README.md b/README.md index ea3d5d43..c5d629df 100644 --- a/README.md +++ b/README.md @@ -604,13 +604,29 @@ public GameObject[] largeArray = new GameObject[19]; ![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/scrollableitems.png) -##### Other ToolboxProperty attributes +##### IgnoreParentAttribute + +**IgnoreParent** allows you to hide the parent's label, foldout arrow and remove the standard indentation for nested fields. ```csharp [IgnoreParent] public Quaternion q; ``` +![inspector](https://github.com/arimger/Unity-Editor-Toolbox/blob/develop/Docs/ignoreparent.png) + +##### DynamicRangeAttribute + +```csharp +[DynamicRange(nameof(minValue), nameof(MaxValue))] +public float var1; + +public float minValue; +public float MaxValue => 15.0f; +``` + +##### DynamicMinMaxSliderAttribute + ```csharp [DynamicMinMaxSlider(nameof(minValue), nameof(MaxValue))] public Vector2 vec2; @@ -952,7 +968,7 @@ public void Usage() #### SerializedDirectory -Allows to serialize folders in form of assets and retrieve direct paths in runtime. +Allows to serialize folders in form of assets and retrieve direct paths in Runtime. ```csharp public SerializedDirectory serializeDirectory;