1.8.0: Added AssetsOnly, SceneObjectsOnly, AssignAssetIfNull, AssignComponentIfNull
- Attributes: Added AssetsOnly, SceneObjectsOnly, AssignAssetIfNull, AssignComponentIfNull - Attributes: Replaced AssignIfNull with AssignComponentIfNull
This commit is contained in:
parent
070b82767f
commit
eb19150d98
23 changed files with 302 additions and 73 deletions
|
|
@ -6,5 +6,11 @@ namespace Module.Inspector
|
|||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class ShowHiddenFieldAttribute : PropertyAttribute
|
||||
{
|
||||
public readonly bool editable;
|
||||
|
||||
public ShowHiddenFieldAttribute(bool editable = false)
|
||||
{
|
||||
this.editable = editable;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Runtime/ValueModifiers/AssetsOnlyAttribute.cs
Normal file
14
Runtime/ValueModifiers/AssetsOnlyAttribute.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace Module.Inspector
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class AssetsOnlyAttribute : ValueModifierPropertyAttribute
|
||||
{
|
||||
[Preserve]
|
||||
public AssetsOnlyAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/ValueModifiers/AssetsOnlyAttribute.cs.meta
Normal file
3
Runtime/ValueModifiers/AssetsOnlyAttribute.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dd2c5463415149c39cafdfb013ffd252
|
||||
timeCreated: 1660247975
|
||||
39
Runtime/ValueModifiers/AssignAssetIfNullAttribute.cs
Normal file
39
Runtime/ValueModifiers/AssignAssetIfNullAttribute.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
|
||||
namespace Module.Inspector
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class AssignAssetIfNullAttribute : ValueModifierPropertyAttribute
|
||||
{
|
||||
public readonly bool useType;
|
||||
public readonly Type type;
|
||||
public readonly string filter;
|
||||
public readonly string[] searchFolders;
|
||||
|
||||
public AssignAssetIfNullAttribute(string[] searchFolders = null)
|
||||
{
|
||||
this.searchFolders = searchFolders;
|
||||
}
|
||||
|
||||
public AssignAssetIfNullAttribute(string filter, string[] searchFolders = null)
|
||||
{
|
||||
this.filter = filter;
|
||||
this.searchFolders = searchFolders;
|
||||
}
|
||||
|
||||
public AssignAssetIfNullAttribute(Type type, string[] searchFolders = null)
|
||||
{
|
||||
this.type = type;
|
||||
this.searchFolders = searchFolders;
|
||||
useType = true;
|
||||
}
|
||||
|
||||
public AssignAssetIfNullAttribute(Type type, string filter, string[] searchFolders = null)
|
||||
{
|
||||
this.type = type;
|
||||
this.filter = filter;
|
||||
this.searchFolders = searchFolders;
|
||||
useType = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 82c31267a89846069809fd3085f7026e
|
||||
timeCreated: 1661366494
|
||||
|
|
@ -3,30 +3,19 @@ using System;
|
|||
namespace Module.Inspector
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class AssignIfNullAttribute : ValueModifierPropertyAttribute
|
||||
public sealed class AssignComponentIfNullAttribute : ValueModifierPropertyAttribute
|
||||
{
|
||||
public readonly bool includeChildren;
|
||||
public readonly bool useType;
|
||||
public readonly Type type;
|
||||
public readonly bool includeChildren;
|
||||
|
||||
public AssignIfNullAttribute()
|
||||
public AssignComponentIfNullAttribute(bool includeChildren = false)
|
||||
{
|
||||
useType = false;
|
||||
}
|
||||
|
||||
public AssignIfNullAttribute(bool includeChildren)
|
||||
{
|
||||
useType = false;
|
||||
this.includeChildren = includeChildren;
|
||||
useType = false;
|
||||
}
|
||||
|
||||
public AssignIfNullAttribute(Type type)
|
||||
{
|
||||
this.type = type;
|
||||
useType = true;
|
||||
}
|
||||
|
||||
public AssignIfNullAttribute(Type type, bool includeChildren)
|
||||
|
||||
public AssignComponentIfNullAttribute(Type type, bool includeChildren = false)
|
||||
{
|
||||
this.type = type;
|
||||
this.includeChildren = includeChildren;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 50df169977e042c4bfb5dcf29b06c86c
|
||||
timeCreated: 1661598908
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dfd8ecaea012b084f994832dd519d850
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
14
Runtime/ValueModifiers/SceneObjectsOnlyAttribute.cs
Normal file
14
Runtime/ValueModifiers/SceneObjectsOnlyAttribute.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
namespace Module.Inspector
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class SceneObjectsOnlyAttribute : ValueModifierPropertyAttribute
|
||||
{
|
||||
[Preserve]
|
||||
public SceneObjectsOnlyAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Runtime/ValueModifiers/SceneObjectsOnlyAttribute.cs.meta
Normal file
3
Runtime/ValueModifiers/SceneObjectsOnlyAttribute.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a5113fd42950401b823cee1be6f3450b
|
||||
timeCreated: 1660250588
|
||||
Loading…
Add table
Add a link
Reference in a new issue