Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Initial addition of all files
  • Loading branch information
Varneon committed Feb 11, 2022
1 parent 6e5b6ff commit a62d255
Show file tree
Hide file tree
Showing 13 changed files with 828 additions and 60 deletions.
71 changes: 11 additions & 60 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,60 +1,11 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties

/*
!/.git
!/.github
!/.gitignore
!/.LICENCE
!/.README.md
!/Assets
/Assets/*
!/Assets/Varneon
/Assets/Varneon/*
!/Assets/Varneon/UdonExplorer
8 changes: 8 additions & 0 deletions Assets/Varneon/UdonExplorer/Editor.meta

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

18 changes: 18 additions & 0 deletions Assets/Varneon/UdonExplorer/Editor/UdonExplorerAssembly.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Varneon.UdonExplorer",
"references": [
"GUID:3c1bc1267eab5884ebe7f232c09ee0d9",
"GUID:627c4d5cd580ddf41bd320e784fe8b9d"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

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

185 changes: 185 additions & 0 deletions Assets/Varneon/UdonExplorer/Editor/UdonExplorerWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@

using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;

namespace Varneon.UdonExplorer
{
internal class UdonExplorerWindow : EditorWindow
{
internal UdonListView.UdonBehaviourInfo SelectedItem;

private static UdonListView listView;
private Vector2 scrollPos;
private float currentScrollViewWidth;
private bool resize = false;
private Rect cursorChangeRect;
private Vector2 lastWindowSize;
private bool useAutoRefresh = true;
private bool hasLatestInfo = true;
private bool
showPublicVariables,
showExportedSymbols,
showSymbols;

[MenuItem("Varneon/Udon Explorer")]
public static void Init()
{
EditorWindow window = GetWindow<UdonExplorerWindow>("Udon Explorer", true);
window.minSize = new Vector2(1024, 512);
window.titleContent.image = Resources.Load<Texture>("Icon_UdonExplorer");
window.Show();
}

private void OnEnable()
{
currentScrollViewWidth = position.width - 300;

cursorChangeRect = new Rect(currentScrollViewWidth, 0, 3, position.height + 48);

listView = new UdonListView(new TreeViewState(), UdonListView.Header())
{
Explorer = this
};

listView.Refresh();
}

private void OnFocus()
{
if (hasLatestInfo || !useAutoRefresh) { return; }

listView.CheckForChangesInScene();

hasLatestInfo = true;
}

private void OnLostFocus()
{
hasLatestInfo = false;
}

private void OnGUI()
{
using (new GUILayout.HorizontalScope())
{
Rect controlRect = EditorGUILayout.GetControlRect(
GUILayout.ExpandHeight(true),
GUILayout.ExpandWidth(true));

listView?.OnGUI(controlRect);

DetectResizedWindow();

AdjustSplitView();

using (new GUILayout.VerticalScope(GUILayout.Width(position.width - currentScrollViewWidth - 2)))
{
using (new GUILayout.HorizontalScope(EditorStyles.helpBox))
{
useAutoRefresh = GUILayout.Toggle(useAutoRefresh, "Refresh On Focus");

if (GUILayout.Button("Refresh", GUILayout.Width(60)))
{
listView.CheckForChangesInScene();

hasLatestInfo = true;
}
}

scrollPos = GUILayout.BeginScrollView(scrollPos);

GUILayout.Label("Udon Behaviour:");
using (new EditorGUI.DisabledGroupScope(true))
{
GUILayout.TextArea(SelectedItem?.BehaviourName);
}

GUILayout.Space(20);

GUILayout.Label("Program Source Type:");
using (new EditorGUI.DisabledGroupScope(true))
{
GUILayout.TextArea(SelectedItem?.UdonProgramSourceType);
}

GUILayout.Space(20);

if (showPublicVariables = EditorGUILayout.Foldout(showPublicVariables, "Public Variables"))
{
using (new EditorGUI.DisabledGroupScope(true))
{
GUILayout.TextArea(SelectedItem?.PublicVariablesList);
}
}

GUILayout.Space(20);

if (showExportedSymbols = EditorGUILayout.Foldout(showExportedSymbols, "Exported Symbols"))
{
using (new EditorGUI.DisabledGroupScope(true))
{
GUILayout.TextArea(SelectedItem?.UdonProgramExportedSymbolList);
}
}

GUILayout.Space(20);

if (showSymbols = EditorGUILayout.Foldout(showSymbols, "Symbols"))
{
using (new EditorGUI.DisabledGroupScope(true))
{
GUILayout.TextArea(SelectedItem?.UdonProgramSymbolList);
}
}

GUILayout.EndScrollView();
}
}
}

private void AdjustSplitView()
{
GUI.Box(cursorChangeRect, GUIContent.none);
EditorGUIUtility.AddCursorRect(cursorChangeRect, MouseCursor.ResizeHorizontal);

if (resize)
{
ResizeSplitView(true);

if (Event.current.type == EventType.MouseUp)
{
resize = false;
}
}
else if (Event.current.isMouse && Event.current.type == EventType.MouseDown && cursorChangeRect.Contains(Event.current.mousePosition))
{
resize = true;
}
}

private void ResizeSplitView(bool fromMouse = false)
{
if (fromMouse)
{
currentScrollViewWidth = Event.current.mousePosition.x;
}

currentScrollViewWidth = Mathf.Clamp(currentScrollViewWidth, position.width - 400, position.width - 200);

cursorChangeRect.Set(currentScrollViewWidth, cursorChangeRect.y, cursorChangeRect.width, position.height + 48);

Repaint();
}

private void DetectResizedWindow()
{
if (lastWindowSize != position.size)
{
ResizeSplitView();

lastWindowSize = position.size;
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/Varneon/UdonExplorer/Editor/UdonExplorerWindow.cs.meta

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

Loading

0 comments on commit a62d255

Please sign in to comment.