using System; using System.Collections.Generic; using System.Text; using System.IO; using System.IO.Compression; using Unity.Profiling; using UnityEditor.Experimental; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; namespace UnityEditor.VFX.UI { [Serializable] class OpenedTextProvider { [SerializeField] public int index; [SerializeField] public VFXModel model; } class VFXTextEditor : EditorWindow, ISerializationCallbackReceiver, IComparer { readonly struct TextArea { public static float s_FontSize = 11f; static ProfilerMarker s_TextChangedPerfMarker = new("TextArea.OnTextChanged"); readonly VFXTextEditor m_Editor; readonly ITextProvider m_TextProvider; readonly TextField m_TextField; readonly Label m_TitleLabel; readonly VisualElement m_Root; readonly Stack m_UndoStack; readonly Stack m_RedoStack; public TextArea(VFXTextEditor editor, ITextProvider textProvider) { m_Editor = editor; m_TextProvider = textProvider; m_UndoStack = new Stack(); m_RedoStack = new Stack(); var tpl = VFXView.LoadUXML("VFXTextEditorArea"); m_Root = tpl.CloneTree(); m_TextField = m_Root.Q("TextEditor"); m_TextField.selectAllOnFocus = false; m_TextField.selectAllOnMouseUp = false; m_TextField.SetValueWithoutNotify(textProvider.text); m_TitleLabel = m_Root.Q