Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Labrys/Editor/FeatureEditor/FeatureEditorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static FeatureEditorWindow GetInstance()
return instance;
}

[MenuItem("Window/Labrys Feature Editor")]
[MenuItem("Window/Labrys/Feature Editor")]
private static FeatureEditorWindow OpenWindow()
{
FeatureEditorWindow window = GetWindow<FeatureEditorWindow>();
Expand Down
51 changes: 51 additions & 0 deletions Assets/Labrys/Editor/FeatureLibraryInspector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using UnityEngine;
using UnityEditor;
using UnityEditor.AnimatedValues;

namespace Labrys.Editor
{
[CustomEditor(typeof(FeatureLibrary))]
public class FeatureLibraryInspector : UnityEditor.Editor
{
private AnimBool fadeGroupVal = new AnimBool(false);

public void OnEnable()
{
fadeGroupVal.valueChanged.AddListener(Repaint);
}

public override void OnInspectorGUI()
{
serializedObject.UpdateIfRequiredOrScript();
FeatureLibrary library = (FeatureLibrary)serializedObject.targetObject;

EditorGUILayout.SelectableLabel(library.TargetDirectory);

if (GUILayout.Button("Refresh"))
{
Undo.RegisterCompleteObjectUndo(library, "Feature Library Refresh");
library.Refresh();
EditorUtility.SetDirty(library);
}

GUILayout.Space(25);
if (GUILayout.Button(fadeGroupVal.value ? "Hide contents" : "Show contents"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a rule for always using braces? /nitpick

fadeGroupVal.target = !fadeGroupVal.value;
if (EditorGUILayout.BeginFadeGroup(fadeGroupVal.faded))
{
foreach (FeatureLibrary.Entry entry in library)
{
EditorGUILayout.BeginHorizontal();
Debug.Log($"{entry.FaID}: {entry.Name}");
EditorGUILayout.SelectableLabel($"{entry.FaID}: {entry.Name}", GUILayout.Height(20));
if (GUILayout.Button("-->"))
{
ProjectWindowUtil.ShowCreatedAsset(entry.Feature);
}
EditorGUILayout.EndHorizontal();
}
}
EditorGUILayout.EndFadeGroup();
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline at end of file

11 changes: 11 additions & 0 deletions Assets/Labrys/Editor/FeatureLibraryInspector.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 0 additions & 132 deletions Assets/Labrys/FeatureEditor/TestFeature.asset

This file was deleted.

8 changes: 0 additions & 8 deletions Assets/Labrys/FeatureEditor/TestFeature.asset.meta

This file was deleted.

Loading