27
2013
Editor Mesh Helper Gizmos
Started making a mesh helper editor script. Should be useful to see the mesh details easily..
Current features:
– Display selected object details (DrawGizmo)
– Draw green boxes on vertex locations (Handles.DotCap)
– Display vertex number and UV info (Handles.Label)
– Label position is affected by the normals (so that overlapping vertice labes go bit different directions)
– Draw triangles with blue lines (Handles.DrawPolyLine)
– Line positions are multiplied by 1.005f, so that the default wireframe doesnt block them..
– Display face normals (numbers and visual line)
– Hide back facing details (if wanted), works kind of.. (Access to editor camera position/rotation/etc: Camera.current , not sure if there is other ways..)
– Use CustomEditor, instead of trying to modify every selected object (see image#4)
– Snap to closest vertices (using kdree): Works, but positions in the tree are not yet updated after modifying vertices.. maybe it wouldnt need kdree at all.
– Vertex position editor : first version works, just need to add mesh update while dragging the vertices
TODO:
– Draw handles with vertex colors (if exists)
– Vertex color editor
– Total vertex count
– Different color/style for the label texts
– Pivot position editor
– Show original mesh outlines
– Undo functionality (i guess its done with this: Undo.SetSnapshotTarget)
– UV value editor
– normal value editor
– Flip normals tool
– Export Tools: Export as script (like mMesh)
– Save modified mesh
– Button to “Reset mesh to original”
– Show vertex distance from startpoint when dragging
– Show vertex position (local and world) when dragging
– Flip / Mirror, flips all mesh vertices
– Maybe later: Removing / adding vertices?
– Maybe later: Optimize mesh? Smoothen/relax vertices?
– DX11 stuff?
–
SNIPPETS:
// calculate triangle centroid (center of 3 points) // http://math.tutorvista.com/geometry/centroid.html Vector3 centroid = (vertexpos1+vertexpos2+vertexpos3)/3; // get mouse world position (without raycasting), inside void OnSceneGUI().. //huh that took couple hours to get it working..unity docs ><, althought it doesnt work in most cases still.. Ray r = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); Vector3 worldPos = r.GetPoint(Vector3.Distance(r.origin,targetObj.position));
—
Image#2: Back facing labels are hidden (kind of)
—
Image#3: Explosion.. Some problems with Handles.PositionHandle and moving vertices.. Oh no, broke the default “cube” mesh completely, how to reset it? (*Restarting unity fixed it)
—
Image#4: Default transform compoment from the inspector went broke also.. local rotation is displayed like this:
*Solved: I had this code: [CustomEditor(typeof(Transform))], replaced it with: [CustomEditor(typeof(MyScriptNameHere))]
Related Posts
3 Comments + Add Comment
Leave a comment
Recent posts
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
Recent Comments
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- ffmpeg stream raw video into Unity Texture2D on
Well, now there is this:
GameDraw FREE Edition – Create and modify assets in Unity
http://forum.unity3d.com/threads/176137-RELEASED-GameDraw-FREE-Edition-Create-and-modify-assets-in-Unity
and this,
Probuilder free edition,
http://www.probuilder3d.com/try-free-purchase-later/
Pro builder is definitely worth $71.25, Unity’s missing editor, fast and snappy
https://sites.google.com/site/terrymorgan1213/tutorials/pro-builder-unity-3d
Huhu.. seems like only way to get MouseEvents with : EditorWindow, is this undocumented code:
void OnEnable()
{
SceneView.onSceneGUIDelegate += SceneGUI;
}
void SceneGUI(SceneView sceneView)
{
Debug.log(Event.current.mousePosition);
}
http://answers.unity3d.com/questions/489738/get-mouse-events-with-editorwindow.html