void OnSceneViewRender(SceneView sceneView) { if (!plotter) { return; } plotter.InitEditing(); DrawVertices(); DrawTriangles(); }
public override void OnInspectorGUI() { plotter = (HairyPlotter)target; if (!plotter) { return; } if (sceneViewCallback == null) { sceneViewCallback = new SceneView.OnSceneFunc(OnSceneViewRender); } if (!ReferenceEquals(SceneView.onSceneGUIDelegate, sceneViewCallback)) { SceneView.onSceneGUIDelegate = sceneViewCallback; } plotter.InitEditing(); EditorGUILayout.LabelField("Edit Mesh", plotter.EditMesh.name); EditorGUILayout.LabelField("Original Mesh", plotter.OriginalMesh ?? ""); EditorGUILayout.LabelField("Vertex Count", plotter.VertexCount.ToString()); EditorGUILayout.LabelField("Triangle Count", plotter.TriangleCount.ToString()); EditorGUILayout.LabelField("Unused Vertices", plotter.UnusedVerticesCount.ToString()); VertexToolbox(); TriangleToolbox(); VertexSelectionToolbox(); TriangleSelectionToolbox(); UvToolbox(); plotter.UpdateMesh(); if (Event.current.type == EventType.Repaint) { if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.Repaint(); } } }
public override void OnInspectorGUI() { plotter = (HairyPlotter)target; if (!plotter) return; if (sceneViewCallback == null) sceneViewCallback = new SceneView.OnSceneFunc(OnSceneViewRender); if (!ReferenceEquals(SceneView.onSceneGUIDelegate, sceneViewCallback)) SceneView.onSceneGUIDelegate = sceneViewCallback; plotter.InitEditing(); EditorGUILayout.LabelField("Edit Mesh", plotter.EditMesh.name); EditorGUILayout.LabelField("Original Mesh", plotter.OriginalMesh ?? ""); EditorGUILayout.LabelField("Vertex Count", plotter.VertexCount.ToString()); EditorGUILayout.LabelField("Triangle Count", plotter.TriangleCount.ToString()); EditorGUILayout.LabelField("Unused Vertices", plotter.UnusedVerticesCount.ToString()); VertexToolbox(); TriangleToolbox(); VertexSelectionToolbox(); TriangleSelectionToolbox(); UvToolbox(); plotter.UpdateMesh(); if (Event.current.type == EventType.Repaint) { if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.Repaint(); } } }