/// <summary> /// Draw scene gizmos. Base implementation draws the brush preview. /// </summary> /// <param name="target">Current target Object</param> /// <param name="settings">Current brush settings</param> internal virtual void DrawGizmos(BrushTarget target, BrushSettings settings) { UpdateBrushGizmosColor(); foreach (PolyRaycastHit hit in target.raycastHits) { PolyHandles.DrawBrush(hit.position, hit.normal, settings, target.localToWorldMatrix, innerColor, outerColor); } #if Z_DEBUG #if Z_DRAW_WEIGHTS || DRAW_PER_VERTEX_ATTRIBUTES float[] w = target.GetAllWeights(); #endif #if Z_DRAW_WEIGHTS Mesh m = target.mesh; Vector3[] v = m.vertices; GUIContent content = new GUIContent("", ""); Handles.BeginGUI(); for (int i = 0; i < v.Length; i++) { if (w[i] < .0001f) { continue; } content.text = w[i].ToString("F2"); GUI.Label(HandleUtility.WorldPointToSizedRect(target.transform.TransformPoint(v[i]), content, EditorStyles.label), content); } Handles.EndGUI(); #endif #if DRAW_PER_VERTEX_ATTRIBUTES Mesh m = target.editableObject.editMesh; Color32[] colors = m.colors; Vector4[] tangents = m.tangents; List <Vector4> uv0 = m.uv0; List <Vector4> uv1 = m.uv1; List <Vector4> uv2 = m.uv2; List <Vector4> uv3 = m.uv3; int vertexCount = m.vertexCount; Vector3[] verts = m.vertices; GUIContent gc = new GUIContent(""); List <List <int> > common = MeshUtility.GetCommonVertices(m); System.Text.StringBuilder sb = new System.Text.StringBuilder(); Handles.BeginGUI(); foreach (List <int> l in common) { if (w[l[0]] < .001) { continue; } Vector3 v = target.transform.TransformPoint(verts[l[0]]); if (colors != null) { sb.AppendLine("color: " + colors[l[0]].ToString("F2")); } if (tangents != null) { sb.AppendLine("tangent: " + tangents[l[0]].ToString("F2")); } if (uv0 != null && uv0.Count == vertexCount) { sb.AppendLine("uv0: " + uv0[l[0]].ToString("F2")); } if (uv1 != null && uv1.Count == vertexCount) { sb.AppendLine("uv1: " + uv1[l[0]].ToString("F2")); } if (uv2 != null && uv2.Count == vertexCount) { sb.AppendLine("uv2: " + uv2[l[0]].ToString("F2")); } if (uv3 != null && uv3.Count == vertexCount) { sb.AppendLine("uv3: " + uv3[l[0]].ToString("F2")); } gc.text = sb.ToString(); sb.Remove(0, sb.Length); // @todo .NET 4.0 GUI.Label(HandleUtility.WorldPointToSizedRect(v, gc, EditorStyles.label), gc); } Handles.EndGUI(); #endif #endif }