Skip to content

Commit 3dbdf26

Browse files
committed
🎂 0.7.0
+ NEW: Inspect from SkinnedMeshRenderer + NEW: Vertex to Indice inspection (was incomplete) + NEW: Debug Surface option (only works for MeshFilter at this point) + Fix error for meshes that don't have either Normal or Tangent + Improved Debugging Performance (far less GC overhead) + Fix GUI Label Color when using Dark (Pro) skin
1 parent 4f60d37 commit 3dbdf26

File tree

6 files changed

+42
-31
lines changed

6 files changed

+42
-31
lines changed

Assets/Plugins/MeshDebugger/Editor/MeshDebugger.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ void OnSelectionChange()
162162
{
163163
m_Mesh = m4.mesh;
164164
m_hasUpdated = false;
165+
Repaint();
165166
};
166167
}
167168
else if (m3 && m3.sharedMesh)
@@ -347,12 +348,15 @@ private void DrawGUILabels()
347348
break;
348349
case DebugTriangle.Area:
349350
EachIndice((i, j, vert) =>
350-
DrawLabel(vert, m_cpu.m_IndiceNormals[i][j], m_cpu.m_IndiceAreas[i][j].ToString("0.0"))
351+
{
352+
var area = m_cpu.m_IndiceAreas[i][j];
353+
DrawLabel(vert, m_cpu.m_IndiceNormals[i][j], area.ToString(area < 1 ? "0.00" : "0.0"));
354+
}
351355
);
352356
break;
353357
case DebugTriangle.Submesh:
354358
EachIndice((i, j, vert) =>
355-
DrawLabel(vert, m_cpu.m_IndiceNormals[i][j], i.ToString("0.0"))
359+
DrawLabel(vert, m_cpu.m_IndiceNormals[i][j], i)
356360
);
357361
break;
358362
}

Assets/Plugins/MeshDebugger/Editor/MeshDebugger_GUI.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void OnGUI()
6262
m_Mesh = (Mesh)EditorGUILayout.ObjectField(m_Mesh, typeof(Mesh), true);
6363
EditorGUILayout.EndHorizontal();
6464
}
65+
EditorGUI.BeginDisabledGroup(!m_Mesh || !m_Transform);
6566
{
6667
EditorGUILayout.BeginHorizontal();
6768
EditorGUILayout.PrefixLabel(UI.Configuration);
@@ -163,6 +164,7 @@ void OnGUI()
163164
if (!m_UseHeatmap && (m_DebugVert != DebugVertice.None || m_DebugTris != DebugTriangle.None) && !IsSafeToDrawGUI())
164165
EditorGUILayout.HelpBox("Verts / Triangle count are too large to be displayed with GUI index rendering.\nConsider set smaller section or enable Heatmap instead.", MessageType.Warning);
165166
}
167+
EditorGUI.EndDisabledGroup();
166168
if (EditorGUI.EndChangeCheck())
167169
{
168170
m_hasUpdated = false;

Assets/Plugins/MeshDebugger/MeshDebuggerProxyUI.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ protected override void OnEnable()
1717
{
1818
mesh = new Mesh();
1919
mesh.hideFlags = HideFlags.HideAndDontSave;
20+
mesh.name = gameObject.name + " (Snapshot)";
2021
}
2122
base.OnEnable();
2223
}
@@ -32,9 +33,7 @@ protected override void OnDestroy()
3233

3334
public override void ModifyMesh(VertexHelper vh)
3435
{
35-
mesh.Clear();
3636
vh.FillMesh(mesh);
37-
3837
if (callback != null) callback();
3938
}
4039
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Thanks for using my plugin!
22

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

INSTRUCTIONS.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# Manual (v0.6)
2-
3-
![The Window](Screenshots/Window.png)
1+
# Manual (v0.7.x)
42

53
After importing the plugin to your project, you can open Mesh Debugger window to start inspecting any selected object.
64

75
![Window Location](Screenshots/PopTheWindow.png)
86

97
## Selecting Object to Inspect
108

11-
The first row shows which object and mesh that currently being inspected. It'll be automatically changed to active (selected) object in the scene, then looking for a Mesh containing in either `MeshFilter` (3D) or `Graphic` (UI).
9+
![The Window](Screenshots/Window.png)
10+
11+
The first row shows which object and mesh that currently being inspected. It will be automatically updated to active (selected) object in the scene, then looking for a Mesh containing in either `MeshFilter` (3D), `SkinnedMeshRenderer` (as Static Snapshot) or `Graphic` (UI).
1212

1313
> Until this version you can't lock the selected mesh and there's no plan for supporting multiple inspection in the same time.
1414
1515
## Configurations
1616

17-
+ `Static`: Turn this on if currently inspected mesh won't change.
17+
+ `Static`: Turn this on if currently inspected mesh won't change over time.
1818
+ `Depth Culling`: Reduce complexity by enable Z-Depth on visual cues.
19-
+ `Equalize`: Keep visual cues scales in Screen Space (no matter the distance).
20-
+ `Partial Debug`: Only inspect vertex/triangle at given fraction.
19+
+ `Equalize`: Keep visual cues scale equally in Screen Space (requires `Static` turned off).
20+
+ `Partial Debug`: Only inspect vertex/triangle at selected fraction.
2121

2222
## Rays
2323

@@ -27,26 +27,33 @@ For displaying vector values like normal direction:
2727

2828
+ `Ray Size`: Size of the ray.
2929
+ `Vertex Rays`: Show Normal/Tangent/Bitangent of each vertex.
30-
+ `Additional Rays`: Show Vertex to Triangle or Normal direction of each triange.
31-
32-
> Vertex to Triangle generates line between each vertex to triangle median. Not a finished feature.
30+
+ `Additional Rays`: Show Vertex to Triangle ray and Normal direction of each Triangle.
3331

3432
## Heatmap
3533

36-
![Maps](Screenshots/Maps.png)
34+
Heatmap is used displaying scalar values like vertex index.
3735

38-
For displaying scalar values like vertex index:
36+
![Maps](Screenshots/Maps.png)
3937

40-
+ `Use Heatmap`: Show display scalar as number (image on left) or color indicator (image on right)?
41-
+ `Debug Vertices`: Shows:
38+
+ `Use Heatmap`: Display scalar value as number (image on left) or color indicator (image on right).
39+
+ `Debug Vertices` Displays:
4240
- `Index`: Index of each vertex
43-
- `Shared`: How many triangles reference that vertex (also useful for detecting orphaned vertices)
41+
- `Shared`: How many triangles reference that vertex (useful for detecting orphaned vertices)
4442
- `Duplicated`: How many vertices have the same position
45-
+ `Debug Triangles`: Shows:
43+
+ `Debug Triangles` Displays:
4644
- `Index`: Index of each triangle
4745
- `Area`: Calculated area surface of each triangle
4846
- `Submesh`: Submesh index of each triangle
47+
+ `Debug Surface` Modifies object material temporarily to displays:
48+
- `Facing`: Triangle facing (useful for detecting flipped normals)
49+
- `Color`: Viewing Color Channel
50+
- `UV`: Viewing selected UV Channel (red-green for X,Y vector)
51+
- `Tangents`: Viewing selected Tangent vector in Color
52+
53+
\* `Debug Surface` Only supports mesh from `MeshFilter` at this point.
4954

5055
## Mesh Features Info
5156

52-
This tool also shows some statistics about the inspected mesh including vertices, indices, vertex channels, etc. We also open to discuss about what's info else should be included here.
57+
In near bottom in the Window there are read-only statistics about the inspected mesh including vertex count, indices, vertex channels, and many more.
58+
59+
We also open to discuss about what's info else should be included here.

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
# MeshDebugger v0.6
1+
# MeshDebugger v0.7
22

33
![Screenshot](Screenshots/Demo.png)
44

5-
This is an editor tool to visually inspect a mesh. Very helpful if you want to debug your procedural mesh.
5+
MeshDebugger is an editor tool to visually inspect a mesh. Very helpful if you want to debug your procedurally generated mesh or inspecting ideal parts of your model.
66

77
## Download + Manual
88

99
**Download the plugin via [Releases](/willnode/meshdebugger/releases) or [Asset Store](//u3d.as/Qsd)**.
1010

11-
Also see **[Usage Instruction](INSTRUCTIONS.md)**.
11+
See **[Usage Instruction Here](INSTRUCTIONS.md)**.
1212

1313
## Features
1414

1515
+ Super simple (Just open the window and select a GameObject)
16-
+ Dynamic update everytime scene repaint (can be turned off for speed too)
17-
+ Depth Culling (Reduces visual complexity)
16+
+ Dynamic update everytime scene repaint (can be turned off for speed)
17+
+ Depth Culling (Reduces visual complexity) and/or only Inspect by fraction part.
1818
+ Inspect static mesh with over 65K vertices without lag (and yes, it don't have to be Unity 2017.3 to use it)
19-
+ Many visual choices: Rays (eg. normal/tangent vertices), Heatmap (eg. triangle density) or Numbered GUI (eg. triangle/vert index)
20-
+ Inspect uGUI (Unity UI) normally.
21-
+ Also includes [shaders for visual debugging](Assets/Plugins/MeshDebugger/Shaders)
19+
+ Many visual choices: Rays (normal/tangent/bitangent), Heatmap or Numbered GUI (triangle/vert index and other properties), Surface Shading (triangle facing, vertex uv and color), etc.
20+
+ Support uGUI (Unity UI) and SkinnedMeshRenderer with no additional setup.
2221

2322
## Technology
2423

@@ -32,7 +31,7 @@ MeshDebugger does this in simple order:
3231

3332
Because MeshDebugger don't use `Gizmos` or `Handles`, it's possible to bring inspection into runtime build, although it still need several modification because this is editor-oriented tool.
3433

35-
If enough people interested I can make separate repo for `IMGizmos` which makes this Immediate Drawing wonderfully simpler and fast.
34+
If enough people interested I can make separate repo for [IMGizmos](Assets\Plugins\MeshDebugger\Editor\IMGizmos.cs) which makes this Immediate Drawing wonderfully simpler and fast.
3635

3736
## License
3837

0 commit comments

Comments
 (0)