void Update() { if (Curves.Count == 0) { Close(); return; } if (refreshNow) { previewMeshRenderer.sharedMaterial = Mat; refreshNow = false; Spline2Mesh s2m = new Spline2Mesh(); s2m.Outline = Curves[0]; s2m.VertexLineOnly = (Mode == VERTEXLINE); for (int i = 1; i < Curves.Count; i++) { s2m.Holes.Add(Curves[i]); } s2m.UVOffset = UVOffset; s2m.UVTiling = UVTiling; s2m.UV2 = UV2; s2m.MeshName = MeshName; s2m.SetBounds(true, Vector3.one); Mesh m; s2m.Apply(out m); previewMesh = m; TriangulationMessage = s2m.Error; if (previewMesh) { if (previewMesh.triangles.Length > 0) { title = "Export Curvy Spline (" + previewMeshFilter.sharedMesh.vertexCount + " Vertices, " + previewMeshFilter.sharedMesh.triangles.Length / 3 + " Triangles)"; } else { title = "Export Curvy Spline (" + previewMeshFilter.sharedMesh.vertexCount + " Vertices)"; } } else { title = "Export Curvy Spline"; } SceneView.RepaintAll(); } }
void Update() { if (Curves.Count == 0) { Close(); return; } foreach (var kv in splineTransforms) { var tt = splineTransforms[kv.Key]; if (tt != kv.Key.transform) { tt.FromTransform(kv.Key.transform); refreshNow = true; break; } } if (refreshNow) { previewMeshRenderer.sharedMaterial = Mat; refreshNow = false; Spline2Mesh s2m = new Spline2Mesh(); foreach (var c in Curves) { if (c.Spline != null) { s2m.Lines.Add(c); } } s2m.Winding = Winding; s2m.VertexLineOnly = (Mode == VERTEXLINE); s2m.UVOffset = UVOffset; s2m.UVTiling = UVTiling; s2m.UV2 = UV2; s2m.MeshName = MeshName; s2m.SetBounds(true, Vector3.one); Mesh m; s2m.Apply(out m); previewMesh = m; TriangulationMessage = s2m.Error; string sTitle; if (previewMesh) { if (previewMesh.triangles.Length > 0) { sTitle = "Export (" + previewMeshFilter.sharedMesh.vertexCount + " Vertices, " + previewMeshFilter.sharedMesh.triangles.Length / 3 + " Triangles)"; } else { sTitle = "Export (" + previewMeshFilter.sharedMesh.vertexCount + " Vertices)"; } } else { sTitle = "Export"; } #if UNITY_5_0 || UNITY_4_6 title = sTitle; #else titleContent = new GUIContent(sTitle); #endif SceneView.RepaintAll(); } }