Skip to content

Commit

Permalink
Update samples; update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
arimger committed Nov 29, 2024
1 parent d473b98 commit e81100e
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 16 deletions.
11 changes: 5 additions & 6 deletions Assets/Editor Toolbox/Editor/ToolboxEditorSettings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;

using UnityEngine;
using UnityEngine.Serialization;

Expand Down Expand Up @@ -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;
Expand All @@ -73,7 +72,7 @@ internal class ToolboxEditorSettings : ScriptableObject, IToolboxGeneralSettings
[FormerlySerializedAs("rowDataItems")]
private List<HierarchyItemDataType> 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)]
Expand All @@ -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.")]
Expand Down Expand Up @@ -471,7 +470,7 @@ private static class Defaults
internal const float smallFolderIconXPaddingDefault = 0.15f;
internal const float smallFolderIconYPaddingDefault = 0.15f;

internal readonly static List<HierarchyItemDataType> rowDataTypes = new List<HierarchyItemDataType>()
internal static readonly List<HierarchyItemDataType> rowDataTypes = new List<HierarchyItemDataType>()
{
HierarchyItemDataType.Icon,
HierarchyItemDataType.Toggle,
Expand Down
20 changes: 18 additions & 2 deletions Assets/Editor Toolbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
48 changes: 48 additions & 0 deletions Assets/Examples/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
12 changes: 6 additions & 6 deletions Assets/Examples/Scripts/SampleBehaviour1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ 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]
public AnimationCurve animationCurve1;
[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)]
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e81100e

Please sign in to comment.