public bool DragControlPoint(bool extend) { PositionHandle positionHandle = m_editor.Tools.ActiveTool as PositionHandle; if (m_picker.IsControlPointSelected && positionHandle != null && positionHandle.IsDragging) { if (extend) { ControlPointPicker picker = m_editor.Selection.activeGameObject.GetComponent <ControlPointPicker>(); BaseSpline spline = picker.Selection.GetSpline(); BaseSplineState oldState = spline.GetState(); PickResult oldSelection = picker.Selection != null ? new PickResult(picker.Selection) : null; m_picker.Drag(true); spline = picker.Selection.GetSpline(); BaseSplineState newState = spline.GetState(); PickResult newSelection = picker.Selection != null ? new PickResult(picker.Selection) : null; RecordState(spline.gameObject, oldState, newState, picker, oldSelection, newSelection); } else { m_picker.Drag(false); } return(true); } return(false); }
public void Remove() { ControlPointPicker picker = m_editor.Selection.activeGameObject.GetComponent <ControlPointPicker>(); BaseSpline spline = picker.Selection.GetSpline(); BaseSplineState oldState = spline.GetState(); PickResult oldSelection = picker.Selection != null ? new PickResult(picker.Selection) : null; picker.Remove(); PickResult newSelection = picker.Selection != null ? new PickResult(picker.Selection) : null; spline = picker.Selection.GetSpline(); BaseSplineState newState = spline.GetState(); RecordState(spline.gameObject, oldState, newState, picker, oldSelection, newSelection); }
public void Append() { ControlPointPicker picker = m_editor.Selection.activeGameObject.GetComponent <ControlPointPicker>(); BaseSpline spline = picker.Selection.GetSpline(); BaseSplineState oldState = spline.GetState(); PickResult oldSelection = picker.Selection != null ? new PickResult(picker.Selection) : null; if (picker.Selection.Index == 0 || picker.Selection.Index == 1) { picker.Prepend(); } else { picker.Append(); } spline = picker.Selection.GetSpline(); BaseSplineState newState = spline.GetState(); PickResult newSelection = picker.Selection != null ? new PickResult(picker.Selection) : null; RecordState(spline.gameObject, oldState, newState, picker, oldSelection, newSelection); }