Skip to content

Commit

Permalink
0.6.1
Browse files Browse the repository at this point in the history
Change yellow -> cyan for vertex to indice
Add custom menu to open help
Make readme clear (was rejected in asset store 🙁)
  • Loading branch information
willnode committed Feb 24, 2018
1 parent 5b2ae17 commit 06442c3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
34 changes: 24 additions & 10 deletions Assets/Plugins/MeshDebugger/Editor/MeshDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using UnityEngine.UI;

[ExecuteInEditMode]
public partial class MeshDebugger : EditorWindow
public partial class MeshDebugger : EditorWindow, IHasCustomMenu
{
public Mesh m_Mesh;
public Transform m_Transform;
Expand Down Expand Up @@ -107,11 +107,24 @@ void OnSelectionChange()
Repaint();
}

[ContextMenu("Show Help")]
void ShowHelp()
{
Application.OpenURL("https://github.com/willnode/MeshDebugger/blob/master/INSTRUCTIONS.md");
}


public virtual void AddItemsToMenu(GenericMenu menu)
{
GUIContent content = new GUIContent("Show Help");
menu.AddItem(content, false, this.ShowHelp);
}

void OnSceneGUI(SceneView view)
{
if (Event.current.type != EventType.Repaint)
return;

if (!m_Mesh || !m_Mesh.isReadable)
{
if (m_Gizmo != null)
Expand Down Expand Up @@ -140,7 +153,7 @@ void OnSceneGUI(SceneView view)

if (m_DebugNormalVerts || m_DebugTangentVerts || m_DebugBinormalVerts || m_DebugVertsToIndice)
{
Color blue = Color.blue, green = Color.green, red = Color.red, yellow = Color.yellow;
Color blue = Color.blue, green = Color.green, red = Color.red, cyan = Color.cyan;
EachVert((i, vert) =>
{
if (m_DebugNormalVerts)
Expand All @@ -150,15 +163,16 @@ void OnSceneGUI(SceneView view)
if (m_DebugBinormalVerts)
m_Gizmo.AddRay(vert, m_cpu.m_Normals[2][i] * m_RaySize, red);
if (m_DebugVertsToIndice)
m_Gizmo.AddLine(vert, vert + m_cpu.m_VertToIndicesDir[i], yellow);
m_Gizmo.AddLine(vert, vert + m_cpu.m_VertToIndicesDir[i], cyan);
});
}

if (m_DebugTrisNormal)
{
var color = Color.yellow;
var norms = m_cpu.m_IndiceNormals;
EachIndice((i, j, median) =>
m_Gizmo.AddRay(median, norms[i][j] * m_RaySize, Color.yellow)
m_Gizmo.AddRay(median, norms[i][j] * m_RaySize, color)
);
}

Expand Down Expand Up @@ -221,14 +235,14 @@ void OnSceneGUI(SceneView view)
m_hasUpdated = true;
}

private bool IsSafeToDrawGUI ()
private bool IsSafeToDrawGUI()
{
return ((m_DebugTris == DebugTriangle.None ? 0 : m_cpu.m_IndiceCountNormalized) +
(m_DebugVert == DebugVertice.None ? 0 : m_cpu.m_VertCount)) *
return ((m_DebugTris == DebugTriangle.None ? 0 : m_cpu.m_IndiceCountNormalized) +
(m_DebugVert == DebugVertice.None ? 0 : m_cpu.m_VertCount)) *
(m_PartialDebug ? (m_PartialDebugEnd - m_PartialDebugStart) : 1) < 2500;
}

private void DrawGUILabels ()
private void DrawGUILabels()
{
Handles.matrix = m_matrix = m_Transform.localToWorldMatrix;
Handles.BeginGUI();
Expand Down Expand Up @@ -351,4 +365,4 @@ static Styles()
}


}
}
6 changes: 4 additions & 2 deletions Assets/Plugins/MeshDebugger/Readme.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MeshDebugger - 0.6 - MIT - https://github.com/willnode/MeshDebugger
Thanks for using my plugin!

To begin inspecting mesh, just navigate to Window -> Mesh Debugger in menu bar.
MeshDebugger - 0.6.1 - Shared with ❤ - © Wildan Mubarok 2018 under MIT License.
See https://github.com/willnode/MeshDebugger/blob/master/INSTRUCTIONS.md
for instructions about using this plugin.

0 comments on commit 06442c3

Please sign in to comment.