Update README.md

This commit is contained in:
VladV 2022-07-16 17:46:16 +03:00 committed by GitHub
parent cdddddb597
commit 762468d28d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

175
README.md
View File

@ -17,10 +17,6 @@ _Advanced inspector attributes for Unity_
- [Buttons](#Buttons)
- [Debug](#Debug)
- [Groups](#Groups)
- [Customization](#Customization)
- [Custom Drawers](#Custom-Drawers)
- [Validators](#Validators)
- [Property Processors](#Property-Processors)
- [Integrations](#Integrations)
- [Odin Inspector](#Odin-Inspector)
- [Odin Validator](#Odin-Validator)
@ -35,7 +31,7 @@ After package installation **run the Installer** by double clicking on it.
![TriInspector-Installer](https://user-images.githubusercontent.com/26966368/172212210-3bbcf6ff-cdc3-4c7c-87c6-d27ab83e271c.png)
## Roadmap ![GitHub Repo stars](https://img.shields.io/github/stars/codewriter-packages/Tri-Inspector?style=social)
Each star ★ on the project page brings new features closer. See roadmap and more info [here](https://github.com/codewriter-packages/Tri-Inspector/issues/9).
Each star ★ on the project page brings new features closer. See roadmap and more info [here](https://github.com/codewriter-packages/Tri-Inspector/discussions/30).
## Samples
@ -606,173 +602,6 @@ public class VerticalGroupSample : ScriptableObject
}
```
### Customization
#### Custom Drawers
<details>
<summary>Custom Value Drawer</summary>
```csharp
using TriInspector;
using UnityEditor;
using UnityEngine;
[assembly: RegisterTriValueDrawer(typeof(BoolDrawer), TriDrawerOrder.Fallback)]
public class BoolDrawer : TriValueDrawer<bool>
{
public override float GetHeight(float width, TriValue<bool> propertyValue, TriElement next)
{
return EditorGUIUtility.singleLineHeight;
}
public override void OnGUI(Rect position, TriValue<bool> propertyValue, TriElement next)
{
var value = propertyValue.Value;
EditorGUI.BeginChangeCheck();
value = EditorGUI.Toggle(position, propertyValue.Property.DisplayNameContent, value);
if (EditorGUI.EndChangeCheck())
{
propertyValue.Value = value;
}
}
}
```
</details>
<details>
<summary>Custom Attribute Drawer</summary>
```csharp
using TriInspector;
using UnityEditor;
using UnityEngine;
[assembly: RegisterTriAttributeDrawer(typeof(LabelWidthDrawer), TriDrawerOrder.Decorator)]
public class LabelWidthDrawer : TriAttributeDrawer<LabelWidthAttribute>
{
public override void OnGUI(Rect position, TriProperty property, TriElement next)
{
var oldLabelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = Attribute.Width;
next.OnGUI(position);
EditorGUIUtility.labelWidth = oldLabelWidth;
}
}
```
</details>
<details>
<summary>Custom Group Drawer</summary>
```csharp
using TriInspector;
using TriInspector.Elements;
[assembly: RegisterTriGroupDrawer(typeof(TriBoxGroupDrawer))]
public class TriBoxGroupDrawer : TriGroupDrawer<DeclareBoxGroupAttribute>
{
public override TriPropertyCollectionBaseElement CreateElement(DeclareBoxGroupAttribute attribute)
{
// ...
}
}
```
</details>
#### Validators
<details>
<summary>Custom Value Validator</summary>
```csharp
using TriInspector;
[assembly: RegisterTriValueValidator(typeof(MissingReferenceValidator<>))]
public class MissingReferenceValidator<T> : TriValueValidator<T>
where T : UnityEngine.Object
{
public override TriValidationResult Validate(TriValue<T> propertyValue)
{
// ...
}
}
```
</details>
<details>
<summary>Custom Attribute Validators</summary>
```csharp
using TriInspector;
[assembly: RegisterTriAttributeValidator(typeof(RequiredValidator), ApplyOnArrayElement = true)]
public class RequiredValidator : TriAttributeValidator<RequiredAttribute>
{
public override TriValidationResult Validate(TriProperty property)
{
// ...
}
}
```
</details>
#### Property Processors
<details>
<summary>Custom Property Hide Processor</summary>
```csharp
using TriInspector;
using UnityEngine;
[assembly: RegisterTriPropertyHideProcessor(typeof(HideInPlayModeProcessor))]
public class HideInPlayModeProcessor : TriPropertyHideProcessor<HideInPlayModeAttribute>
{
public override bool IsHidden(TriProperty property)
{
return Application.isPlaying;
}
}
```
</details>
<details>
<summary>Custom Property Disable Processor</summary>
```csharp
using TriInspector;
using UnityEngine;
[assembly: RegisterTriPropertyDisableProcessor(typeof(DisableInPlayModeProcessor))]
public class DisableInPlayModeProcessor : TriPropertyDisableProcessor<DisableInPlayModeAttribute>
{
public override bool IsDisabled(TriProperty property)
{
return Application.isPlaying;
}
}
```
</details>
## Integrations
### Odin Inspector
@ -797,4 +626,4 @@ in the Odin Validator window.
## License
Tri-Inspector is [MIT licensed](./LICENSE.md).
Tri-Inspector is [MIT licensed](./LICENSE.md).