This repository has been archived by the owner on Aug 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev
- Loading branch information
Showing
20 changed files
with
159 additions
and
113 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
11 changes: 11 additions & 0 deletions
11
Editor/EditorAddons/CustomEditors/BetterButtonsEditor.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using Better.Attributes.EditorAddons.Drawers.Gizmo; | ||
using Better.Attributes.Runtime.Gizmo; | ||
using Better.EditorTools; | ||
using Better.EditorTools.CustomEditors; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Better.Attributes.EditorAddons.CustomEditors | ||
{ | ||
[BetterEditor(typeof(Object), true, Order = -999)] | ||
public class GizmosEditor : EditorExtension | ||
{ | ||
private HideTransformButtonUtility _hideTransformDrawer; | ||
|
||
public GizmosEditor(Object target, SerializedObject serializedObject) : base(target, serializedObject) | ||
{ | ||
} | ||
|
||
public override void OnDisable() | ||
{ | ||
} | ||
|
||
public override void OnEnable() | ||
{ | ||
var attributeFound = AttributeFound(); | ||
|
||
if (attributeFound) | ||
{ | ||
_hideTransformDrawer = new HideTransformButtonUtility(); | ||
} | ||
} | ||
|
||
private bool AttributeFound() | ||
{ | ||
var iterator = _serializedObject.GetIterator().Copy(); | ||
var attributeFound = false; | ||
while (iterator.Next(true)) | ||
{ | ||
var data = iterator.GetAttributes<GizmoAttribute>(); | ||
if (data == null) | ||
{ | ||
continue; | ||
} | ||
|
||
if (data.Count <= 0) continue; | ||
attributeFound = true; | ||
break; | ||
} | ||
|
||
return attributeFound; | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
if (_hideTransformDrawer != null) | ||
{ | ||
_hideTransformDrawer.DrawHideTransformButton(); | ||
} | ||
} | ||
|
||
public override void OnChanged() | ||
{ | ||
var attributeFound = AttributeFound(); | ||
_hideTransformDrawer = attributeFound ? new HideTransformButtonUtility() : null; | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.