protected virtual void OnSceneGUI() { MapSegmentBuilder vmSegBuilder = (MapSegmentBuilder)target; Undo.RecordObject(vmSegBuilder, "Segment points change"); var localPositions = vmSegBuilder.segment.targetLocalPositions; var pointCount = localPositions.Count; if (pointCount < 1) { return; } Transform mainTrans = vmSegBuilder.transform; if (vmSegBuilder.displayHandles) { for (int i = 0; i < pointCount - 1; i++) { Vector3 newTargetPosition = Handles.PositionHandle(mainTrans.TransformPoint(localPositions[i]), Quaternion.identity); localPositions[i] = mainTrans.InverseTransformPoint(newTargetPosition); } Vector3 lastPoint = Handles.PositionHandle(mainTrans.TransformPoint(localPositions[pointCount - 1]), Quaternion.identity); localPositions[pointCount - 1] = mainTrans.InverseTransformPoint(lastPoint); } }
protected override void OnSceneGUI() { base.OnSceneGUI(); MapSegmentBuilder vmSegBuilder = (MapSegmentBuilder)target; Undo.RecordObject(vmSegBuilder, "Segment points change"); var localPositions = vmSegBuilder.segment.targetLocalPositions; var pointCount = localPositions.Count; if (pointCount < 2) { return; } Transform mainTrans = vmSegBuilder.transform; for (int i = 0; i < pointCount - 1; i++) { Handles.color = segmentPointColor; Handles.DrawWireDisc(mainTrans.TransformPoint(localPositions[i]), Vector3.up, Map.Autoware.VectorMapTool.PROXIMITY * 0.5f); Handles.color = rayColor; Handles.DrawLine(mainTrans.TransformPoint(localPositions[i]), mainTrans.TransformPoint(localPositions[i + 1])); Map.Draw.DrawArrowForDebug(mainTrans.TransformPoint(localPositions[i]), mainTrans.TransformPoint(localPositions[i + 1]), rayColor, Map.Autoware.VectorMapTool.ARROWSIZE); } Handles.color = segmentPointColor; Handles.DrawWireDisc(mainTrans.TransformPoint(localPositions[pointCount - 1]), Vector3.up, Map.Autoware.VectorMapTool.PROXIMITY * 0.5f); }
public override void OnInspectorGUI() { DrawDefaultInspector(); MapSegmentBuilder mapSegment = (MapSegmentBuilder)target; Undo.RecordObject(mapSegment, "change points"); if (GUILayout.Button("Add Point")) { mapSegment.AddPoint(); } if (GUILayout.Button("Remove Point")) { mapSegment.RemovePoint(); } if (GUILayout.Button("Reverse Points")) { mapSegment.ReversePoints(); } if (GUILayout.Button("Reset Points")) { mapSegment.ResetPoints(); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); MapSegmentBuilder mapSegment = (MapSegmentBuilder)target; Undo.RecordObject(mapSegment, "change points"); if (GUILayout.Button("Add Point")) { mapSegment.AddPoint(); } if (GUILayout.Button("Remove Point")) { mapSegment.RemovePoint(); } if (GUILayout.Button("Reverse Points")) { mapSegment.ReversePoints(); } if (GUILayout.Button("Reset Points")) { mapSegment.ResetPoints(); } EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); if (GUILayout.Button("Double Waypoints")) { mapSegment.DoublePoints(); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); MapSegmentBuilder mapSegment = (MapSegmentBuilder)target; Undo.RecordObject(mapSegment, "change builder"); if (GUILayout.Button("Append Point")) { mapSegment.AppendPoint(); } if (GUILayout.Button("Prepend Point")) { mapSegment.PrependPoint(); } if (GUILayout.Button("Remove First")) { mapSegment.RemoveFirstPoint(); } if (GUILayout.Button("Remove Last")) { mapSegment.RemoveLastPoint(); } if (GUILayout.Button("Reverse Points")) { mapSegment.ReversePoints(); } if (GUILayout.Button("Reset Points")) { mapSegment.ResetPoints(); } EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); if (GUILayout.Button("Double Waypoint Resolution")) { if (!mapSegment.DoubleSubsegments()) { Debug.Log($"{nameof(mapSegment.DoubleSubsegments)} fail"); } } if (GUILayout.Button("Half Waypoint Resolution")) { if (!mapSegment.HalfSubsegments()) { Debug.Log($"{nameof(mapSegment.HalfSubsegments)} fail"); } } }
public override void OnInspectorGUI() { DrawDefaultInspector(); MapSegmentBuilder mapSegment = (MapSegmentBuilder)target; Undo.RecordObject(mapSegment, "change points"); if (GUILayout.Button("Add Point at end index")) { mapSegment.AddPoint(); } if (GUILayout.Button("Add Point at zero index")) { mapSegment.InsertPointAtZeroIndex(); } if (GUILayout.Button("Remove Point")) { mapSegment.RemovePoint(); } if (GUILayout.Button("Reverse Points")) { mapSegment.ReversePoints(); } if (GUILayout.Button("Reset Points")) { mapSegment.ResetPoints(); } EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); if (GUILayout.Button("Double Subsegments")) { if (!mapSegment.DoubleSubsegments()) { Debug.Log($"{nameof(mapSegment.DoubleSubsegments)} fail"); } } if (GUILayout.Button("Half Subsegments")) { if (!mapSegment.HalfSubsegments()) { Debug.Log($"{nameof(mapSegment.HalfSubsegments)} fail"); } } }