public override void OnInspectorGUI() { Toolbar.RegisterTargets(targets); serializedObject.UpdateIfDirtyOrScript(); if (Event.current.type == EventType.Layout) { mValid = Target.IsValidSegment; } if (mValid && (Target.Spline.Closed || !Target.IsFirstSegment)) { EditorGUILayout.PropertyField(tSmoothTangent, new GUIContent("Smooth Tangent", "Smooth end tangent?")); } if (Target.Spline.Interpolation == CurvyInterpolation.Bezier && CurvyGUI.Foldout(ref mFoldouts[0], "Bezier Handles", CurvyEditorUtility.HelpURL("curvysplinesegment", "bezier"))) { EditorGUILayout.PropertyField(tFreeHandles, new GUIContent("Free Move", "Move Handles individually?")); EditorGUILayout.Slider(tHandleScale, 0, 10, new GUIContent("Scale", "Handle Scaling")); Vector3 v = tHandleIn.vector3Value; EditorGUILayout.PropertyField(tHandleIn); if (v != tHandleIn.vector3Value && !tFreeHandles.boolValue) { tHandleOut.vector3Value = -tHandleIn.vector3Value; } v = tHandleIn.vector3Value; EditorGUILayout.PropertyField(tHandleOut); if (v != tHandleOut.vector3Value && !tFreeHandles.boolValue) { tHandleIn.vector3Value = -tHandleOut.vector3Value; } EditorGUILayout.LabelField("Smooth Handles", EditorStyles.boldLabel); SmoothingOffset = EditorGUILayout.Slider(new GUIContent("Offset", "Smoothing Offset"), SmoothingOffset, 0.1f, 1f); if (GUILayout.Button(new GUIContent("Smooth", "Set Handles by Catmul-Rom"))) { #if OLD_UNDO Undo.RegisterUndo(targets, "Smooth Bezier Handles"); #else Undo.RecordObjects(targets, "Smooth Bezier Handles"); #endif foreach (CurvySplineSegment tgt in targets) { CurvyUtility.InterpolateBezierHandles(CurvyInterpolation.CatmulRom, SmoothingOffset, tgt.FreeHandles, tgt); } Target.Spline.RefreshImmediately(true, true, false); SceneView.RepaintAll(); } } if (mValid && Target.Spline.Interpolation == CurvyInterpolation.TCB && CurvyGUI.Foldout(ref mFoldouts[0], "TCB Settings", CurvyEditorUtility.HelpURL("curvysplinesegment", "tcb"))) { EditorGUILayout.PropertyField(tSyncStartEnd, new GUIContent("Synchronize TCB", "Synchronize Start and End Values")); EditorGUILayout.PropertyField(tOT, new GUIContent("Local Tension", "Override Spline Tension?")); if (tOT.boolValue) { EditorGUILayout.PropertyField(tT0, Target.SynchronizeTCB ? new GUIContent("Tension", "Tension") : new GUIContent("Start Tension", "Start Tension")); if (!Target.SynchronizeTCB) { EditorGUILayout.PropertyField(tT1, new GUIContent("End Tension", "End Tension")); } else { tT1.floatValue = tT0.floatValue; } } EditorGUILayout.PropertyField(tOC, new GUIContent("Local Continuity", "Override Spline Continuity?")); if (tOC.boolValue) { EditorGUILayout.PropertyField(tC0, Target.SynchronizeTCB ? new GUIContent("Continuity", "Continuity") : new GUIContent("Start Continuity", "Start Continuity")); if (!Target.SynchronizeTCB) { EditorGUILayout.PropertyField(tC1, new GUIContent("End Continuity", "End Continuity")); } else { tC1.floatValue = tC0.floatValue; } } EditorGUILayout.PropertyField(tOB, new GUIContent("Local Bias", "Override Spline Bias?")); if (tOB.boolValue) { EditorGUILayout.PropertyField(tB0, Target.SynchronizeTCB ? new GUIContent("Bias", "Bias") : new GUIContent("Start Bias", "Start Bias")); if (!Target.SynchronizeTCB) { EditorGUILayout.PropertyField(tB1, new GUIContent("End Bias", "End Bias")); } else { tB1.floatValue = tB0.floatValue; } } if (tOT.boolValue || tOC.boolValue || tOB.boolValue) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Set Catmul")) { tT0.floatValue = 0; tC0.floatValue = 0; tB0.floatValue = 0; tT1.floatValue = 0; tC1.floatValue = 0; tB1.floatValue = 0; } if (GUILayout.Button("Set Cubic")) { tT0.floatValue = -1; tC0.floatValue = 0; tB0.floatValue = 0; tT1.floatValue = -1; tC1.floatValue = 0; tB1.floatValue = 0; } if (GUILayout.Button("Set Linear")) { tT0.floatValue = 0; tC0.floatValue = -1; tB0.floatValue = 0; tT1.floatValue = 0; tC1.floatValue = -1; tB1.floatValue = 0; } EditorGUILayout.EndHorizontal(); } } if (CurvyGUI.Foldout(ref mFoldouts[1], "User Values", CurvyEditorUtility.HelpURL("curvysplinesegment", "uservalues"))) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent(mTexAddUserData, "Add User Value slot"), GUILayout.ExpandWidth(false), GUILayout.Height(mTexAddUserData.height))) { Target.Spline.UserValueSize++; Target.Spline.Refresh(); EditorUtility.SetDirty(Target.Spline); } if (GUILayout.Button(new GUIContent(mTexRemoveUserData, "Remove User Value slot"), GUILayout.ExpandWidth(false), GUILayout.Height(mTexRemoveUserData.height))) { Target.Spline.UserValueSize--; Target.Spline.Refresh(); EditorUtility.SetDirty(Target.Spline); } EditorGUILayout.EndHorizontal(); if (Target.UserValues != null && Target.UserValues.Length > 0) { ArrayGUI(serializedObject, "UserValues", false); } } if ((Target.Connection != null || Target.ConnectedBy.Count > 0) && CurvyGUI.Foldout(ref mFoldouts[2], "Connections", CurvyEditorUtility.HelpURL("curvysplinesegment", "connections"))) { ConnectionGUI(); } //EditorGUILayout.PropertyField(serializedObject.FindProperty("Node")); if ((serializedObject.targetObject && serializedObject.ApplyModifiedProperties())) { Target.Spline.Refresh(true, true, false); SceneView.RepaintAll(); } if (mValid && CurvyGUI.Foldout(ref mFoldouts[3], "Segment Info")) { EditorGUILayout.LabelField(new GUIContent("Distance: " + Target.Distance, "Distance from first Control Point")); EditorGUILayout.LabelField(new GUIContent("Length: " + Target.Length, "Length of this segment")); } if (CurvyGUI.Foldout(ref mFoldouts[4], "Spline Info")) { EditorGUILayout.LabelField("Total Length: " + Target.Spline.Length); } }