private static void DrawGizmos(ObiRod actor, GizmoType gizmoType) { Handles.color = Color.white; if (actor.rodBlueprint != null) { ObiPathHandles.DrawPathHandle(actor.rodBlueprint.path, actor.transform.localToWorldMatrix, actor.rodBlueprint.thickness, 20); } }
public bool OnSceneGUI(float thicknessScale, Matrix4x4 matrix) { ResizeCPArrays(); HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive)); // get a window ID: if (Event.current.type != EventType.Used) { windowId = GUIUtility.GetControlID(FocusType.Passive); } Matrix4x4 prevMatrix = Handles.matrix; Handles.matrix = matrix; // Draw control points: Handles.color = handleColor; for (int i = 0; i < path.ControlPointCount; ++i) { needsRepaint |= DrawControlPoint(i); } // Control point selection handle: needsRepaint |= ObiPathHandles.SplineCPSelector(path, selectedStatus); // Count selected and calculate average position: selectionAverage = GetControlPointAverage(out lastSelected, out selectedCount); // Draw cp tool handles: needsRepaint |= SplineCPTools(matrix); if (showThicknessHandles) { needsRepaint |= DoThicknessHandles(thicknessScale); } // Sceneview GUI: Handles.BeginGUI(); GUILayout.Window(windowId, new Rect(10, 28, 0, 0), DrawUIWindow, "Path editor"); Handles.EndGUI(); Handles.matrix = prevMatrix; // During edit mode, allow to add/remove control points. if (insertTool) { AddControlPointsMode(matrix); } if (removeTool) { RemoveControlPointsMode(matrix); } return(needsRepaint); }