protected override void InternalOnInspectorGUI() { base.InternalOnInspectorGUI(); BGEditorUtility.Assign(ref scaleFieldContent, () => new GUIContent("Scale Field", "Scale field to take a scale from. Each point will have it's own scale. Should be Vector3 field.")); BGEditorUtility.CustomField(scaleFieldContent, cc.Curve, ObjectScale.ScaleField, BGCurvePointField.TypeEnum.Vector3, field => { ObjectScale.ScaleField = field; }); }
protected override void InternalOnInspectorGUI() { BGEditorUtility.Assign(ref speedFieldContent, () => new GUIContent("Speed Field", "Speed field to take a speed from. Each point will have it's own speed. Should be a float field.")); BGEditorUtility.Assign(ref delayFieldContent, () => new GUIContent("Delay Field", "Delay field to take a delay from. Each point will have it's own delay. Should be a float field.")); //use fixedupdate EditorGUILayout.PropertyField(serializedObject.FindProperty("useFixedUpdate")); //speed BGEditorUtility.VerticalBox(() => { BGEditorUtility.CustomField(speedFieldContent, cc.Curve, ChangeLinear.SpeedField, BGCurvePointField.TypeEnum.Float, field => ChangeLinear.SpeedField = field); if (ChangeLinear.SpeedField == null) { EditorGUILayout.PropertyField(serializedObject.FindProperty("speed")); } }); //delay BGEditorUtility.VerticalBox(() => { BGEditorUtility.CustomField(delayFieldContent, cc.Curve, ChangeLinear.DelayField, BGCurvePointField.TypeEnum.Float, field => ChangeLinear.DelayField = field); if (ChangeLinear.DelayField == null) { EditorGUILayout.PropertyField(serializedObject.FindProperty("delay")); } }); EditorGUILayout.PropertyField(serializedObject.FindProperty("overflowControl")); EditorGUILayout.PropertyField(serializedObject.FindProperty("adjustByTotalLength")); try { //by some reason NullReferenceException exceptions are fired at certain GUI passes EditorGUILayout.PropertyField(serializedObject.FindProperty("pointReachedEvent")); } catch (NullReferenceException) { } }
protected override void InternalOnInspectorGUI() { base.InternalOnInspectorGUI(); // reusable labels BGEditorUtility.Assign(ref rotationFieldContent, () => new GUIContent("Rotation Field", "Rotation field to take a rotation from. Each point will have it's own rotation. Should be a Quaternion field.")); BGEditorUtility.Assign(ref revolutionsFieldContent, () => new GUIContent("Revolutions Field", "Field to store additional revolutions around tangent. It should be an int field.")); BGEditorUtility.Assign(ref clockwiseFieldContent, () => new GUIContent("Revolutions Clockwise Field", "Field to store if the rotation around tangent should be clockwise. It should be a bool field.")); //type of the rotation 1) tangent (without field) 2) by field's values BGEditorUtility.VerticalBox(() => { BGEditorUtility.CustomField(rotationFieldContent, cc.Curve, ObjectRotate.RotationField, BGCurvePointField.TypeEnum.Quaternion, field => ObjectRotate.RotationField = field); if (ObjectRotate.RotationField != null) { //============================== field is used BGEditorUtility.VerticalBox(() => { // additional revolutions BGEditorUtility.CustomField(revolutionsFieldContent, cc.Curve, ObjectRotate.RevolutionsAroundTangentField, BGCurvePointField.TypeEnum.Int, field => ObjectRotate.RevolutionsAroundTangentField = field); if (ObjectRotate.RevolutionsAroundTangentField == null) { EditorGUILayout.PropertyField(serializedObject.FindProperty("revolutionsAroundTangent")); } // clockwise? BGEditorUtility.CustomField(clockwiseFieldContent, cc.Curve, ObjectRotate.RevolutionsClockwiseField, BGCurvePointField.TypeEnum.Bool, field => ObjectRotate.RevolutionsClockwiseField = field); if (ObjectRotate.RevolutionsClockwiseField == null) { EditorGUILayout.PropertyField(serializedObject.FindProperty("revolutionsClockwise")); } }); } else { //============================== no field- tangent is used BGEditorUtility.VerticalBox(() => { EditorGUILayout.PropertyField(serializedObject.FindProperty("upMode")); switch (ObjectRotate.UpMode) { case BGCcCursorObjectRotate.RotationUpEnum.WorldCustom: case BGCcCursorObjectRotate.RotationUpEnum.LocalCustom: case BGCcCursorObjectRotate.RotationUpEnum.TargetParentUpCustom: EditorGUILayout.PropertyField(serializedObject.FindProperty("upCustom")); break; } }); } }); //interpolation BGEditorUtility.VerticalBox(() => { EditorGUILayout.PropertyField(serializedObject.FindProperty("rotationInterpolation")); switch (ObjectRotate.RotationInterpolation) { case BGCcCursorObjectRotate.RotationInterpolationEnum.Lerp: EditorGUILayout.PropertyField(serializedObject.FindProperty("lerpSpeed")); break; case BGCcCursorObjectRotate.RotationInterpolationEnum.Slerp: EditorGUILayout.PropertyField(serializedObject.FindProperty("slerpSpeed")); break; } }); EditorGUILayout.PropertyField(serializedObject.FindProperty("offsetAngle")); }
protected override void InternalOnInspectorGUI() { EditorGUILayout.PropertyField(serializedObject.FindProperty("objectToManipulate")); EditorGUILayout.LabelField("Cursor", EditorStyles.boldLabel); base.InternalOnInspectorGUI(); EditorGUILayout.LabelField("Change Cursor", EditorStyles.boldLabel); EditorGUILayout.PropertyField(serializedObject.FindProperty("useFixedUpdate")); EditorGUILayout.PropertyField(serializedObject.FindProperty("overflowControl")); EditorGUILayout.PropertyField(serializedObject.FindProperty("cursorChangeMode")); switch (Trs.CursorChangeMode) { case BGCcTrs.CursorChangeModeEnum.Constant: EditorGUILayout.PropertyField(serializedObject.FindProperty("speed")); break; case BGCcTrs.CursorChangeModeEnum.LinearField: case BGCcTrs.CursorChangeModeEnum.LinearFieldInterpolate: BGEditorUtility.CustomField(new GUIContent("Speed field", "Float field to get speed value from"), cc.Curve, Trs.SpeedField, BGCurvePointField.TypeEnum.Float, field => Trs.SpeedField = field); break; default: throw new ArgumentOutOfRangeException(); } EditorGUILayout.LabelField("TRS", EditorStyles.boldLabel); BGEditorUtility.VerticalBox(() => { EditorGUILayout.PropertyField(serializedObject.FindProperty("moveObject")); }); BGEditorUtility.VerticalBox(() => { EditorGUILayout.PropertyField(serializedObject.FindProperty("rotateObject")); if (Trs.RotateObject) { EditorGUILayout.PropertyField(serializedObject.FindProperty("offsetAngle")); EditorGUILayout.PropertyField(serializedObject.FindProperty("rotationInterpolation")); switch (Trs.RotationInterpolation) { case BGCcTrs.RotationInterpolationEnum.Lerp: EditorGUILayout.PropertyField(serializedObject.FindProperty("lerpSpeed")); break; case BGCcTrs.RotationInterpolationEnum.Slerp: EditorGUILayout.PropertyField(serializedObject.FindProperty("slerpSpeed")); break; } BGEditorUtility.CustomField(new GUIContent("Rotation field", "Quaternion field to get rotation value from"), cc.Curve, Trs.RotationField, BGCurvePointField.TypeEnum.Quaternion, field => Trs.RotationField = field); } }); BGEditorUtility.VerticalBox(() => { EditorGUILayout.PropertyField(serializedObject.FindProperty("scaleObject")); if (Trs.ScaleObject) { BGEditorUtility.CustomField(new GUIContent("Scale field", "Vector3 field to get scale value from"), cc.Curve, Trs.ScaleField, BGCurvePointField.TypeEnum.Vector3, field => Trs.ScaleField = field); } }); }