-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from arimger/develop
Develop - 0.12.12
- Loading branch information
Showing
204 changed files
with
454 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
Assets/Editor Toolbox/Editor/Drawers/Regular/LabelWidthAttributeDrawer.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Assets/Editor Toolbox/Editor/Drawers/Regular/NotPrefabObjectOnlyAttributeDrawer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Toolbox.Editor.Drawers | ||
{ | ||
[CustomPropertyDrawer(typeof(NotPrefabObjectOnlyAttribute))] | ||
public class NotPrefabObjectOnlyAttributeDrawer : ObjectValidationDrawer | ||
{ | ||
protected override string GetWarningMessage() | ||
{ | ||
return "Assigned object can't be a Prefab."; | ||
} | ||
|
||
protected override bool IsObjectValid(Object objectValue, SerializedProperty property) | ||
{ | ||
if (objectValue == null) | ||
{ | ||
return false; | ||
} | ||
|
||
var attribute = Attribute; | ||
if (PrefabUtility.GetPrefabAssetType(objectValue) == PrefabAssetType.NotAPrefab) | ||
{ | ||
return true; | ||
} | ||
|
||
if (PrefabUtility.GetPrefabInstanceStatus(objectValue) == PrefabInstanceStatus.Connected && | ||
attribute.AllowInstancedPrefabs) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
private NotPrefabObjectOnlyAttribute Attribute => attribute as NotPrefabObjectOnlyAttribute; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Editor Toolbox/Editor/Drawers/Regular/NotPrefabObjectOnlyAttributeDrawer.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Assets/Editor Toolbox/Editor/Drawers/Toolbox/Decorator/LabelWidthAttributeDrawer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Toolbox.Editor.Drawers | ||
{ | ||
public class LabelWidthAttributeDrawer : ToolboxDecoratorDrawer<LabelWidthAttribute> | ||
{ | ||
private float widthToRestore; | ||
|
||
protected override void OnGuiBeginSafe(LabelWidthAttribute attribute) | ||
{ | ||
base.OnGuiBeginSafe(attribute); | ||
widthToRestore = EditorGUIUtility.labelWidth; | ||
EditorGUIUtility.labelWidth = attribute.Width; | ||
} | ||
|
||
protected override void OnGuiCloseSafe(LabelWidthAttribute attribute) | ||
{ | ||
EditorGUIUtility.labelWidth = widthToRestore; | ||
base.OnGuiCloseSafe(attribute); | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.