public override void OnSceneGUI() { if (Application.isPlaying) { return; } // setup start and end positions var go = ActionHelpers.GetOwnerDefault(tweenAction, tweenAction.gameObject); if (go == null) { return; } var transform = go.transform; var startPos = new Vector3(); var endPos = new Vector3(); if (!TweenHelpers.GetTargetPosition(tweenAction.fromOption, transform, tweenAction.fromPosition, tweenAction.fromTarget, out startPos)) { return; } if (!TweenHelpers.GetTargetPosition(tweenAction.toOption, transform, tweenAction.toPosition, tweenAction.toTarget, out endPos)) { return; } EditorGUI.BeginChangeCheck(); if (TweenHelpers.CanEditTargetPosition(tweenAction.fromOption, tweenAction.fromPosition, tweenAction.fromTarget)) { tweenAction.fromPosition.Value = TweenHelpers.DoTargetPositionHandle(startPos, tweenAction.fromOption, transform, tweenAction.fromTarget); } if (TweenHelpers.CanEditTargetPosition(tweenAction.toOption, tweenAction.toPosition, tweenAction.toTarget)) { tweenAction.toPosition.Value = TweenHelpers.DoTargetPositionHandle(endPos, tweenAction.toOption, transform, tweenAction.toTarget); } var rotation = transform.rotation; ActionHelpers.DrawWireBounds(transform, startPos, rotation, PlayMakerPrefs.TweenFromColor); ActionHelpers.DrawWireBounds(transform, endPos, rotation, PlayMakerPrefs.TweenToColor); ActionHelpers.DrawArrow(startPos, endPos, PlayMakerPrefs.TweenToColor); if (EditorGUI.EndChangeCheck()) { FsmEditor.SaveActions(); } }
public override void OnSceneGUI() { if (Application.isPlaying) { return; } // setup start and end positions var go = ActionHelpers.GetOwnerDefault(tweenAction, tweenAction.gameObject); if (go == null) { return; } // setup handles var transform = go.transform; //var position = transform.position; //var rotation = transform.rotation; //var handleSize = HandleUtility.GetHandleSize(position); var startRotation = Quaternion.identity; if (TweenHelpers.GetTargetRotation(tweenAction.fromOptions, transform, tweenAction.fromRotation, tweenAction.fromTarget, out startRotation)) { ActionHelpers.DrawWireBounds(transform, startRotation, PlayMakerPrefs.TweenFromColor); } var endRotation = Quaternion.identity; if (TweenHelpers.GetTargetRotation(tweenAction.toOptions, transform, tweenAction.toRotation, tweenAction.toTarget, out endRotation)) { ActionHelpers.DrawWireBounds(transform, endRotation, PlayMakerPrefs.TweenToColor); } /* * Transform fromTransform = null; * if (tweenAction.fromTarget != null) * { * fromTransform = tweenAction.fromTarget.Value != null ? tweenAction.fromTarget.Value.transform : null; * } * * Transform toTransform = null; * if (tweenAction.toTarget != null) * { * toTransform = tweenAction.toTarget.Value != null ? tweenAction.toTarget.Value.transform : null; * } * * var startRotation = ActionHelpers.GetTargetRotation(tweenAction.fromOptions, transform, fromTransform, tweenAction.fromRotation.Value); * var endRotation = ActionHelpers.GetTargetRotation(tweenAction.toOptions, transform, toTransform, tweenAction.toRotation.Value); * * var showFromHandles = ActionHelpers.CanEditTargetRotation(tweenAction.fromOptions, tweenAction.fromRotation, tweenAction.fromTarget); * if (showFromHandles) * { * ActionHelpers.DrawWireBounds(transform, startRotation, PlayMakerPrefs.TweenFromColor); * // Need a custom control for this? * // tweenAction.fromRotation.Value = Handles.RotationHandle(tweenAction.fromRotation.Value, transform.position); * } * * var showToHandles = ActionHelpers.CanEditTargetRotation(tweenAction.toOptions, tweenAction.toRotation, tweenAction.toTarget); * if (showToHandles) * { * ActionHelpers.DrawWireBounds(transform, endRotation, PlayMakerPrefs.TweenToColor); * // Need a custom control for this? * // tweenAction.fromRotation.Value = Handles.RotationHandle(tweenAction.fromRotation.Value, transform.position); * }*/ if (GUI.changed) { FsmEditor.SaveActions(); } }