public SplineUserSubEditor(SplineUser user, SplineUserEditor editor) { this.editor = editor; this.user = user; }
protected virtual void HeaderGUI() { SplineUser user = (SplineUser)target; bool isClosed = true; bool loopSamples = true; for (int i = 0; i < users.Length; i++) { if (users[i].spline == null) { isClosed = false; } else if (!users[i].spline.isClosed) { isClosed = false; } else if (!users[i].loopSamples) { loopSamples = false; } } Undo.RecordObject(user, "Inspector Change"); SplineComputer lastSpline = (SplineComputer)spline.objectReferenceValue; EditorGUILayout.PropertyField(spline); SplineComputer newSpline = (SplineComputer)spline.objectReferenceValue; if (lastSpline != (SplineComputer)spline.objectReferenceValue) { for (int i = 0; i < users.Length; i++) { if (lastSpline != null) { lastSpline.Unsubscribe(users[i]); } if (newSpline != null) { newSpline.Subscribe(users[i]); } } user.Rebuild(); } //if (GUI.changed) serializedObject.ApplyModifiedProperties(); if (user.spline == null) { EditorGUILayout.HelpBox("No SplineComputer is referenced. Link a SplineComputer to make this SplineUser work.", MessageType.Error); } if (showClip) { float clipFrom = 0f, clipTo = 1f; clipFrom = this.clipFrom.floatValue; clipTo = this.clipTo.floatValue; float lastFrom = clipFrom, lastTo = clipTo; EditorGUI.BeginChangeCheck(); if (isClosed && loopSamples) { EditorGUILayout.BeginHorizontal(); if (EditButton(_editIndex == 0)) { if (_editIndex == 0) { _editIndex = -1; } else { _editIndex = 0; } } EditorGUILayout.BeginVertical(); clipFrom = EditorGUILayout.Slider("Clip From", clipFrom, 0f, 1f); clipTo = EditorGUILayout.Slider("Clip To", clipTo, 0f, 1f); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal(); if (EditButton(_editIndex == 0)) { if (_editIndex == 0) { _editIndex = -1; } else { _editIndex = 0; } } EditorGUIUtility.labelWidth = 80f; EditorGUILayout.MinMaxSlider(new GUIContent("Clip Range:"), ref clipFrom, ref clipTo, 0f, 1f); EditorGUIUtility.labelWidth = 0f; EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(30)); clipFrom = EditorGUILayout.FloatField(clipFrom); clipTo = EditorGUILayout.FloatField(clipTo); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { this.clipFrom.floatValue = clipFrom; this.clipTo.floatValue = clipTo; } SplineComputerEditor.hold = _editIndex >= 0; if (isClosed) { EditorGUILayout.PropertyField(this.loopSamples, new GUIContent("Loop Samples")); } if (!this.loopSamples.boolValue || !isClosed) { if (this.clipFrom.floatValue > this.clipTo.floatValue) { float temp = this.clipTo.floatValue; this.clipTo.floatValue = this.clipFrom.floatValue; this.clipFrom.floatValue = temp; } } } settings = EditorGUILayout.Foldout(settings, "Settings"); if (settings) { EditorGUI.indentLevel++; if (showUpdateMethod) { EditorGUILayout.PropertyField(updateMethod); } EditorGUILayout.PropertyField(autoUpdate, new GUIContent("Auto Rebuild")); if (showMultithreading) { EditorGUILayout.PropertyField(multithreaded); } EditorGUILayout.PropertyField(buildOnAwake); EditorGUILayout.PropertyField(buildOnEnable); EditorGUI.indentLevel--; } }
public TransformModuleEditor(SplineUser user, SplineUserEditor parent, TransformModule input) : base(user, parent) { title = "Motion"; motionApplier = input; }
public RotationModifierEditor(SplineUser user, SplineUserEditor parent, RotationModifier input) : base(user, parent, input) { title = "Rotation Modifiers"; }
public OffsetModifierEditor(SplineUser user, SplineUserEditor editor, OffsetModifier input) : base(user, editor, input) { module = input; title = "Offset Modifiers"; }
public FollowerSpeedModifierEditor(SplineUser user, SplineUserEditor editor, FollowerSpeedModifier input) : base(user, editor, input) { module = input; title = "Speed Modifiers"; }
public SplineSampleModifierEditor(SplineUser user, SplineUserEditor editor, SplineSampleModifier input) : base(user, editor) { module = input; title = "Tracer Module"; }
public ColorModifierEditor(SplineUser user, SplineUserEditor editor, ColorModifier input) : base(user, editor, input) { module = input; title = "Color Modifiers"; }
public SizeModifierEditor(SplineUser user, SplineUserEditor editor, SizeModifier input) : base(user, editor, input) { module = input; title = "Size Modifiers"; }
// Use this for initialization void Start() { comp = GetComponent <SplineComputer>(); user = GetComponent <SplineUser>(); }