示例#1
0
    void OnEnable()
    {
        window              = this;
        this.maxSize        = new Vector2(715f, 398f);
        this.minSize        = this.maxSize;
        this.wantsMouseMove = true;
        loadAnimatorData();
        oData = AMOptionsFile.loadFile();
        setupFilteredCategories();
        selectedIndex = getCategoryIndexForEase(key.easeType);
        if (selectedIndex < 0)
        {
            selectedIndex = key.easeType;
            category      = 0;
        }

        if (getSelectedEaseName(category, selectedIndex) == "Custom")
        {
            isCustomEase = true;
        }
        if (isCustomEase && key.customEase.Count > 0)
        {
            curve = key.getCustomEaseCurve();
        }
        else
        {
            setEasingCurve();
        }
    }
示例#2
0
    public static AMOptionsFile loadFile()
    {
        AMOptionsFile load_file = (AMOptionsFile)Resources.Load("am_options");

        if (load_file)
        {
            load_file.unflatten_quickAdd_Combos(true);
            return(load_file);
        }
        string filePath = getFilePath();

        if (filePath == null)
        {
            Debug.LogError("Animator: Main asset directory 'Animator/Resources/' not found.");
            return(ScriptableObject.CreateInstance <AMOptionsFile>());
        }

        AMOptionsFile a = ScriptableObject.CreateInstance <AMOptionsFile>();

        AssetDatabase.CreateAsset(a, filePath);
        a.quickAdd_Combos.Add(new List <int> {
            (int)AMTimeline.Track.Translation, (int)AMTimeline.Track.Orientation
        });
        a.quickAdd_Combos.Add(new List <int> {
            (int)AMTimeline.Track.Translation, (int)AMTimeline.Track.Rotation, (int)AMTimeline.Track.Animation
        });
        a.flatten_quickAdd_Combos();
        AssetDatabase.Refresh();
        return(a);
    }
示例#3
0
    void OnEnable()
    {
        window       = this;
        this.title   = "Options";
        this.minSize = new Vector2(545f, 365f);
        this.maxSize = new Vector2(1000f, this.minSize.y);

        loadAnimatorData();
        oData = AMOptionsFile.loadFile();
        // setup skin popup
        skinIndex = 0;
        for (int i = 1; i < skin_ids.Length; i++)
        {
            if (skin_ids[i] == oData.skin)
            {
                skinIndex = i;
                break;
            }
        }

        if (aData)
        {
            exportTakeIndex = aData.getTakeIndex(aData.getCurrentTake());
        }
    }
示例#4
0
    void OnEnable()
    {
        window       = this;
        this.title   = "Export Take" + (take == null ? "s" : "");
        this.minSize = new Vector2(190f, 120f);

        oData = AMOptionsFile.loadFile();
    }
    void OnEnable()
    {
        window = this;
        this.title = "Export Take" + (take == null ? "s" : "");
        this.minSize = new Vector2(190f,120f);

        oData = AMOptionsFile.loadFile();
    }
示例#6
0
 void OnEnable()
 {
     window          = this;
     this.title      = "Code View";
     this.minSize    = new Vector2(/*380f*/ width_code_min + width_inspector_open_min, 102f);
     this.scrollView = new Vector2(0f, 0f);
     oData           = AMOptionsFile.loadFile();
     loadAnimatorData();
     refreshCode();
 }
示例#7
0
    void OnEnable()
    {
        window            = this;
        this.titleContent = new GUIContent("Settings");
        this.minSize      = new Vector2(125f, 115f);
        this.maxSize      = this.minSize;

        oData = AMOptionsFile.loadFile();
        loadAnimatorData();
    }
示例#8
0
    void OnEnable()
    {
        window = this;
        this.title = "Settings";
        this.minSize = new Vector2(125f,115f);
        this.maxSize = this.minSize;

        oData = AMOptionsFile.loadFile();
        loadAnimatorData();
    }
示例#9
0
 void OnEnable()
 {
     window              = this;
     this.titleContent   = new GUIContent("Property");
     this.minSize        = new Vector2(273f, 102f);
     this.wantsMouseMove = true;
     oData = AMOptionsFile.loadFile();
     loadAnimatorData();
     scrollView = new Vector2(0f, 0f);
     // define styles
 }
 void OnEnable()
 {
     window = this;
     this.title = "Property";
     this.minSize = new Vector2(273f,102f);
     this.wantsMouseMove = true;
     oData = AMOptionsFile.loadFile();
     loadAnimatorData();
     scrollView = new Vector2(0f,0f);
     // define styles
 }
示例#11
0
    void OnEnable()
    {
        this.titleContent = new GUIContent("Resolve Duplicates");
        this.minSize      = new Vector2(590f, 120f);
        actions           = new List <int>();
        for (int i = 0; i < newReference.Count; i++)
        {
            actions.Add(0);
        }

        oData = AMOptionsFile.loadFile();
    }
示例#12
0
    void OnEnable()
    {
        window = this;

        texRightArrow = (Texture)Resources.Load("am_nav_right"); // inspector right arrow
        texLeftArrow  = (Texture)Resources.Load("am_nav_left");  // inspector left arrow

        this.titleContent = new GUIContent("Code View");
        this.minSize      = new Vector2(/*380f*/ width_code_min + width_inspector_open_min, 102f);
        this.scrollView   = new Vector2(0f, 0f);
        oData             = AMOptionsFile.loadFile();
        loadAnimatorData();
        refreshCode();
    }
示例#13
0
    void OnEnable()
    {
        //curves[0] = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
        //curves[1] = new AnimationCurve(new Keyframe(0, 1), new Keyframe(1, 0));
        //curves[2] = new AnimationCurve(new Keyframe(0, 0.5f), new Keyframe(1, 0.5f));

        window = this;

        tex_orb = (Texture)Resources.Load("am_orb");

        this.maxSize        = new Vector2(715f, 398f);
        this.minSize        = this.maxSize;
        this.wantsMouseMove = true;
        loadAnimatorData();
        oData = AMOptionsFile.loadFile();
        setupFilteredCategories();
        selectedIndex = getCategoryIndexForEase(key.easeType);
        if (selectedIndex < 0)
        {
            selectedIndex = key.easeType;
            category      = 0;
        }

        if (getSelectedEaseName(category, selectedIndex) == "Custom")
        {
            isCustomEase = true;
        }
        if (isCustomEase && key.customEase.Count > 0)
        {
            curve = key.getCustomEaseCurve();
        }
        else
        {
            setEasingCurve();
        }
    }
示例#14
0
    void OnEnable()
    {
        LoadTextures();

        window = this;
        setWindowSize();
        this.wantsMouseMove = true;
        loadAnimatorData();
        oData = AMOptionsFile.loadFile();
        // set up here
    }
示例#15
0
    void OnEnable()
    {
        texRightArrow = AMEditorResource.LoadEditorTexture("am_nav_right");// inspector right arrow
        texLeftArrow = AMEditorResource.LoadEditorTexture("am_nav_left");	// inspector left arrow

        window = this;
        this.title = "Code View";
        this.minSize = new Vector2(/*380f*/width_code_min + width_inspector_open_min, 102f);
        this.scrollView = new Vector2(0f, 0f);
        oData = AMOptionsFile.loadFile();
        loadAnimatorData();
        refreshCode();
    }
 void OnEnable()
 {
     window = this;
     setWindowSize();
     this.wantsMouseMove = true;
     loadAnimatorData();
     oData = AMOptionsFile.loadFile();
     // set up here
     transitionNames = new List<string>(AMTween.TransitionNames);
 }
示例#17
0
 void OnEnable()
 {
     window = this;
     this.title = "Code View";
     this.minSize = new Vector2(/*380f*/width_code_min+width_inspector_open_min,102f);
     this.scrollView = new Vector2(0f,0f);
     oData = AMOptionsFile.loadFile();
     loadAnimatorData();
     refreshCode();
 }
示例#18
0
    void OnEnable()
    {
        window = this;
        this.maxSize = new Vector2(715f,398f);
        this.minSize = this.maxSize;
        this.wantsMouseMove = true;
        loadAnimatorData();
        oData = AMOptionsFile.loadFile();
        setupFilteredCategories();
        selectedIndex = getCategoryIndexForEase(key.easeType);
        if(selectedIndex < 0) {
            selectedIndex = key.easeType;
            category = 0;
        }

        if(getSelectedEaseName(category,selectedIndex) == "Custom") {
            isCustomEase = true;
        }
        if(isCustomEase && key.customEase.Count > 0) {
            curve = key.getCustomEaseCurve();
        } else {
            setEasingCurve();
        }
    }
示例#19
0
    void OnGUI()
    {
        AMTimeline.loadSkin(oData, ref skin, ref cachedSkinName, position);
        GUIStyle textStyle = new GUIStyle(GUI.skin.label);
        textStyle.wordWrap = false;
        textStyle.alignment = TextAnchor.UpperLeft;
        textStyle.padding = new RectOffset(0,0,10,0);
        GUIStyle styleLabelCentered = new GUIStyle(GUI.skin.label);
        styleLabelCentered.alignment = TextAnchor.MiddleCenter;
        if(!aData) {
            AMTimeline.MessageBox("Animator requires an AnimatorData component in your scene. Launch Animator to add the component.",AMTimeline.MessageBoxType.Warning);
            return;
        }
        if(!oData) oData = AMOptionsFile.loadFile();
        #region drag logic
        Event e = Event.current;
        currentMousePosition = e.mousePosition;
        Rect rectWindow = new Rect(0f,0f,position.width,position.height);
        mouseOverElement = (int)ElementType.None;
        //bool wasDragging = false;
        if (e.type == EventType.mouseDrag && EditorWindow.mouseOverWindow==this) {
            isDragging = true;
        }else if (e.type == EventType.mouseUp || /*EditorWindow.mouseOverWindow!=this*/Event.current.rawType == EventType.MouseUp /*|| e.mousePosition.y < 0f*/) {
            if(isDragging) {
                //wasDragging = true;
                isDragging = false;
            }
        }
        // set cursor
        if(dragType == (int)DragType.ResizeInspector) EditorGUIUtility.AddCursorRect(rectWindow,MouseCursor.ResizeHorizontal);
        #endregion
        #region resize inspector
            if(dragType == (int)DragType.ResizeInspector) {
                width_inspector_open = start_width_inspector_open+(startScrubMousePosition.x-e.mousePosition.x);
            }
        width_inspector_open = Mathf.Clamp(width_inspector_open,width_inspector_open_min,position.width-width_code_min);
        #endregion
        GUILayout.BeginHorizontal();
            #region code vertical
            GUILayout.BeginVertical(GUILayout.Height(position.height));
                    GUILayout.Space(3f);
                    if(aData.setCodeLanguage(GUILayout.SelectionGrid(aData.codeLanguage,selStrings,2/*,styleSelGrid*/))) {
                        // save data
                        EditorUtility.SetDirty(aData);
                        refreshCode();
                    }
                    GUILayout.Space(3f);
                    // set scrollview background
                    GUIStyle styleScrollView = new GUIStyle(GUI.skin.scrollView);
                    styleScrollView.normal.background = GUI.skin.GetStyle("GroupElementBG").onNormal.background;
                    scrollView = EditorGUILayout.BeginScrollView(scrollView,false,false,GUI.skin.horizontalScrollbar,GUI.skin.verticalScrollbar,styleScrollView);
                        Vector2 textSize = textStyle.CalcSize(new GUIContent(codeCache));
                        GUILayout.BeginHorizontal();
                            GUILayout.Space(10f);
                            EditorGUILayout.SelectableLabel(codeCache,textStyle,GUILayout.ExpandHeight(true),GUILayout.ExpandWidth(true),GUILayout.MinWidth(textSize.x+30f),GUILayout.MinHeight(textSize.y+30f));
                        GUILayout.EndHorizontal();
                    EditorGUILayout.EndScrollView();
                    GUILayout.Space(3f);
                    GUILayout.BeginHorizontal();
                        // refresh button
                        if(shouldRefresh) GUI.color = Color.green;
                        if(GUILayout.Button(""/*,styleButton*/)) {
                            refreshCode();
                        }
                        GUI.color = Color.white;
                        GUI.Label(GUILayoutUtility.GetLastRect(),"Refresh", styleLabelCentered);
                        // copy to clipboard button
                        if(GUILayout.Button("Copy to Clipboard")) {
                            ClipboardHelper.clipBoard = codeCache;
                            GUIUtility.keyboardControl = 0;
                            GUIUtility.hotControl = 0;
                        }
                    GUILayout.EndHorizontal();
                    GUILayout.Space(3f);
            GUILayout.EndVertical();
            #endregion
            #region track list vertical
            GUILayout.BeginHorizontal(GUILayout.Width((isInspectorOpen ? width_inspector_open : width_inspector_closed)));
                //if(GUILayout.Button("O/C",GUILayout.Width(width_inspector_closed),GUILayout.Height(position.height))) {
                    //isInspectorOpen = !isInspectorOpen;
                //}
                // properties button
                GUILayout.BeginVertical(GUILayout.Width(width_inspector_closed));
                    GUILayout.Space (width_inspector_closed);
                    Rect rectPropertiesButton = new Rect(position.width-(isInspectorOpen ? width_inspector_open : width_inspector_closed)-1f,0f,width_inspector_closed,position.height-28f);
                    if(GUI.Button(rectPropertiesButton, "","label")) {
                        isInspectorOpen = !isInspectorOpen;
                    }
                    GUI.color = AMTimeline.getSkinTextureStyleState("properties_bg").textColor;
                    GUI.DrawTexture(rectPropertiesButton,AMTimeline.getSkinTextureStyleState("properties_bg").background);
                    GUI.color = Color.white;
                    GUI.DrawTexture(new Rect(rectPropertiesButton.x+8f + (isInspectorOpen ? 1f : 0f), 12f,22f,19f),(isInspectorOpen ? texRightArrow : texLeftArrow));
                    if(!isInspectorOpen) {
                        int numSelected  = 0;
                        foreach(var pair in dictTracks) if(pair.Value == true) numSelected++;
                        if(numSelected < dictTracks.Count) GUI.color = Color.red;
                        GUI.Label(new Rect(rectPropertiesButton.x,rectPropertiesButton.y+rectPropertiesButton.height,rectPropertiesButton.width,28f), numSelected+"/"+dictTracks.Count, styleLabelCentered);
                        GUI.color = Color.white;
                    }
                GUILayout.EndVertical();
                if(isInspectorOpen) {
                    GUILayout.BeginVertical(GUILayout.Width(width_inspector_open-width_inspector_closed));
                        GUILayout.Space(inspector_space);
                        GUILayout.Label("Track Selection");
                        GUILayout.Space(inspector_space);
                        GUILayout.BeginHorizontal();
                            //GUILayout.Space(inspector_space);
                            scrollPos = EditorGUILayout.BeginScrollView(scrollPos/*,styleScrollView*/);
                                for(int i=0;i<aData.getCurrentTake().rootGroup.elements.Count;i++) {
                                    int id = aData.getCurrentTake().rootGroup.elements[i];
                                    //float height_group_elements = 0f;
                                    showGroupElement(id,0);
                                }
                            GUILayout.EndScrollView();
                            GUILayout.Space(inspector_space);
                        GUILayout.EndHorizontal();
                        // buttons
                        GUILayout.Space(inspector_space);
                        GUILayout.BeginHorizontal();
                        Rect rectResizeInspector = new Rect(rectPropertiesButton.x,position.height-15f-8f,15f,15f);
                        GUI.Button(rectResizeInspector,"",GUI.skin.GetStyle("ResizeTrackThumb"));
                        EditorGUIUtility.AddCursorRect(rectResizeInspector,MouseCursor.ResizeHorizontal);
                        if(rectResizeInspector.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
                            mouseOverElement = (int)ElementType.ResizeInspector;
                        }

                        if(GUILayout.Button("All",GUILayout.Width(42f))) {
                            foreach(var key in dictTracks.Keys.ToList()) {
                                dictTracks[key] = true;
                            }
                            refreshCode();
                        }
                        if(GUILayout.Button("None",GUILayout.Width(42f))) {
                            foreach(var key in dictTracks.Keys.ToList()) {
                                dictTracks[key] = false;
                            }
                            refreshCode();
                        }
                        GUILayout.FlexibleSpace();
                        if(GUILayout.Button("JSON...",GUILayout.Width(58f))) {
                            // export json
                            exportJSON();
                        }
                        GUILayout.EndHorizontal();
                        GUILayout.Space(inspector_space);
                    GUILayout.EndVertical();
                }
            GUILayout.EndHorizontal();
            #endregion
        GUILayout.EndHorizontal();
    }
示例#20
0
    void OnEnable()
    {
        window = this;
        #if UNITY_5
        titleContent = new GUIContent("Settings");
        #else
        title = "Settings";
        #endif
        minSize = new Vector2(280f, 190f);
        //maxSize = this.minSize;

        oData = AMOptionsFile.loadFile();
        loadAnimatorData();
    }
示例#21
0
    void OnEnable()
    {
        window = this;
        this.title = "Options";
        this.minSize = new Vector2(545f,365f);
        this.maxSize = new Vector2(1000f,this.minSize.y);

        loadAnimatorData();
        oData = AMOptionsFile.loadFile();
        // setup skin popup
        skinIndex = 0;
        for(int i=1;i<skin_ids.Length;i++) {
            if(skin_ids[i] == oData.skin) {
                skinIndex = i;
                break;
            }
        }

        if(aData) exportTakeIndex = aData.getTakeIndex(aData.getCurrentTake());
    }
示例#22
0
    void OnEnable()
    {
        window = this;
        #if UNITY_5
        titleContent = new GUIContent("Options");
        #else
        title = "Options";
        #endif
        minSize = new Vector2(545f, 365f);
        maxSize = new Vector2(1000f, this.minSize.y);

        loadAnimatorData();
        oData = AMOptionsFile.loadFile();

        //if(aData) exportTakeIndex = aData.GetTakeIndex(AMTimeline.window.currentTake);
    }
示例#23
0
 public static void loadSkin(AMOptionsFile oData, ref GUISkin _skin, ref string skinName, Rect position)
 {
     if(_skin == null || skinName == null || skinName != oData.skin/*global_skin*/) {
         //
         _skin = (GUISkin)AMEditorResource.LoadSkin(oData.skin); /*global_skin*/
         skinName = oData.skin/*global_skin*/;
     }
     GUI.skin = _skin;
     GUI.color = GUI.skin.window.normal.textColor;
     GUI.DrawTexture(new Rect(0f, 0f, position.width, position.height), EditorGUIUtility.whiteTexture);
     GUI.color = Color.white;
 }
示例#24
0
    void OnGUI()
    {
        /*if(Event.current.type != EventType.Repaint && Event.current.type != EventType.Layout) {
            Debug.Log("event type: " + Event.current.type);
        }*/
        if(!oData) {
            oData = AMOptionsFile.loadFile();
        }

        AMTimeline.loadSkin(oData, ref skin, ref cachedSkinName, position);
        if(EditorApplication.isPlayingOrWillChangePlaymode) {
            this.ShowNotification(new GUIContent("Play Mode"));
            return;
        }
        if(EditorApplication.isCompiling) {
            this.ShowNotification(new GUIContent("Code Compiling"));
            return;
        }
        #region no data component
        if(!aData) {
            // recheck for component
            GameObject go = Selection.activeGameObject;
            if(go) {
                if(PrefabUtility.GetPrefabType(go) != PrefabType.Prefab) {
                    aData = go.GetComponent<AnimatorData>();
                }
                else
                    go = null;
            }
            if(!aData) {
                // no data component message
                if(go)
                    MessageBox("Animator requires an AnimatorData component in your game object.", MessageBoxType.Info);
                else
                    MessageBox("Animator requires an AnimatorData in scene.", MessageBoxType.Info);

                if(GUILayout.Button(go ? "Add Component" : "Create AnimatorData")) {
                    // create component
                    if(!go) go = new GameObject("AnimatorData");
                    aData = go.AddComponent<AnimatorData>();
                }
            }

            if(!aData) //still no data
                return;
        }
        /*else {
            if(!aData.CheckNulls()) {
                aData = null;
                Repaint();
                return;
            }
        }*/

        if(!aData.getCurrentTake()) { Repaint(); return; } //????

        //retain animator open, this is mostly when recompiling AnimatorData
        aData.isAnimatorOpen = true;

        #endregion
        #region window resize
        if(!oData.ignoreMinSize && (position.width < width_window_minimum)) {
            MessageBox("Window is too small! Animator requires a width of at least " + width_window_minimum + " pixels to function correctly.", MessageBoxType.Warning);
            GUILayout.BeginHorizontal();
            if(GUILayout.Button("Ignore (Not Recommended)")) {
                oData.ignoreMinSize = true;
                // save
                EditorUtility.SetDirty(aData);
                // repaint
                this.Repaint();
            }
            if(GUILayout.Button("Resize")) {
                Rect rectDimensions = position;
                rectDimensions.width = width_window_minimum + 1f;
                position = rectDimensions;
                GUIUtility.ExitGUI();
            }

            GUILayout.EndHorizontal();
            return;
        }
        #endregion

        if(tickerSpeed <= 0) tickerSpeed = 1;
        ticker = (ticker + 1) % tickerSpeed;
        EditorGUIUtility.LookLikeControls();
        // reset mouse over element
        mouseOverElement = (int)ElementType.None;
        mouseOverFrame = 0;
        mouseXOverFrame = 0;
        mouseOverTrack = -1;
        mouseOverGroupElement = new Vector2(0, 0);
        tooltip = "";
        int difference = 0;

        //if(oData.disableTimelineActions) current_height_frame = height_track;
        //else current_height_frame = height_frame;
        if(oData.disableTimelineActions) height_action_min = 0f;
        else height_action_min = 45f;

        #region temporary variables
        Rect rectWindow = new Rect(0f, 0f, position.width, position.height);
        Event e = Event.current;
        // get global mouseposition
        Vector2 globalMousePosition = getGlobalMousePosition(e);
        // resize track
        if(dragType == (int)DragType.ResizeTrack) {
            aData.width_track = startResize_width_track + e.mousePosition.x - startScrubMousePosition.x;
        }
        width_track = Mathf.Clamp(aData.width_track, width_track_min, position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - width_playback_controls - 70f);
        if(aData.width_track != width_track) aData.width_track = width_track;

        bool compact = ((oData.ignoreMinSize) && (position.width < width_window_minimum)); // when true, display compact GUI
        currentMousePosition = e.mousePosition;
        bool clickedZoom = false;
        #endregion
        #region drag logic events
        bool wasDragging = false;
        if(e.type == EventType.mouseDrag && EditorWindow.mouseOverWindow == this) {
            isDragging = true;
        }
        else if((dragType == (int)DragType.CursorZoom && EditorWindow.mouseOverWindow != this) || e.type == EventType.mouseUp || /*EditorWindow.mouseOverWindow!=this*/Event.current.rawType == EventType.MouseUp /*|| e.mousePosition.y < 0f*/) {
            if(isDragging) {
                wasDragging = true;
                isDragging = false;
            }
        }
        #endregion
        #region keyboard events
        if(e.Equals(Event.KeyboardEvent("[enter]")) || e.Equals(Event.KeyboardEvent("return"))) {
            // apply renaming when pressing enter
            cancelTextEditting();
            if(isChangingTimeControl) isChangingTimeControl = false;
            if(isChangingFrameControl) isChangingFrameControl = false;
            // deselect keyboard focus
            GUIUtility.keyboardControl = 0;
            GUIUtility.ExitGUI();
        }
        // check if control or shift are down
        isControlDown = e.control || e.command;
        isShiftDown = e.shift;
        if(e.type == EventType.keyDown && e.keyCode == KeyCode.Space) isSpaceBarDown = true;
        else if(e.type == EventType.keyUp && e.keyCode == KeyCode.Space) isSpaceBarDown = false;
        #endregion
        #region set cursor
        int customCursor = (int)CursorType.None;
        bool showCursor = true;
        if(!isRenamingTake && isRenamingGroup >= 0 && isRenamingTrack <= -1 && (dragType == (int)DragType.CursorHand || (!cursorZoom && isSpaceBarDown && EditorWindow.mouseOverWindow == this))) {
            cursorHand = true;
            showCursor = false;
            customCursor = (int)CursorType.Hand;
            mouseOverElement = (int)ElementType.CursorHand;
            // unused button to catch clicks
            GUI.Button(rectWindow, "", "label");
        }
        else if(dragType == (int)DragType.CursorZoom || (!cursorHand && e.alt && EditorWindow.mouseOverWindow == this)) {
            cursorZoom = true;
            showCursor = false;
            customCursor = (int)CursorType.Zoom;
            if(!isDragging) {
                if(isControlDown) tex_cursor_zoom = tex_cursor_zoomout;
                else tex_cursor_zoom = tex_cursor_zoomin;
            }
            mouseOverElement = (int)ElementType.CursorZoom;
            if(!wasDragging) {
                if(GUI.Button(rectWindow, "", "label")) {
                    if(isControlDown) {
                        if(aData.zoom < 1f) {
                            aData.zoom += 0.2f;
                            if(aData.zoom > 1f) aData.zoom = 1f;
                            clickedZoom = true;
                        }
                    }
                    else {
                        if(aData.zoom > 0f) {
                            aData.zoom -= 0.2f;
                            if(aData.zoom < 0f) aData.zoom = 0f;
                            clickedZoom = true;
                        }
                    }

                }
            }
        }
        else {
            if(!showCursor) showCursor = true;
            cursorHand = false;
            cursorZoom = false;
        }
        if(Screen.showCursor != showCursor) {
            Screen.showCursor = showCursor;
        }
        if(isRenamingTake || isRenamingTrack != -1 || isRenamingGroup < 0) EditorGUIUtility.AddCursorRect(rectWindow, MouseCursor.Text);
        else if(dragType == (int)DragType.TimeScrub || dragType == (int)DragType.FrameScrub || dragType == (int)DragType.MoveSelection) EditorGUIUtility.AddCursorRect(rectWindow, MouseCursor.SlideArrow);
        else if(dragType == (int)DragType.ResizeTrack || dragType == (int)DragType.ResizeAction || dragType == (int)DragType.ResizeHScrollbarLeft || dragType == (int)DragType.ResizeHScrollbarRight) EditorGUIUtility.AddCursorRect(rectWindow, MouseCursor.ResizeHorizontal);
        #endregion
        #region calculations
        processHandDragAcceleration();
        // calculate number of frames to render
        calculateNumFramesToRender(clickedZoom, e);
        //current_height_frame = (oData.disableTimelineActions ? height_track : height_frame);
        // if is playing, disable all gui elements
        GUI.enabled = !(isPlaying);
        // if selected frame is out of range
        if(aData.getCurrentTake().selectedFrame > aData.getCurrentTake().numFrames) {
            // select last frame
            timelineSelectFrame(aData.getCurrentTake().selectedTrack, aData.getCurrentTake().numFrames);
        }
        // get number of tracks in current take, use for tracks and keys, disabling zoom slider
        int trackCount = aData.getCurrentTake().getTrackCount();
        #endregion
        #region menu bar
        GUIStyle styleLabelMenu = new GUIStyle(EditorStyles.toolbarButton);
        styleLabelMenu.normal.background = null;
        //GUI.color = new Color(190f/255f,190f/255f,190f/255f,1f);
        GUI.DrawTexture(new Rect(0f, 0f, position.width, height_menu_bar - 2f), EditorStyles.toolbar.normal.background);
        //GUI.color = Color.white;
        #region select name
        GUIContent selectLabel = new GUIContent(aData.gameObject.name);
        Vector2 selectLabelSize = EditorStyles.toolbarButton.CalcSize(selectLabel);
        Rect rectSelectLabel = new Rect(margin, 0f, selectLabelSize.x, height_button_delete);

        if(GUI.Button(rectSelectLabel, selectLabel, EditorStyles.toolbarButton)) {
            EditorGUIUtility.PingObject(aData.gameObject);
        }
        #endregion

        #region options button
        Rect rectBtnOptions = new Rect(rectSelectLabel.x + rectSelectLabel.width + margin, 0f, 60f, height_button_delete);
        if(GUI.Button(rectBtnOptions, "Options", EditorStyles.toolbarButton)) {
            EditorWindow windowOptions = ScriptableObject.CreateInstance<AMOptions>();
            //windowOptions.Show();
            windowOptions.ShowUtility();
            //EditorWindow.GetWindow (typeof (AMOptions));
        }
        if(rectBtnOptions.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) mouseOverElement = (int)ElementType.Button;
        #endregion
        #region refresh button
        bool doRefresh = false;
        Rect rectBtnCodeView = new Rect(rectBtnOptions.x + rectBtnOptions.width + margin, rectBtnOptions.y, 80f, rectBtnOptions.height);
        if(GUI.Button(rectBtnCodeView, "Refresh", EditorStyles.toolbarButton)) {
            //EditorWindow.GetWindow(typeof(AMCodeView));
            doRefresh = true;
        }
        if(rectBtnCodeView.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Button;
        }
        #endregion
        #region take popup, change take or create new take
        Rect rectLabelCurrentTake = new Rect(rectBtnCodeView.x, rectBtnCodeView.y, rectBtnCodeView.width, rectBtnCodeView.height);
        if(!compact) {
            rectLabelCurrentTake = new Rect(rectBtnCodeView.x + rectBtnCodeView.width + margin, rectBtnCodeView.y, 80f, rectBtnCodeView.height);
            GUI.Label(rectLabelCurrentTake, "Current Take:", styleLabelMenu);
        }
        Rect rectTakePopup = new Rect(rectLabelCurrentTake.x + rectLabelCurrentTake.width + margin, rectLabelCurrentTake.y/*+3f*/, width_take_popup, 20f);
        // if renaming take, show textfield
        if(isRenamingTake) {
            GUI.SetNextControlName("RenameTake");
            Rect rectRenameTake = new Rect(rectTakePopup);
            rectRenameTake.x += 4f;
            rectRenameTake.width -= 4f;
            rectRenameTake.y += 3f;
            aData.getCurrentTake().name = GUI.TextField(rectRenameTake, aData.getCurrentTake().name, EditorStyles.toolbarTextField);
            GUI.FocusControl("RenameTake");
        }
        else {
            // show popup
            if(aData.setCurrentTakeValue(EditorGUI.Popup(rectTakePopup, aData.currentTake, aData.getTakeNames(), EditorStyles.toolbarPopup))) {
                // take changed

                // reset code view dictionaries
                AMCodeView.resetTrackDictionary();
                // if not creating new take
                if(aData.currentTake < aData.takes.Count) {
                    // select current frame
                    timelineSelectFrame(aData.getCurrentTake().selectedTrack, aData.getCurrentTake().selectedFrame);
                    // save data
                    EditorUtility.SetDirty(aData);
                }
            }
        }
        #endregion
        #region rename take button
        Texture texRenameTake;
        if(isRenamingTake) texRenameTake = getSkinTextureStyleState("accept").background;
        else texRenameTake = getSkinTextureStyleState("rename").background;
        Rect rectBtnRenameTake = new Rect(rectTakePopup.x + rectTakePopup.width + margin, rectLabelCurrentTake.y, width_button_delete, height_button_delete);
        // button
        if(GUI.Button(rectBtnRenameTake, new GUIContent(texRenameTake, (isRenamingTake ? "Accept" : "Rename Take")),/*GUI.skin.GetStyle("ButtonImage")*/EditorStyles.toolbarButton)) {
            if(!isRenamingTake) Undo.RecordObject(aData.getCurrentTake(), "Rename Take");
            GUIUtility.keyboardControl = 0;
            cancelTextEditting(true);	// toggle isRenamingTake
            EditorUtility.SetDirty(aData.getCurrentTake());
        }
        if(rectBtnRenameTake.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) mouseOverElement = (int)ElementType.Button;
        #endregion
        #region delete take button
        Rect rectBtnDeleteTake = new Rect(rectBtnRenameTake.x + rectBtnRenameTake.width + margin, rectBtnRenameTake.y, width_button_delete, height_button_delete);
        if(GUI.Button(rectBtnDeleteTake, new GUIContent("", "Delete Take"),/*GUI.skin.GetStyle("ButtonImage")*/EditorStyles.toolbarButton)) {
            AMTake take = aData.getCurrentTake();

            if((EditorUtility.DisplayDialog("Delete Take", "Are you sure you want to delete take '" + take.name + "'?", "Delete", "Cancel"))) {
                string label = "Delete Take: "+take.name;
                Undo.RegisterCompleteObjectUndo(aData, label);

                if(aData.takes.Count == 1) {
                    Undo.RecordObject(take, label);

                    MonoBehaviour[] behaviours = getKeysAndTracks(take);

                    //just delete the tracks and keys
                    foreach(MonoBehaviour b in behaviours)
                        Undo.DestroyObjectImmediate(b);

                    take.RevertToDefault();

                    EditorUtility.SetDirty(take);
                }
                else {
                    if(take == aData.playOnStart)
                        aData.playOnStart = null;

                    if(aData.currentTake > 0)
                        aData.currentTake--;

                    List<AMTake> nTakes = new List<AMTake>(aData.takes);
                    nTakes.Remove(take);
                    aData.takes = nTakes;

                    MonoBehaviour[] behaviours = getKeysAndTracks(take);
                    foreach(MonoBehaviour b in behaviours)
                        Undo.DestroyObjectImmediate(b);

                    Undo.DestroyObjectImmediate(take);
                }

                AMCodeView.resetTrackDictionary();
                // save data
                EditorUtility.SetDirty(aData);
            }
        }
        if(!GUI.enabled) GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.25f);
        GUI.DrawTexture(new Rect(rectBtnDeleteTake.x + (rectBtnDeleteTake.height - 10f) / 2f, rectBtnDeleteTake.y + (rectBtnDeleteTake.width - 10f) / 2f - 2f, 10f, 10f), (getSkinTextureStyleState((GUI.enabled && rectBtnDeleteTake.Contains(e.mousePosition) ? "delete_hover" : "delete")).background));
        if(rectBtnDeleteTake.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) mouseOverElement = (int)ElementType.Button;
        if(GUI.color.a < 1f) GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 1f);
        #endregion
        #region Create/Duplicate Take
        if(aData.currentTake == aData.takes.Count) {
            isRenamingTake = false;
            cancelTextEditting();

            aData.currentTake = aData.takes.Count - 1; // decrement for undo

            string label = "New Take";

            Undo.RecordObject(aData, label);

            aData.currentTake = aData.takes.Count;

            AMTake newTake = aData.addTake();
            Undo.RegisterCreatedObjectUndo(newTake, label);

            // save data
            EditorUtility.SetDirty(aData);
            // refresh component
            refreshGizmos();
        }
        else if(aData.currentTake == aData.takes.Count + 1) {
            isRenamingTake = false;
            cancelTextEditting();

            aData.currentTake = aData.takes.Count - 1; // decrement for undo

            string label = "New Duplicate Take";

            Undo.RecordObject(aData, label);

            AMTake prevTake = aData.getPreviousTake(); //if(takes == null || currentTake >= takes.Count) return null;

            if(prevTake != null) {
                List<UnityEngine.Object> ret = aData.duplicateTake(prevTake);
                foreach(UnityEngine.Object newObj in ret)
                    Undo.RegisterCreatedObjectUndo(newObj, label);
            }
            else {
                AMTake newTake = aData.addTake();
                Undo.RegisterCreatedObjectUndo(newTake, label);
            }

            aData.currentTake = aData.takes.Count - 1;

            // save data
            EditorUtility.SetDirty(aData);
        }
        #endregion
        #region play on start button
        Rect rectBtnPlayOnStart = new Rect(rectBtnDeleteTake.x + rectBtnDeleteTake.width + margin, rectBtnDeleteTake.y, width_button_delete, height_button_delete);
        bool isPlayOnStart = aData.playOnStart == aData.getCurrentTake();
        GUIStyle styleBtnPlayOnStart = new GUIStyle(/*GUI.skin.GetStyle("ButtonImage")*/EditorStyles.toolbarButton);
        if(isPlayOnStart) {
            styleBtnPlayOnStart.normal.background = styleBtnPlayOnStart.onNormal.background;
            styleBtnPlayOnStart.hover.background = styleBtnPlayOnStart.onNormal.background;
        }
        if(GUI.Button(rectBtnPlayOnStart, new GUIContent(getSkinTextureStyleState("playonstart").background, "Play On Start"), styleBtnPlayOnStart)) {
            if(!isPlayOnStart) aData.playOnStart = aData.getCurrentTake();
            else aData.playOnStart = null;
            EditorUtility.SetDirty(aData);
        }
        #endregion
        #region settings
        Rect rectLabelSettings = new Rect(rectBtnPlayOnStart.x + rectBtnPlayOnStart.width + margin, rectBtnPlayOnStart.y, 200f, rectLabelCurrentTake.height);

        if(compact) {
            rectLabelSettings.width = GUI.skin.label.CalcSize(new GUIContent("Settings")).x;
            GUI.Label(rectLabelSettings, "Settings", styleLabelMenu);
        }
        else {
            string strSettings = "Settings: " + aData.getCurrentTake().numFrames + " Frames; " + aData.getCurrentTake().frameRate + " Fps";
            rectLabelSettings.width = GUI.skin.label.CalcSize(new GUIContent(strSettings)).x;
            GUI.Label(rectLabelSettings, strSettings, styleLabelMenu);
        }
        Rect rectBtnModify = new Rect(rectLabelSettings.x + rectLabelSettings.width + margin, rectLabelSettings.y, 60f, rectBtnOptions.height);
        if(GUI.Button(rectBtnModify, "Modify", EditorStyles.toolbarButton)) {
            EditorWindow windowSettings = ScriptableObject.CreateInstance<AMSettings>();
            windowSettings.ShowUtility();
        }
        if(rectBtnModify.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) mouseOverElement = (int)ElementType.Button;
        #endregion
        #region zoom slider
        if(trackCount <= 0) GUI.enabled = false;	// disable slider if there are no tracks
        // adjust zoom slider width
        float width_zoom_slider_dynamic = Mathf.Clamp(position.width - (rectBtnModify.x + rectBtnModify.width) - margin - 25f, 0f, 250f);
        Rect rectZoomSlider = new Rect(position.width - 25f - width_zoom_slider_dynamic + 5f, rectBtnModify.y, width_zoom_slider_dynamic - 5f, 20f);
        if(dragType != (int)DragType.CursorZoom) aData.zoom = GUI.HorizontalSlider(rectZoomSlider, aData.zoom, 1f, 0f);
        else GUI.HorizontalSlider(rectZoomSlider, aData.zoom, 1f, 0f);
        if(rectZoomSlider.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Other;
        }
        GUI.enabled = !isPlaying;

        bool birdseye = (current_width_frame <= width_frame_birdseye_min ? true : false);
        // show or hide zoom texture
        if(position.width > 788 || (compact)) {
            GUI.DrawTexture(new Rect(position.width - 25f, 0f, 20f, 20f), getSkinTextureStyleState("zoom").background);
        }
        #endregion
        #endregion
        #region control bar
        #region auto-key button
        GUIStyle styleBtnAutoKey = new GUIStyle(GUI.skin.button);
        styleBtnAutoKey.clipping = TextClipping.Overflow;
        if(aData.autoKey) {
            styleBtnAutoKey.normal.background = GUI.skin.button.active.background;
            styleBtnAutoKey.normal.textColor = Color.red;
            styleBtnAutoKey.hover.background = GUI.skin.button.active.background;
            styleBtnAutoKey.hover.textColor = Color.red;
        }
        Rect rectBtnAutoKey = new Rect(margin, height_menu_bar + margin, 40f, 15f);
        if(GUI.Button(rectBtnAutoKey, new GUIContent("Auto", "Auto-Key"), styleBtnAutoKey)) aData.autoKey = !aData.autoKey;
        if(rectBtnAutoKey.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) mouseOverElement = (int)ElementType.Button;
        #endregion
        if(trackCount <= 0 || aData.getCurrentTake().selectedTrack == -1) GUI.enabled = false;	// disable key controls if there are no tracks
        #region select previous key
        Rect rectBtnPrevKey = new Rect(rectBtnAutoKey.x + rectBtnAutoKey.width + margin, rectBtnAutoKey.y, 30f, 15f);
        if(GUI.Button(rectBtnPrevKey, new GUIContent((getSkinTextureStyleState("prev_key").background), "Prev. Key"), GUI.skin.GetStyle("ButtonImage"))) {
            timelineSelectPrevKey();
        }
        if(rectBtnPrevKey.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) mouseOverElement = (int)ElementType.Button;
        #endregion
        # region insert key
        Rect rectBtnInsertKey = new Rect(rectBtnPrevKey.x + rectBtnPrevKey.width + margin, rectBtnPrevKey.y, 23f, 15f);
        if(GUI.Button(rectBtnInsertKey, new GUIContent("K", "Insert Key"))) {
            addKeyToSelectedFrame();
        }
        if(rectBtnInsertKey.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) mouseOverElement = (int)ElementType.Button;
        #endregion
        #region select next key
        Rect rectBtnNextKey = new Rect(rectBtnInsertKey.x + rectBtnInsertKey.width + margin, rectBtnInsertKey.y, 30f, 15f);
        if(GUI.Button(rectBtnNextKey, new GUIContent((getSkinTextureStyleState("next_key").background), "Next Key"), GUI.skin.GetStyle("ButtonImage"))) {
            timelineSelectNextKey();
        }
        if(rectBtnNextKey.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) mouseOverElement = (int)ElementType.Button;
        #endregion
        GUI.enabled = !isPlaying;
        #endregion
        #region playback controls
        Rect rectAreaPlaybackControls = new Rect(0f, position.height - height_indicator_footer, width_track + width_playback_controls, height_playback_controls);
        GUI.BeginGroup(rectAreaPlaybackControls);
        #region new track button
        Rect rectNewTrack = new Rect(5f, height_indicator_footer / 2f - 15f / 2f, 15f, 15f);
        Rect rectBtnNewTrack = new Rect(rectNewTrack.x, 0f, rectNewTrack.width, height_indicator_footer);
        if(GUI.Button(rectBtnNewTrack, new GUIContent("", "New Track"), "label")) {
            if(objects_window.Count > 0) objects_window = new List<GameObject>();
            if(menu.GetItemCount() <= 0) buildAddTrackMenu();
            menu.ShowAsContext();
        }
        GUI.DrawTexture(rectNewTrack, (rectBtnNewTrack.Contains(e.mousePosition) ? tex_icon_track_hover : tex_icon_track));
        if(rectBtnNewTrack.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Button;
        }
        #endregion
        #region new group button
        Rect rectNewGroup = new Rect(rectNewTrack.x + rectNewTrack.width + 5f, height_indicator_footer / 2f - 15f / 2f, 15f, 15f);
        Rect rectBtnNewGroup = new Rect(rectNewGroup.x, 0f, rectNewGroup.width, height_indicator_footer);
        if(GUI.Button(rectBtnNewGroup, new GUIContent("", "New Group"), "label")) {
            Undo.RecordObject(aData.getCurrentTake(), "New Group");
            cancelTextEditting();
            aData.getCurrentTake().addGroup();
            EditorUtility.SetDirty(aData.getCurrentTake());
            setScrollViewValue(maxScrollView());
        }
        GUI.DrawTexture(rectNewGroup, (rectBtnNewGroup.Contains(e.mousePosition) ? tex_icon_group_hover : tex_icon_group_closed));
        if(rectBtnNewGroup.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Button;
        }
        #endregion
        #region delete track button
        Rect rectDeleteElement = new Rect(rectNewGroup.x + rectNewGroup.width + 5f + 1f, height_indicator_footer / 2f - 11f / 2f, 11f, 11f);
        Rect rectBtnDeleteElement = new Rect(rectDeleteElement.x, 0f, rectDeleteElement.width, height_indicator_footer);
        if(aData.getCurrentTake().selectedGroup >= 0) GUI.enabled = false;
        if(aData.getCurrentTake().selectedGroup >= 0 && (trackCount <= 0 || (aData.getCurrentTake().contextSelectionTracks != null && aData.getCurrentTake().contextSelectionTracks.Count <= 0))) GUI.enabled = false;
        else GUI.enabled = !isPlaying;
        if(!GUI.enabled) GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.25f);
        GUIContent gcDeleteButton;
        string strTitleDeleteTrack = (aData.getCurrentTake().contextSelectionTracks != null && aData.getCurrentTake().contextSelectionTracks.Count > 1 ? "Tracks" : "Track");
        if(!GUI.enabled) gcDeleteButton = new GUIContent("");
        else gcDeleteButton = new GUIContent("", "Delete " + (aData.getCurrentTake().contextSelectionTracks != null && aData.getCurrentTake().contextSelectionTracks.Count > 0 ? strTitleDeleteTrack : "Group"));
        if(GUI.Button(rectBtnDeleteElement, gcDeleteButton, "label")) {
            cancelTextEditting();
            if(aData.getCurrentTake().contextSelectionTracks.Count > 0) {
                string strMsgDeleteTrack = (aData.getCurrentTake().contextSelectionTracks.Count > 1 ? "multiple tracks" : "track '" + aData.getCurrentTake().getSelectedTrack().name + "'");

                if((EditorUtility.DisplayDialog("Delete " + strTitleDeleteTrack, "Are you sure you want to delete " + strMsgDeleteTrack + "?", "Delete", "Cancel"))) {
                    isRenamingTrack = -1;

                    AMTake curTake = aData.getCurrentTake();

                    Undo.RegisterCompleteObjectUndo(curTake, "Delete Track");

                    List<MonoBehaviour> items = new List<MonoBehaviour>();

                    foreach(int track_id in curTake.contextSelectionTracks) {
                        curTake.deleteTrack(track_id, true, ref items);
                    }

                    foreach(MonoBehaviour item in items)
                        Undo.DestroyObjectImmediate(item);

                    curTake.contextSelectionTracks = new List<int>();

                    // deselect track
                    curTake.selectedTrack = -1;
                    // deselect group
                    curTake.selectedGroup = 0;

                    // save data
                    EditorUtility.SetDirty(curTake);

                    AMCodeView.refresh();
                }
            }
            else {
                bool delete = true;
                bool deleteContents = false;
                AMTake take = aData.getCurrentTake();
                AMGroup grp = take.getGroup(take.selectedGroup);
                List<MonoBehaviour> items = null;

                if(grp.elements.Count > 0) {
                    int choice = EditorUtility.DisplayDialogComplex("Delete Contents?", "'" + grp.group_name + "' contains contents that can be deleted with the group.", "Delete Contents", "Keep Contents", "Cancel");
                    if(choice == 2) delete = false;
                    else if(choice == 0) deleteContents = true;
                    if(delete) {
                        if(deleteContents) {
                            Undo.RegisterCompleteObjectUndo(take, "Delete Group");

                            items = new List<MonoBehaviour>();
                            take.deleteSelectedGroup(true, ref items);

                            foreach(MonoBehaviour item in items)
                                Undo.DestroyObjectImmediate(item);
                        }
                        else {
                            Undo.RecordObject(take, "Delete Group");

                            take.deleteSelectedGroup(false, ref items);
                        }

                        EditorUtility.SetDirty(take);
                        AMCodeView.refresh();
                    }
                }
                else { //no tracks inside group
                    Undo.RecordObject(take, "Delete Group");
                    aData.getCurrentTake().deleteSelectedGroup(false, ref items);
                }
            }
        }
        GUI.DrawTexture(rectDeleteElement, (getSkinTextureStyleState((GUI.enabled && rectBtnDeleteElement.Contains(e.mousePosition) ? "delete_hover" : "delete")).background));
        if(rectBtnDeleteElement.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Button;
        }
        if(GUI.color.a < 1f) GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 1f);
        GUI.enabled = !isPlaying;
        #endregion
        #region resize track
        Rect rectResizeTrack = new Rect(width_track - 5f - 10f, height_indicator_footer / 2f - 10f / 2f - 4f, 15f, 15f);
        GUI.Button(rectResizeTrack, "", GUI.skin.GetStyle("ResizeTrackThumb"));
        if(rectResizeTrack.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.ResizeTrack;
        }
        if(GUI.enabled) EditorGUIUtility.AddCursorRect(rectResizeTrack, MouseCursor.ResizeHorizontal);
        GUI.enabled = (aData.getCurrentTake().rootGroup != null && aData.getCurrentTake().rootGroup.elements.Count > 0 ? !isPlaying : false);
        #endregion
        #region select first frame button
        Rect rectBtnSkipBack = new Rect(width_track + margin, margin, 32f, height_playback_controls - margin * 2);
        if(GUI.Button(rectBtnSkipBack, getSkinTextureStyleState("nav_skip_back").background, GUI.skin.GetStyle("ButtonImage"))) timelineSelectFrame(aData.getCurrentTake().selectedTrack, 1);
        if(rectBtnSkipBack.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Button;
        }
        #endregion
        #region toggle play button
        // change label if already playing
        Texture playToggleTexture;
        if(isPlaying) playToggleTexture = getSkinTextureStyleState("nav_stop").background;
        else playToggleTexture = getSkinTextureStyleState("nav_play").background;
        GUI.enabled = (aData.getCurrentTake().rootGroup != null && aData.getCurrentTake().rootGroup.elements.Count > 0 ? true : false);
        Rect rectBtnTogglePlay = new Rect(rectBtnSkipBack.x + rectBtnSkipBack.width + margin, rectBtnSkipBack.y, rectBtnSkipBack.width, rectBtnSkipBack.height);
        if(GUI.Button(rectBtnTogglePlay, playToggleTexture, GUI.skin.GetStyle("ButtonImage"))) {
            if(isChangingTimeControl) isChangingTimeControl = false;
            if(isChangingFrameControl) isChangingFrameControl = false;
            // cancel renaming
            cancelTextEditting();
            // toggle play
            playerTogglePlay();
        }
        if(rectBtnTogglePlay.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Button;
        }
        #endregion
        #region select last frame button
        GUI.enabled = (aData.getCurrentTake().rootGroup != null && aData.getCurrentTake().rootGroup.elements.Count > 0 ? !isPlaying : false);
        Rect rectSkipForward = new Rect(rectBtnTogglePlay.x + rectBtnTogglePlay.width + margin, rectBtnTogglePlay.y, rectBtnTogglePlay.width, rectBtnTogglePlay.height);
        if(GUI.Button(rectSkipForward, getSkinTextureStyleState("nav_skip_forward").background, GUI.skin.GetStyle("ButtonImage"))) timelineSelectFrame(aData.getCurrentTake().selectedTrack, aData.getCurrentTake().numFrames);
        if(rectSkipForward.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Button;
        }
        #endregion
        #region playback speed popup
        Rect rectPopupPlaybackSpeed = new Rect(rectSkipForward.x + rectSkipForward.width + margin, height_indicator_footer / 2f - 15f / 2f, width_playback_speed, rectBtnTogglePlay.height);
        aData.takes[aData.currentTake].playbackSpeedIndex = EditorGUI.Popup(rectPopupPlaybackSpeed, aData.takes[aData.currentTake].playbackSpeedIndex, playbackSpeed);
        #endregion
        #region scrub controls
        GUIStyle styleScrubControl = new GUIStyle(GUI.skin.label);
        string stringTime = frameToTime(aData.getCurrentTake().selectedFrame, (float)aData.getCurrentTake().frameRate).ToString("N2") + " s";
        string stringFrame = aData.getCurrentTake().selectedFrame.ToString() + " fr";
        int timeFontSize = findWidthFontSize(width_scrub_control, styleScrubControl, new GUIContent(stringTime), 8, 14);
        int frameFontSize = findWidthFontSize(width_scrub_control, styleScrubControl, new GUIContent(stringFrame), 8, 14);
        styleScrubControl.fontSize = (timeFontSize <= frameFontSize ? timeFontSize : frameFontSize);
        #region frame control
        Rect rectFrameControl = new Rect(rectPopupPlaybackSpeed.x + rectPopupPlaybackSpeed.width + margin, 1f, width_scrub_control, height_indicator_footer);
        // frame control button
        if(!isChangingFrameControl) {
            // set time control font size
            if(GUI.Button(rectFrameControl, stringFrame, styleScrubControl)) {
                if(dragType != (int)DragType.FrameScrub) {
                    if(isChangingTimeControl) isChangingTimeControl = false;
                    cancelTextEditting();
                    isChangingFrameControl = true;

                }
            }
            // scrubbing cursor
            if(!isPlaying && aData.getCurrentTake().rootGroup != null && aData.getCurrentTake().rootGroup.elements.Count > 0) EditorGUIUtility.AddCursorRect(rectFrameControl, MouseCursor.SlideArrow);
            // check for drag
            if(rectFrameControl.Contains(e.mousePosition) && aData.getCurrentTake().rootGroup != null && aData.getCurrentTake().rootGroup.elements.Count > 0) {
                mouseOverElement = (int)ElementType.FrameScrub;
            }
        }
        else {
            // changing frame control
            selectFrame((int)Mathf.Clamp(EditorGUI.FloatField(new Rect(rectFrameControl.x, rectFrameControl.y + 2f, rectFrameControl.width, rectFrameControl.height), aData.getCurrentTake().selectedFrame, GUI.skin.textField/*,styleButtonTimeControlEdit*/), 1, aData.getCurrentTake().numFrames));
            if(rectFrameControl.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
                mouseOverElement = (int)ElementType.Other;
            }
        }
        #endregion
        #region time control
        Rect rectTimeControl = new Rect(rectFrameControl.x + rectFrameControl.width + margin, rectFrameControl.y, rectFrameControl.width, rectFrameControl.height);
        if(!isChangingTimeControl) {
            // set time control font size
            if(GUI.Button(rectTimeControl, stringTime, styleScrubControl)) {
                if(dragType != (int)DragType.TimeScrub) {
                    if(isChangingFrameControl) isChangingFrameControl = false;
                    cancelTextEditting();
                    isChangingTimeControl = true;
                }
            }
            // scrubbing cursor
            if(!isPlaying && aData.getCurrentTake().rootGroup != null && aData.getCurrentTake().rootGroup.elements.Count > 0) EditorGUIUtility.AddCursorRect(rectTimeControl, MouseCursor.SlideArrow);
            // check for drag
            if(rectTimeControl.Contains(e.mousePosition) && aData.getCurrentTake().rootGroup != null && aData.getCurrentTake().rootGroup.elements.Count > 0) {
                mouseOverElement = (int)ElementType.TimeScrub;
            }
        }
        else {
            // changing time control
            selectFrame(Mathf.Clamp(timeToFrame(EditorGUI.FloatField(new Rect(rectTimeControl.x, rectTimeControl.y + 2f, rectTimeControl.width, rectTimeControl.height), frameToTime(aData.getCurrentTake().selectedFrame, (float)aData.getCurrentTake().frameRate), GUI.skin.textField/*,styleButtonTimeControlEdit*/), (float)aData.getCurrentTake().frameRate), 1, aData.getCurrentTake().numFrames));
            if(rectTimeControl.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
                mouseOverElement = (int)ElementType.Other;
            }
        }
        GUI.enabled = !isPlaying;
        #endregion
        #endregion
        GUI.EndGroup();
        Rect rectFooter = new Rect(rectAreaPlaybackControls.x, rectAreaPlaybackControls.y, position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 5f, rectAreaPlaybackControls.height);
        if(rectFooter.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Other;
        }
        #endregion
        #region horizontal scrollbar
        // check if mouse is over inspector and scroll if dragging
        if(globalMousePosition.y >= (height_control_bar + height_menu_bar + 2f)) {
            difference = 0;
            // drag right, over inspector
            if(globalMousePosition.x >= position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 5f) {
                difference = Mathf.CeilToInt(globalMousePosition.x - (position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 5f));
                tickerSpeed = Mathf.Clamp(50 - Mathf.CeilToInt(difference / 1.5f), 1, 50);
                if(!aData.isInspectorOpen) tickerSpeed /= 10;
                // if mouse over inspector, set mouseOverElement to Other
                mouseOverElement = (int)ElementType.Other;
                if(dragType == (int)DragType.MoveSelection || dragType == (int)DragType.ContextSelection || dragType == (int)DragType.ResizeAction) {
                    if(ticker == 0) {
                        aData.getCurrentTake().startFrame = Mathf.Clamp(++aData.getCurrentTake().startFrame, 1, aData.getCurrentTake().numFrames);
                        mouseXOverFrame = Mathf.Clamp((int)aData.getCurrentTake().startFrame + (int)numFramesToRender, 1, aData.getCurrentTake().numFrames);
                    }
                    else {
                        mouseXOverFrame = Mathf.Clamp((int)aData.getCurrentTake().startFrame + (int)numFramesToRender, 1, aData.getCurrentTake().numFrames);
                    }
                }
                // drag left, over tracks
            }
            else if(globalMousePosition.x <= width_track - 5f) {
                difference = Mathf.CeilToInt((width_track - 5f) - globalMousePosition.x);
                tickerSpeed = Mathf.Clamp(50 - Mathf.CeilToInt(difference / 1.5f), 1, 50);
                if(dragType == (int)DragType.MoveSelection || dragType == (int)DragType.ContextSelection || dragType == (int)DragType.ResizeAction) {
                    if(ticker == 0) {
                        aData.getCurrentTake().startFrame = Mathf.Clamp(--aData.getCurrentTake().startFrame, 1, aData.getCurrentTake().numFrames);
                        mouseXOverFrame = Mathf.Clamp((int)aData.getCurrentTake().startFrame - 2, 1, aData.getCurrentTake().numFrames);
                    }
                    else {
                        mouseXOverFrame = Mathf.Clamp((int)aData.getCurrentTake().startFrame, 1, aData.getCurrentTake().numFrames);
                    }
                }
            }
        }
        Rect rectHScrollbar = new Rect(width_track + width_playback_controls, position.height - height_indicator_footer + 2f, position.width - (width_track + width_playback_controls) - (aData.isInspectorOpen ? width_inspector_open - 4f : width_inspector_closed) - 21f, height_indicator_footer - 2f);
        float frame_width_HScrollbar = ((rectHScrollbar.width - 44f - (aData.isInspectorOpen ? 4f : 0f)) / ((float)aData.getCurrentTake().numFrames - 1f));
        Rect rectResizeHScrollbarLeft = new Rect(rectHScrollbar.x + 18f + frame_width_HScrollbar * (aData.getCurrentTake().startFrame - 1f), rectHScrollbar.y + 2f, 15f, 15f);
        Rect rectResizeHScrollbarRight = new Rect(rectHScrollbar.x + 18f + frame_width_HScrollbar * (aData.getCurrentTake().endFrame - 1f) - 3f, rectHScrollbar.y + 2f, 15f, 15f);
        Rect rectHScrollbarThumb = new Rect(rectResizeHScrollbarLeft.x, rectResizeHScrollbarLeft.y - 2f, rectResizeHScrollbarRight.x - rectResizeHScrollbarLeft.x + rectResizeHScrollbarRight.width, rectResizeHScrollbarLeft.height);
        if(!aData.isInspectorOpen) rectHScrollbar.width += 4f;
        // if number of frames fit on screen, disable horizontal scrollbar and set startframe to 1
        if(aData.getCurrentTake().numFrames < numFramesToRender) {
            GUI.HorizontalScrollbar(rectHScrollbar, 1f, 1f, 1f, 1f);
            aData.getCurrentTake().startFrame = 1;
        }
        else {
            bool hideResizeThumbs = false;
            if(rectHScrollbarThumb.width < rectResizeHScrollbarLeft.width * 2) {
                hideResizeThumbs = true;
                rectResizeHScrollbarLeft = new Rect(rectHScrollbarThumb.x - 4f, rectResizeHScrollbarLeft.y, rectHScrollbarThumb.width / 2f + 4f, rectResizeHScrollbarLeft.height);
                rectResizeHScrollbarRight = new Rect(rectHScrollbarThumb.x + rectHScrollbarThumb.width - rectHScrollbarThumb.width / 2f, rectResizeHScrollbarRight.y, rectResizeHScrollbarLeft.width, rectResizeHScrollbarRight.height);
            }
            mouseXOverHScrollbarFrame = Mathf.CeilToInt(aData.getCurrentTake().numFrames * ((e.mousePosition.x - rectHScrollbar.x - GUI.skin.horizontalScrollbarLeftButton.fixedWidth) / (rectHScrollbar.width - GUI.skin.horizontalScrollbarLeftButton.fixedWidth * 2)));
            if(!rectResizeHScrollbarLeft.Contains(e.mousePosition) && !rectResizeHScrollbarRight.Contains(e.mousePosition) && EditorWindow.mouseOverWindow == this && dragType != (int)DragType.ResizeHScrollbarLeft && dragType != (int)DragType.ResizeHScrollbarRight && mouseOverElement != (int)ElementType.ResizeHScrollbarLeft && mouseOverElement != (int)ElementType.ResizeHScrollbarRight)
                aData.getCurrentTake().startFrame = Mathf.Clamp((int)GUI.HorizontalScrollbar(rectHScrollbar, (float)aData.getCurrentTake().startFrame, (int)numFramesToRender - 1f, 1f, aData.getCurrentTake().numFrames), 1, aData.getCurrentTake().numFrames);
            else Mathf.Clamp(GUI.HorizontalScrollbar(rectHScrollbar, (float)aData.getCurrentTake().startFrame, (int)numFramesToRender - 1f, 1f, aData.getCurrentTake().numFrames), 1f, aData.getCurrentTake().numFrames);
            // scrollbar bg overlay (used to hide inconsistent thumb)
            GUI.Box(new Rect(rectHScrollbar.x + 18f, rectHScrollbar.y, rectHScrollbar.width - 18f * 2f, rectHScrollbar.height), "", GUI.skin.horizontalScrollbar);
            // scrollbar thumb overlay (used to hide inconsistent thumb)
            GUI.Box(rectHScrollbarThumb, "", GUI.skin.horizontalScrollbarThumb);

            if(!hideResizeThumbs) {
                if(!GUI.enabled) GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.25f);
                GUI.DrawTexture(rectResizeHScrollbarLeft, GUI.skin.GetStyle("ResizeTrackThumb").normal.background);
                GUI.DrawTexture(rectResizeHScrollbarRight, GUI.skin.GetStyle("ResizeTrackThumb").normal.background);
                GUI.color = Color.white;
            }
            if(GUI.enabled && !isDragging) {
                EditorGUIUtility.AddCursorRect(rectResizeHScrollbarLeft, MouseCursor.ResizeHorizontal);
                EditorGUIUtility.AddCursorRect(rectResizeHScrollbarRight, MouseCursor.ResizeHorizontal);
            }
            // show horizontal scrollbar
            if(rectResizeHScrollbarLeft.Contains(e.mousePosition) && customCursor == (int)CursorType.None) {

                mouseOverElement = (int)ElementType.ResizeHScrollbarLeft;
            }
            else if(rectResizeHScrollbarRight.Contains(e.mousePosition) && customCursor == (int)CursorType.None) {
                mouseOverElement = (int)ElementType.ResizeHScrollbarRight;
            }
        }
        aData.getCurrentTake().endFrame = aData.getCurrentTake().startFrame + (int)numFramesToRender - 1;
        if(rectHScrollbar.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Other;
        }

        #endregion
        #region inspector toggle button
        Rect rectPropertiesButton = new Rect(position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 1f, height_menu_bar + height_control_bar + 2f, width_inspector_closed, position.height);
        GUI.color = getSkinTextureStyleState("properties_bg").textColor;
        GUI.DrawTexture(rectPropertiesButton, getSkinTextureStyleState("properties_bg").background);
        GUI.color = Color.white;
        // inspector toggle button
        if(GUI.Button(rectPropertiesButton, "", "label")) {
            aData.isInspectorOpen = !aData.isInspectorOpen;
        }
        if(rectPropertiesButton.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None) {
            mouseOverElement = (int)ElementType.Button;
        }
        #endregion
        #region key numbering
        Rect rectKeyNumbering = new Rect(width_track, height_control_bar + height_menu_bar + 2f - 22f, position.width - width_track - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 20f, 20f);
        if(rectKeyNumbering.Contains(e.mousePosition) && (mouseOverElement == (int)ElementType.None)) {
            mouseOverElement = (int)ElementType.TimelineScrub;
        }
        int key_dist = 5;
        if(numFramesToRender >= 100) key_dist = Mathf.FloorToInt(numFramesToRender / 100) * 10;
        int firstMarkedKey = (int)aData.getCurrentTake().startFrame;
        if(firstMarkedKey % key_dist != 0 && firstMarkedKey != 1) {
            firstMarkedKey += key_dist - firstMarkedKey % key_dist;
        }
        float lastNumberX = -1f;
        for(int i = firstMarkedKey; i <= (int)aData.getCurrentTake().endFrame; i += key_dist) {
            float newKeyNumberX = width_track + current_width_frame * (i - (int)aData.getCurrentTake().startFrame) - 1f;
            string key_number;
            if(oData.time_numbering) key_number = frameToTime(i, (float)aData.getCurrentTake().frameRate).ToString("N2");
            else key_number = i.ToString();
            Rect rectKeyNumber = new Rect(newKeyNumberX, height_menu_bar, GUI.skin.label.CalcSize(new GUIContent(key_number)).x, height_control_bar);
            bool didCutLabel = false;
            if(rectKeyNumber.x + rectKeyNumber.width >= position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 20f) {
                rectKeyNumber.width = position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 20f - rectKeyNumber.x;
                didCutLabel = true;
            }
            if(!(didCutLabel && aData.getCurrentTake().endFrame == aData.getCurrentTake().numFrames)) {
                if(rectKeyNumber.x > lastNumberX + 3f) {
                    GUI.Label(rectKeyNumber, key_number);
                    lastNumberX = rectKeyNumber.x + GUI.skin.label.CalcSize(new GUIContent(key_number)).x;
                }
            }
            if(i == 1) i--;
        }
        #endregion
        #region main scrollview
        height_all_tracks = aData.getCurrentTake().getElementsHeight(0, height_track, height_track_foldin, height_group);
        float height_scrollview = position.height - (height_control_bar + height_menu_bar) - height_indicator_footer;
        // check if mouse is beyond tracks and dragging group element
        difference = 0;
        // drag up
        if(dragType == (int)DragType.GroupElement && globalMousePosition.y <= height_control_bar + height_menu_bar + 2f) {
            difference = Mathf.CeilToInt((height_control_bar + height_menu_bar + 2f) - globalMousePosition.y);
            scrollAmountVertical = -difference;	// set scroll amount
            // drag down
        }
        else if(dragType == (int)DragType.GroupElement && globalMousePosition.y >= position.height - height_playback_controls) {
            difference = Mathf.CeilToInt(globalMousePosition.y - (position.height - height_playback_controls));
            scrollAmountVertical = difference; // set scroll amount
        }
        else {
            scrollAmountVertical = 0f;
        }
        // frames bg
        GUI.DrawTexture(new Rect(0f, height_control_bar + height_menu_bar + 2f, position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 5f, position.height - height_control_bar - height_menu_bar - height_indicator_footer), GUI.skin.GetStyle("GroupElementBG").onNormal.background);
        // tracks bg
        GUI.Box(new Rect(0f, height_control_bar + height_menu_bar + 2f, width_track, position.height - height_control_bar - height_menu_bar - height_indicator_footer), "", GUI.skin.GetStyle("GroupElementBG"));
        Rect rectScrollView = new Rect(0f, height_control_bar + height_menu_bar + 2f, position.width - (aData.isInspectorOpen ? width_inspector_open/*+3f*/ : width_inspector_closed), height_scrollview);
        Rect rectView = new Rect(0f, 0f, rectScrollView.width - 20f, (height_all_tracks > rectScrollView.height ? height_all_tracks : rectScrollView.height));
        scrollViewValue = GUI.BeginScrollView(rectScrollView, scrollViewValue, rectView, false, true);
        scrollViewValue.y = Mathf.Clamp(scrollViewValue.y, 0f, height_all_tracks - height_scrollview);
        Vector2 scrollViewBounds = new Vector2(scrollViewValue.y, scrollViewValue.y + height_scrollview); // min and max y displayed onscreen
        bool isAnyTrackFoldedOut = false;
        GUILayout.BeginHorizontal(GUILayout.Height(height_all_tracks));
        GUILayout.BeginVertical(GUILayout.Width(width_track));
        float track_y = 0f;		// the next track's y position
        // tracks vertical start
        for(int i = 0; i < aData.getCurrentTake().rootGroup.elements.Count; i++) {
            if(track_y > scrollViewBounds.y) break;	// if start y is beyond max y
            int id = aData.getCurrentTake().rootGroup.elements[i];
            float height_group_elements = 0f;
            showGroupElement(id, 0, ref track_y, ref isAnyTrackFoldedOut, ref height_group_elements, e, scrollViewBounds);
        }
        // draw element position indicator
        if(dragType == (int)DragType.GroupElement) {
            if(mouseOverElement != (int)ElementType.Group && mouseOverElement != (int)ElementType.GroupOutside && mouseOverElement != (int)ElementType.Track) {
                float element_position_y;
                if(e.mousePosition.y < (height_menu_bar + height_control_bar)) element_position_y = 2f;
                else element_position_y = track_y;
                GUI.DrawTexture(new Rect(0f, element_position_y - height_element_position, width_track, height_element_position), tex_element_position);
            }
        }
        GUILayout.EndVertical();
        GUILayout.BeginVertical();
        // frames vertical
        GUILayout.BeginHorizontal(GUILayout.Height(height_track));
        mouseXOverFrame = (int)aData.getCurrentTake().startFrame + Mathf.CeilToInt((e.mousePosition.x - width_track) / current_width_frame) - 1;
        if(dragType == (int)DragType.CursorHand && justStartedHandGrab) {
            startScrubFrame = mouseXOverFrame;
            justStartedHandGrab = false;
        }
        track_y = 0f;	// reset track y
        showFramesForGroup(0, ref track_y, e, birdseye, scrollViewBounds);
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
        GUILayout.EndScrollView();
        #endregion
        #region inspector
        Texture inspectorArrow;
        if(aData.isInspectorOpen) {
            Rect rectInspector = new Rect(position.width - width_inspector_open - 4f + width_inspector_closed, height_control_bar + height_menu_bar + 2f, width_inspector_open, position.height - height_menu_bar - height_control_bar);
            GUI.BeginGroup(rectInspector);
            // inspector vertical
            GUI.enabled = true;
            GUI.enabled = !isPlaying;
            // backup editor styles
            GUIStyle styleEditorTextField = new GUIStyle(EditorStyles.textField);
            GUIStyle styleEditorLabel = new GUIStyle(EditorStyles.label);
            // modify editor styles
            EditorStyles.textField.normal = GUI.skin.textField.normal;
            EditorStyles.textField.focused = GUI.skin.textField.focused;
            EditorStyles.label.normal = GUI.skin.label.normal;
            showInspectorPropertiesFor(rectInspector, aData.getCurrentTake().selectedTrack, aData.getCurrentTake().selectedFrame, e);
            // reset editor styles
            EditorStyles.textField.normal = styleEditorTextField.normal;
            EditorStyles.textField.focused = styleEditorTextField.focused;
            EditorStyles.label.normal = styleEditorLabel.normal;
            inspectorArrow = texRightArrow;
            GUI.EndGroup();
        }
        else {
            GUI.enabled = true;
            GUI.enabled = !isPlaying;
            inspectorArrow = texLeftArrow;
        }
        GUI.DrawTexture(new Rect(position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) + 4f, 60f, 22f, 19f), inspectorArrow);
        GUI.DrawTexture(new Rect(position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed) - 8f, 73f, 48f, 48f), texProperties);
        #endregion
        #region indicator
        if((oData.showFramesForCollapsedTracks || isAnyTrackFoldedOut) && (trackCount > 0)) drawIndicator(aData.getCurrentTake().selectedFrame);
        #endregion
        #region horizontal scrollbar tooltip
        string strHScrollbarLeftTooltip = (oData.time_numbering ? frameToTime((int)aData.getCurrentTake().startFrame, (float)aData.getCurrentTake().frameRate).ToString("N2") : aData.getCurrentTake().startFrame.ToString());
        string strHScrollbarRightTooltip = (oData.time_numbering ? frameToTime((int)aData.getCurrentTake().endFrame, (float)aData.getCurrentTake().frameRate).ToString("N2") : aData.getCurrentTake().endFrame.ToString());
        GUIStyle styleLabelCenter = new GUIStyle(GUI.skin.label);
        styleLabelCenter.alignment = TextAnchor.MiddleCenter;
        Vector2 _label_size;
        if(customCursor == (int)CursorType.None && ((mouseOverElement == (int)ElementType.ResizeHScrollbarLeft && !isDragging) || dragType == (int)DragType.ResizeHScrollbarLeft) && (dragType != (int)DragType.ResizeHScrollbarRight)) {
            _label_size = GUI.skin.button.CalcSize(new GUIContent(strHScrollbarLeftTooltip));
            _label_size.x += 2f;
            GUI.Label(new Rect(rectResizeHScrollbarLeft.x + rectResizeHScrollbarLeft.width / 2f - _label_size.x / 2f, rectResizeHScrollbarLeft.y - 22f, _label_size.x, 20f), strHScrollbarLeftTooltip, GUI.skin.button);
        }
        if(customCursor == (int)CursorType.None && ((mouseOverElement == (int)ElementType.ResizeHScrollbarRight && !isDragging) || dragType == (int)DragType.ResizeHScrollbarRight) && (dragType != (int)DragType.ResizeHScrollbarLeft)) {
            _label_size = GUI.skin.button.CalcSize(new GUIContent(strHScrollbarRightTooltip));
            _label_size.x += 2f;
            GUI.Label(new Rect(rectResizeHScrollbarRight.x + rectResizeHScrollbarRight.width / 2f - _label_size.x / 2f, rectResizeHScrollbarRight.y - 22f, _label_size.x, 20f), strHScrollbarRightTooltip, GUI.skin.button);
        }
        #endregion
        #region click window
        if(GUI.Button(new Rect(0f, 0f, position.width, position.height), "", "label") && dragType != (int)DragType.TimelineScrub && dragType != (int)DragType.ResizeAction) {
            bool didRegisterUndo = false;

            if(aData.getCurrentTake().contextSelectionTracks != null && aData.getCurrentTake().contextSelectionTracks.Count > 0) {
                Undo.RecordObject(aData.getCurrentTake(), "Deselect Tracks");
                didRegisterUndo = true;
                aData.getCurrentTake().contextSelectionTracks = new List<int>();
            }
            if(aData.getCurrentTake().contextSelection != null && aData.getCurrentTake().contextSelection.Count > 0) {
                if(!didRegisterUndo) Undo.RecordObject(aData.getCurrentTake(), "Deselect Frames");
                didRegisterUndo = true;
                aData.getCurrentTake().contextSelection = new List<int>();
            }
            if(aData.getCurrentTake().ghostSelection != null && aData.getCurrentTake().ghostSelection.Count > 0) {
                aData.getCurrentTake().ghostSelection = new List<int>();
            }

            if(objects_window.Count > 0) objects_window = new List<GameObject>();
            if(isRenamingGroup < 0) isRenamingGroup = 0;
            if(isRenamingTake) {
                aData.makeTakeNameUnique(aData.getCurrentTake());
                isRenamingTake = false;
            }
            if(isRenamingTrack != -1) isRenamingTrack = -1;
            if(isChangingTimeControl) isChangingTimeControl = false;
            if(isChangingFrameControl) isChangingFrameControl = false;
            // if clicked on inspector, do nothing
            if(e.mousePosition.y > (float)height_menu_bar + (float)height_control_bar && e.mousePosition.x > position.width - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed)) return;
            if(aData.getCurrentTake().selectedGroup != 0) timelineSelectGroup(0);
            if(aData.getCurrentTake().selectedTrack != -1) aData.getCurrentTake().selectedTrack = -1;

            if(objects_window.Count > 0) objects_window = new List<GameObject>();

        }
        #endregion
        #region drag logic
        if(dragType == (int)DragType.GroupElement) {
            // show element near cursor
            Rect rectDragElement = new Rect(e.mousePosition.x + 20f, e.mousePosition.y, 90f, 20f);
            string dragElementName = "Unknown";
            Texture dragElementIcon = null;
            float dragElementIconWidth = 12f;
            if(draggingGroupElementType == (int)ElementType.Group) {
                dragElementName = aData.getCurrentTake().getGroup((int)draggingGroupElement.x).group_name;
                dragElementIcon = tex_icon_group_closed;
                dragElementIconWidth = 16f;
            }
            else if(draggingGroupElementType == (int)ElementType.Track) {
                AMTrack dragTrack = aData.getCurrentTake().getTrack((int)draggingGroupElement.y);
                if(dragTrack) {
                    dragElementName = dragTrack.name;
                    dragElementIcon = getTrackIconTexture(dragTrack);
                }
            }
            GUI.DrawTexture(rectDragElement, GUI.skin.GetStyle("GroupElementActive").normal.background);
            dragElementName = trimString(dragElementName, 8);
            if(dragElementIcon) GUI.DrawTexture(new Rect(rectDragElement.x + 3f + (draggingGroupElementType == (int)ElementType.Track ? 1.45f : 0f), rectDragElement.y + rectDragElement.height / 2 - dragElementIconWidth / 2, dragElementIconWidth, dragElementIconWidth), dragElementIcon);
            GUI.Label(new Rect(rectDragElement.x + 15f + 4f, rectDragElement.y, rectDragElement.width - 15f - 4f, rectDragElement.height), dragElementName);
        }
        mouseAboveGroupElements = e.mousePosition.y < (height_menu_bar + height_control_bar);
        if(aData.getCurrentTake().rootGroup == null || aData.getCurrentTake().rootGroup.elements.Count <= 0) {

            if(aData.isInspectorOpen) aData.isInspectorOpen = false;
            float width_helpbox = position.width - width_inspector_closed - 28f - width_track;
            EditorGUI.HelpBox(new Rect(width_track + 5f, height_menu_bar + height_control_bar + 7f, width_helpbox, 50f), "Click the track icon below or drag a GameObject here to add a new track.", MessageType.Info);
            //GUI.DrawTexture(new Rect(width_track+75f,height_menu_bar+height_control_bar+19f-(width_helpbox<=355.5f ? 6f: 0f),15f,15f),tex_icon_track);
        }
        #endregion
        #region quick add
        GUIStyle styleObjectField = new GUIStyle(EditorStyles.objectField);
        GUIStyle styleObjectFieldThumb = new GUIStyle(EditorStyles.objectFieldThumb);
        EditorStyles.objectField.normal.textColor = new Color(0f, 0f, 0f, 0f);
        EditorStyles.objectField.contentOffset = new Vector2(width_track * -1 - 300f, 0f);
        EditorStyles.objectField.normal.background = null;
        EditorStyles.objectField.onNormal.background = null;

        GameObject tempGO = null;
        tempGO = (GameObject)EditorGUI.ObjectField(new Rect(width_track, height_menu_bar + height_control_bar + 2f, position.width - 5f - 15f - width_track - (aData.isInspectorOpen ? width_inspector_open : width_inspector_closed), position.height - height_indicator_footer - height_menu_bar - height_control_bar), "", tempGO, typeof(GameObject), true);

        if(tempGO != null) {
            objects_window = new List<GameObject>();
            if(Selection.gameObjects.Length <= 0) objects_window.Add(tempGO);
            else objects_window.AddRange(Selection.gameObjects);
            buildAddTrackMenu_Drag();
            menu_drag.ShowAsContext();
        }
        EditorStyles.objectField.contentOffset = styleObjectField.contentOffset;
        EditorStyles.objectField.normal = styleObjectField.normal;
        EditorStyles.objectField.onNormal = styleObjectField.onNormal;
        EditorStyles.objectFieldThumb.normal = styleObjectFieldThumb.normal;
        #endregion
        #region tooltip

        if(!oData.disableTimelineActions && !oData.disableTimelineActionsTooltip && dragType == (int)DragType.None && showTooltip && tooltip != "") {
            Vector2 tooltipSize = GUI.skin.label.CalcSize(new GUIContent(tooltip));
            tooltipSize.x += GUI.skin.button.padding.left + GUI.skin.button.padding.right;
            tooltipSize.y += GUI.skin.button.padding.top + GUI.skin.button.padding.bottom;
            Rect rectTooltip = new Rect(e.mousePosition.x - tooltipSize.x / 2f, (e.mousePosition.y + 30f + tooltipSize.y <= position.height - height_playback_controls ? e.mousePosition.y + 30f : e.mousePosition.y - 12f - tooltipSize.y), tooltipSize.x, tooltipSize.y);
            GUI.Box(rectTooltip, tooltip, GUI.skin.button);
        }
        #endregion
        #region custom cursor
        if(customCursor != (int)CursorType.None) {
            if(customCursor == (int)CursorType.Zoom) {
                if(!tex_cursor_zoom) tex_cursor_zoom = tex_cursor_zoomin;
                if(tex_cursor_zoom == tex_cursor_zoomin && aData.zoom <= 0f) tex_cursor_zoom = tex_cursor_zoom_blank;
                else if(tex_cursor_zoom == tex_cursor_zoomout && aData.zoom >= 1f) tex_cursor_zoom = tex_cursor_zoom_blank;
                GUI.DrawTexture(new Rect(e.mousePosition.x - 6f, e.mousePosition.y - 5f, 16f, 16f), tex_cursor_zoom);
            }
            else if(customCursor == (int)CursorType.Hand) {
                GUI.DrawTexture(new Rect(e.mousePosition.x - 8f, e.mousePosition.y - 7f, 16f, 16f), (tex_cursor_grab));
            }
        }
        #endregion
        if(e.alt && !isDragging) startZoomXOverFrame = mouseXOverFrame;
        e.Use();

        if(doRefresh) {
            ClearKeysBuffer();
            contextSelectionTracksBuffer.Clear();
            cachedContextSelection.Clear();

            GameObject go = _aData.gameObject;
            _aData.isAnimatorOpen = false;
            _aData = null;
            Selection.activeGameObject = go;
        }
    }
示例#25
0
    void OnEnable()
    {
        if(!texLoaded) {
            tex_cursor_zoomin = AMEditorResource.LoadEditorTexture("am_cursor_zoomin");
            tex_cursor_zoomout = AMEditorResource.LoadEditorTexture("am_cursor_zoomout");
            tex_cursor_zoom_blank = AMEditorResource.LoadEditorTexture("am_cursor_zoom_blank");
            tex_cursor_zoom = null;
            tex_cursor_grab = AMEditorResource.LoadEditorTexture("am_cursor_grab");
            tex_icon_track = AMEditorResource.LoadEditorTexture("am_icon_track");
            tex_icon_track_hover = AMEditorResource.LoadEditorTexture("am_icon_track_hover");
            tex_icon_group_closed = AMEditorResource.LoadEditorTexture("am_icon_group_closed");
            tex_icon_group_open = AMEditorResource.LoadEditorTexture("am_icon_group_open");
            tex_icon_group_hover = AMEditorResource.LoadEditorTexture("am_icon_group_hover");
            tex_element_position = AMEditorResource.LoadEditorTexture("am_element_position");
            texFrKey = AMEditorResource.LoadEditorTexture("am_key");
            texFrSet = AMEditorResource.LoadEditorTexture("am_frame_set");
            //texFrU = AMEditorResource.LoadTexture("am_frame");
            //texFrM = AMEditorResource.LoadTexture("am_frame-m");
            //texFrUS = AMEditorResource.LoadTexture("am_frame-s");
            //texFrMS = AMEditorResource.LoadTexture("am_frame-m-s");
            //texFrUG = AMEditorResource.LoadTexture("am_frame-g");
            texKeyBirdsEye = AMEditorResource.LoadEditorTexture("am_key_birdseye");
            texIndLine = AMEditorResource.LoadEditorTexture("am_indicator_line");
            texIndHead = AMEditorResource.LoadEditorTexture("am_indicator_head");
            texProperties = AMEditorResource.LoadEditorTexture("am_information");
            texRightArrow = AMEditorResource.LoadEditorTexture("am_nav_right");// inspector right arrow
            texLeftArrow = AMEditorResource.LoadEditorTexture("am_nav_left");	// inspector left arrow
            texInterpl[0] = AMEditorResource.LoadEditorTexture("am_interpl_curve"); texInterpl[1] = AMEditorResource.LoadEditorTexture("am_interpl_linear");
            texBoxBorder = AMEditorResource.LoadEditorTexture("am_box_border");
            texBoxRed = AMEditorResource.LoadEditorTexture("am_box_red");
            //texBoxBlue = AMEditorResource.LoadTexture("am_box_blue");
            texBoxLightBlue = AMEditorResource.LoadEditorTexture("am_box_lightblue");
            texBoxDarkBlue = AMEditorResource.LoadEditorTexture("am_box_darkblue");
            texBoxGreen = AMEditorResource.LoadEditorTexture("am_box_green");
            texBoxPink = AMEditorResource.LoadEditorTexture("am_box_pink");
            texBoxYellow = AMEditorResource.LoadEditorTexture("am_box_yellow");
            texBoxOrange = AMEditorResource.LoadEditorTexture("am_box_orange");
            texIconTranslation = AMEditorResource.LoadEditorTexture("am_icon_translation");
            texIconRotation = AMEditorResource.LoadEditorTexture("am_icon_rotation");
            texIconAnimation = AMEditorResource.LoadEditorTexture("am_icon_animation");
            texIconAudio = AMEditorResource.LoadEditorTexture("am_icon_audio");
            texIconProperty = AMEditorResource.LoadEditorTexture("am_icon_property");
            texIconEvent = AMEditorResource.LoadEditorTexture("am_icon_event");
            texIconOrientation = AMEditorResource.LoadEditorTexture("am_icon_orientation");

            texLoaded = true;
        }

        this.title = "Animator";
        this.minSize = new Vector2(width_track + width_playback_controls + width_inspector_open + 70f, 190f);
        window = this;
        //this.wantsMouseMove = true;
        // find component
        if(!aData && !EditorApplication.isPlayingOrWillChangePlaymode) {
            GameObject go = Selection.activeGameObject;
            if(go && PrefabUtility.GetPrefabType(go) != PrefabType.Prefab) {
                aData = go.GetComponent<AnimatorData>();
            }
        }

        oData = AMOptionsFile.loadFile();
        // set default current dimensions of frames
        //current_width_frame = width_frame;
        //current_height_frame = height_frame;
        // set is playing to false
        isPlaying = false;

        // add track menu
        buildAddTrackMenu();

        // playmode callback
        EditorApplication.playmodeStateChanged += OnPlayMode;

        // check for pro license
        AMTake.isProLicense = PlayerSettings.advancedLicense;

        //autoRepaintOnSceneChange = true;

        mTempHolder = new GameObject();
        mTempHolder.hideFlags = HideFlags.HideAndDontSave;
    }
示例#26
0
    void OnGUI()
    {
        AMTimeline.loadSkin(oData, ref skin, ref cachedSkinName, position);
        if (!aData)
        {
            AMTimeline.MessageBox("Animator requires an AnimatorData component in your scene. Launch Animator to add the component.", AMTimeline.MessageBoxType.Warning);
            return;
        }
        if (!oData)
        {
            oData = AMOptionsFile.loadFile();
        }
        GUILayout.BeginHorizontal();
        #region tab selection
        //GUI.DrawTexture(new Rect(0f,0f,120f,position.height),GUI.skin.GetStyle("GroupElementBG")/*GUI.skin.GetStyle("GroupElementBG").onNormal.background*/);
        GUIStyle styleTabSelectionBG = new GUIStyle(GUI.skin.GetStyle("GroupElementBG"));
        styleTabSelectionBG.normal.background = EditorStyles.toolbar.normal.background;
        GUILayout.BeginVertical(/*GUI.skin.GetStyle("GroupElementBG")*/ styleTabSelectionBG, GUILayout.Width(121f));
        EditorGUIUtility.LookLikeControls();
        GUIStyle styleTabButton = new GUIStyle(EditorStyles.toolbarButton);
        styleTabButton.fontSize             = 12;
        styleTabButton.fixedHeight          = 30;
        styleTabButton.onNormal.background  = styleTabButton.onActive.background;
        styleTabButton.onFocused.background = null;
        styleTabButton.onHover.background   = null;
        tabIndex = GUILayout.SelectionGrid(tabIndex, tabNames, 1, styleTabButton);
        GUILayout.EndVertical();
        #endregion
        #region options
        GUILayout.BeginVertical();
        EditorGUIUtility.LookLikeControls();

        GUIStyle styleArea = new GUIStyle(GUI.skin.textArea);
        scrollView = GUILayout.BeginScrollView(scrollView, styleArea);
        List <string> takeNames = getTakeNames();

        GUIStyle styleTitle = new GUIStyle(GUI.skin.label);
        styleTitle.fontSize  = 20;
        styleTitle.fontStyle = FontStyle.Bold;

        // tab title
        GUILayout.BeginHorizontal();
        GUILayout.Space(width_indent);
        GUILayout.Label(tabNames[tabIndex], styleTitle);
        GUILayout.EndHorizontal();
        GUILayout.Space(10f);

        #region general
        if (tabIndex == (int)tabType.General)
        {
            List <string> takeNamesWithNone = new List <string>(takeNames);
            takeNamesWithNone.Insert(0, "None");
            // play on start
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.Space(1f);
            GUILayout.Label("Play On Start");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (setPlayOnStartIndex(EditorGUILayout.Popup(playOnStartIndex, takeNamesWithNone.ToArray(), GUILayout.Width(200f))))
            {
                if (playOnStartIndex == 0)
                {
                    aData.playOnStart = null;
                }
                else
                {
                    aData.playOnStart = aData.getTake(takeNames[playOnStartIndex - 1]);
                }
            }
            GUILayout.EndHorizontal();
            // gizmo size
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f), GUILayout.Width(80f));
            GUILayout.FlexibleSpace();
            GUILayout.Label("Gizmo size", GUILayout.Width(80f));
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (aData.setGizmoSize(GUILayout.HorizontalSlider(aData.gizmo_size, 0f, 0.1f, GUILayout.ExpandWidth(true))))
            {
                GUIUtility.keyboardControl = 0;
                EditorUtility.SetDirty(aData);
            }
            GUILayout.BeginVertical(GUILayout.Height(26f), GUILayout.Width(75f));
            GUILayout.FlexibleSpace();
            if (aData.setGizmoSize(EditorGUILayout.FloatField(aData.gizmo_size, GUI.skin.textField, GUILayout.Width(75f))))
            {
                EditorUtility.SetDirty(aData);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            // time instead of frame numbers
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.FlexibleSpace();
            GUILayout.Label("Show time instead of frame numbers");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (oData.setTimeNumbering(GUILayout.Toggle(oData.time_numbering, "")))
            {
                // save
                EditorUtility.SetDirty(oData);
            }
            GUILayout.EndHorizontal();
            // scrubby zoom cursor
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.FlexibleSpace();
            GUILayout.Label("Scrubby zoom cursor");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (oData.setScrubbyZoomCursor(GUILayout.Toggle(oData.scrubby_zoom_cursor, "")))
            {
                // save
                EditorUtility.SetDirty(oData);
            }
            GUILayout.EndHorizontal();
            // scrubby zoom slider
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.FlexibleSpace();
            GUILayout.Label("Scrubby zoom slider");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (oData.setScrubbyZoomSlider(GUILayout.Toggle(oData.scrubby_zoom_slider, "")))
            {
                // save
                EditorUtility.SetDirty(oData);
            }
            GUILayout.EndHorizontal();
            // show warning for lost references

            /*GUILayout.BeginHorizontal();
             *      GUILayout.Space(width_indent);
             *      GUILayout.BeginVertical(GUILayout.Height(26f));
             *              GUILayout.FlexibleSpace();
             *              GUILayout.Label ("Show warning for lost references");
             *              GUILayout.FlexibleSpace();
             *      GUILayout.EndVertical();
             *      if(oData.setShowWarningForLostReferences(GUILayout.Toggle(oData.showWarningForLostReferences,""))) {
             *              // save
             *              EditorUtility.SetDirty(oData);
             *      }
             * GUILayout.EndHorizontal();*/
            // ignore minimum window size warning
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.FlexibleSpace();
            GUILayout.Label("Ignore minimum window size warning");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (oData.setIgnoreMinimumSizeWarning(GUILayout.Toggle(oData.ignoreMinSize, "")))
            {
                // save
                EditorUtility.SetDirty(oData);
            }
            GUILayout.EndHorizontal();
            // show frames for collapsed tracks
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.FlexibleSpace();
            GUILayout.Label("Show frames for collapsed tracks");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (oData.setShowFramesForCollapsedTracks(GUILayout.Toggle(oData.showFramesForCollapsedTracks, "")))
            {
                // save
                EditorUtility.SetDirty(oData);
            }
            GUILayout.EndHorizontal();
            // disable timeline actions
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.FlexibleSpace();
            GUILayout.Label("Hide Timeline Actions (May increase editor performance)");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (oData.setDisableTimelineActions(GUILayout.Toggle(oData.disableTimelineActions, "")))
            {
                // save
                EditorUtility.SetDirty(oData);
                AMTimeline.recalculateNumFramesToRender();
            }
            GUILayout.EndHorizontal();
            // disable timeline actions tooltip
            if (oData.disableTimelineActions)
            {
                GUI.enabled = false;
            }
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.FlexibleSpace();
            GUILayout.Label("Enable Timeline Actions tooltip");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            if (oData.disableTimelineActions)
            {
                GUILayout.Toggle(false, "");
            }
            else
            {
                if (oData.setDisableTimelineActionsTooltip(!GUILayout.Toggle(!oData.disableTimelineActionsTooltip, "")))
                {
                    // save
                    EditorUtility.SetDirty(oData);
                }
            }
            GUILayout.EndHorizontal();
            GUI.enabled = true;
            // skin
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical(GUILayout.Height(26f));
            GUILayout.Space(1f);
            GUILayout.Label("Skin");
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            skinIndex = EditorGUILayout.Popup(skinIndex, skin_names, GUILayout.Width(200f));
            if (oData.setSkin(skin_ids[skinIndex]))
            {
                //if(playOnStartIndex == 0) aData.playOnStart = null;
                //else aData.playOnStart = aData.getTake(takeNames[playOnStartIndex-1]);
            }
            GUILayout.EndHorizontal();
        }
        #endregion
        #region quick add
        else if (tabIndex == (int)tabType.QuickAdd)
        {
            EditorGUIUtility.LookLikeControls();
            GUILayout.Space(3f);
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.Label("Combinations");
            GUILayout.EndHorizontal();
            if (oData.quickAdd_Combos == null)
            {
                oData.quickAdd_Combos = new List <List <int> >();
            }
            for (int j = 0; j < oData.quickAdd_Combos.Count; j++)
            {
                GUILayout.Space(3f);
                GUILayout.BeginHorizontal();
                GUILayout.Space(width_indent);
                for (int i = 0; i < oData.quickAdd_Combos[j].Count; i++)
                {
                    if (oData.setQuickAddCombo(j, i, EditorGUILayout.Popup(oData.quickAdd_Combos[j][i], AMTimeline.TrackNames, GUILayout.Width(80f))))
                    {
                        oData.flatten_quickAdd_Combos();
                        EditorUtility.SetDirty(oData);
                    }
                    if (i < oData.quickAdd_Combos[j].Count - 1)
                    {
                        GUILayout.Label("+");
                    }
                }
                GUILayout.FlexibleSpace();
                if (oData.quickAdd_Combos[j].Count > 0)
                {
                    if (GUILayout.Button("-", GUILayout.Width(20f), GUILayout.Height(20f)))
                    {
                        oData.quickAdd_Combos[j].RemoveAt(oData.quickAdd_Combos[j].Count - 1);
                        if (oData.quickAdd_Combos[j].Count == 0)
                        {
                            oData.quickAdd_Combos.RemoveAt(j);
                            j--;
                        }
                        oData.flatten_quickAdd_Combos();
                        EditorUtility.SetDirty(oData);
                    }
                }
                if (GUILayout.Button("+", GUILayout.Width(20f), GUILayout.Height(20f)))
                {
                    oData.quickAdd_Combos[j].Add((int)AMTimeline.Track.Translation);
                    oData.flatten_quickAdd_Combos();
                    EditorUtility.SetDirty(oData);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.Space(3f);
            GUILayout.BeginHorizontal();
            if (oData.quickAdd_Combos.Count <= 0)
            {
                GUILayout.Space(width_indent);
                GUILayout.Label("Click '+' to add a new combination");
            }
            GUILayout.FlexibleSpace();
            // new combo
            if (GUILayout.Button("+", GUILayout.Width(20f), GUILayout.Height(20f)))
            {
                oData.quickAdd_Combos.Add(new List <int> {
                    (int)AMTimeline.Track.Translation
                });
                oData.flatten_quickAdd_Combos();
                EditorUtility.SetDirty(oData);
            }
            GUILayout.EndHorizontal();
        }
        #endregion
        #region import / export
        else if (tabIndex == (int)tabType.ImportExport)
        {
            GUIStyle labelRight = new GUIStyle(GUI.skin.label);
            labelRight.alignment = TextAnchor.MiddleRight;
            GUILayout.Space(10f);
            GUILayout.BeginHorizontal(GUILayout.Width(300f));
            GUILayout.Space(width_indent);
            GUILayout.BeginVertical();
            GUILayout.Space(1f);
            GUILayout.Label("Take(s):", labelRight, GUILayout.Width(55f));
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Space(1f);
            if (GUILayout.Button("Import", GUILayout.Width(60f)))
            {
                AMTimeline.registerUndo("Import Take(s)");
                string importTakesPath = EditorUtility.OpenFilePanel("Import Take(s)", "Assets/", "unity");
                if (importTakesPath != "")
                {
                    AMTakeImport.openAdditiveAndDeDupe(importTakesPath);
                }
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Space(1f);
            if (GUILayout.Button("Export:", GUILayout.Width(60f)))
            {
                if (!exportAllTakes)
                {
                    AMTakeExport.take = aData.getTake(takeNames[exportTakeIndex]);
                }
                else
                {
                    AMTakeExport.take = null;
                }
                //AMTakeExport.aData = aData;
                //EditorWindow.GetWindow (typeof (AMTakeExport)).ShowUtility();
                EditorWindow windowExport = ScriptableObject.CreateInstance <AMTakeExport>();
                windowExport.ShowUtility();
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            exportAllTakes = (GUILayout.Toggle(!exportAllTakes, "") ? false : exportAllTakes);
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Space(4f);
            setExportTakeIndex(EditorGUILayout.Popup(exportTakeIndex, takeNames.ToArray(), GUILayout.Width(100f)));
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            exportAllTakes = (GUILayout.Toggle(exportAllTakes, "") ? true : exportAllTakes);
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Space(2f);
            GUILayout.Label("All Takes");
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();
            GUILayout.Space(3f);
            GUILayout.BeginHorizontal();
            GUILayout.Space(width_indent);
            GUILayout.Label("Options:", labelRight, GUILayout.Width(55f));
            if (GUILayout.Button("Import", GUILayout.Width(60f)))
            {
                AMTimeline.registerUndo("Import Options");
                string importOptionsPath = EditorUtility.OpenFilePanel("Import Options", "Assets/Animator", "unitypackage");
                if (importOptionsPath != "")
                {
                    AssetDatabase.ImportPackage(importOptionsPath, true);
                    this.Close();
                }
            }
            if (GUILayout.Button("Export", GUILayout.Width(60f)))
            {
                AMOptionsFile.export();
            }
            GUILayout.EndHorizontal();
        }
        #endregion
        #region about
        else if (tabIndex == (int)tabType.About)
        {
            GUILayout.Space(3f);

            string message = "Animator v" + version + ", Created by Abdulla Ameen (c) 2012.\nAMTween is derived from Bob Berkebile's iTween which falls under the MIT license.\n\nPlease have a look at the documentation if you need help, or e-mail [email protected] for further assistance.";
            message += "\n\nAdditional code contributions by:\nQuick Fingers, Eric Haines";
            GUIStyle styleInfo = new GUIStyle(GUI.skin.label);
            GUILayout.BeginHorizontal();
            GUILayout.Space(5);
            styleInfo.wordWrap = true;
            GUILayout.Label(message, styleInfo);
            GUILayout.EndHorizontal();
        }
        #endregion
        GUILayout.EndScrollView();
        GUILayout.EndVertical();
        #endregion
        GUILayout.EndHorizontal();
    }
示例#27
0
    void OnGUI()
    {
        AMTimeline.loadSkin(oData, ref skin, ref cachedSkinName, position);
        GUIStyle textStyle = new GUIStyle(GUI.skin.label);

        textStyle.wordWrap  = false;
        textStyle.alignment = TextAnchor.UpperLeft;
        textStyle.padding   = new RectOffset(0, 0, 10, 0);
        GUIStyle styleLabelCentered = new GUIStyle(GUI.skin.label);

        styleLabelCentered.alignment = TextAnchor.MiddleCenter;
        if (!aData)
        {
            AMTimeline.MessageBox("Animator requires an AnimatorData component in your scene. Launch Animator to add the component.", AMTimeline.MessageBoxType.Warning);
            return;
        }
        if (!oData)
        {
            oData = AMOptionsFile.loadFile();
        }
        #region drag logic
        Event e = Event.current;
        currentMousePosition = e.mousePosition;
        Rect rectWindow = new Rect(0f, 0f, position.width, position.height);
        mouseOverElement = (int)ElementType.None;
        //bool wasDragging = false;
        if (e.type == EventType.mouseDrag && EditorWindow.mouseOverWindow == this)
        {
            isDragging = true;
        }
        else if (e.type == EventType.mouseUp || /*EditorWindow.mouseOverWindow!=this*/ Event.current.rawType == EventType.MouseUp /*|| e.mousePosition.y < 0f*/)
        {
            if (isDragging)
            {
                //wasDragging = true;
                isDragging = false;
            }
        }
        // set cursor
        if (dragType == (int)DragType.ResizeInspector)
        {
            EditorGUIUtility.AddCursorRect(rectWindow, MouseCursor.ResizeHorizontal);
        }
        #endregion
        #region resize inspector
        if (dragType == (int)DragType.ResizeInspector)
        {
            width_inspector_open = start_width_inspector_open + (startScrubMousePosition.x - e.mousePosition.x);
        }
        width_inspector_open = Mathf.Clamp(width_inspector_open, width_inspector_open_min, position.width - width_code_min);
        #endregion
        GUILayout.BeginHorizontal();
        #region code vertical
        GUILayout.BeginVertical(GUILayout.Height(position.height));
        GUILayout.Space(3f);
        if (aData.setCodeLanguage(GUILayout.SelectionGrid(aData.codeLanguage, selStrings, 2 /*,styleSelGrid*/)))
        {
            // save data
            EditorUtility.SetDirty(aData);
            refreshCode();
        }
        GUILayout.Space(3f);
        // set scrollview background
        GUIStyle styleScrollView = new GUIStyle(GUI.skin.scrollView);
        styleScrollView.normal.background = GUI.skin.GetStyle("GroupElementBG").onNormal.background;
        scrollView = EditorGUILayout.BeginScrollView(scrollView, false, false, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, styleScrollView);
        Vector2 textSize = textStyle.CalcSize(new GUIContent(codeCache));
        GUILayout.BeginHorizontal();
        GUILayout.Space(10f);
        EditorGUILayout.SelectableLabel(codeCache, textStyle, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true), GUILayout.MinWidth(textSize.x + 30f), GUILayout.MinHeight(textSize.y + 30f));
        GUILayout.EndHorizontal();
        EditorGUILayout.EndScrollView();
        GUILayout.Space(3f);
        GUILayout.BeginHorizontal();
        // refresh button
        if (shouldRefresh)
        {
            GUI.color = Color.green;
        }
        if (GUILayout.Button("" /*,styleButton*/))
        {
            refreshCode();
        }
        GUI.color = Color.white;
        GUI.Label(GUILayoutUtility.GetLastRect(), "Refresh", styleLabelCentered);
        // copy to clipboard button
        if (GUILayout.Button("Copy to Clipboard"))
        {
            ClipboardHelper.clipBoard  = codeCache;
            GUIUtility.keyboardControl = 0;
            GUIUtility.hotControl      = 0;
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(3f);
        GUILayout.EndVertical();
        #endregion
        #region track list vertical
        GUILayout.BeginHorizontal(GUILayout.Width((isInspectorOpen ? width_inspector_open : width_inspector_closed)));
        //if(GUILayout.Button("O/C",GUILayout.Width(width_inspector_closed),GUILayout.Height(position.height))) {
        //isInspectorOpen = !isInspectorOpen;
        //}
        // properties button
        GUILayout.BeginVertical(GUILayout.Width(width_inspector_closed));
        GUILayout.Space(width_inspector_closed);
        Rect rectPropertiesButton = new Rect(position.width - (isInspectorOpen ? width_inspector_open : width_inspector_closed) - 1f, 0f, width_inspector_closed, position.height - 28f);
        if (GUI.Button(rectPropertiesButton, "", "label"))
        {
            isInspectorOpen = !isInspectorOpen;
        }
        GUI.color = AMTimeline.getSkinTextureStyleState("properties_bg").textColor;
        GUI.DrawTexture(rectPropertiesButton, AMTimeline.getSkinTextureStyleState("properties_bg").background);
        GUI.color = Color.white;
        GUI.DrawTexture(new Rect(rectPropertiesButton.x + 8f + (isInspectorOpen ? 1f : 0f), 12f, 22f, 19f), (isInspectorOpen ? texRightArrow : texLeftArrow));
        if (!isInspectorOpen)
        {
            int numSelected = 0;
            foreach (var pair in dictTracks)
            {
                if (pair.Value == true)
                {
                    numSelected++;
                }
            }
            if (numSelected < dictTracks.Count)
            {
                GUI.color = Color.red;
            }
            GUI.Label(new Rect(rectPropertiesButton.x, rectPropertiesButton.y + rectPropertiesButton.height, rectPropertiesButton.width, 28f), numSelected + "/" + dictTracks.Count, styleLabelCentered);
            GUI.color = Color.white;
        }
        GUILayout.EndVertical();
        if (isInspectorOpen)
        {
            GUILayout.BeginVertical(GUILayout.Width(width_inspector_open - width_inspector_closed));
            GUILayout.Space(inspector_space);
            GUILayout.Label("Track Selection");
            GUILayout.Space(inspector_space);
            GUILayout.BeginHorizontal();
            //GUILayout.Space(inspector_space);
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos /*,styleScrollView*/);
            for (int i = 0; i < aData.getCurrentTake().rootGroup.elements.Count; i++)
            {
                int id = aData.getCurrentTake().rootGroup.elements[i];
                //float height_group_elements = 0f;
                showGroupElement(id, 0);
            }
            GUILayout.EndScrollView();
            GUILayout.Space(inspector_space);
            GUILayout.EndHorizontal();
            // buttons
            GUILayout.Space(inspector_space);
            GUILayout.BeginHorizontal();
            Rect rectResizeInspector = new Rect(rectPropertiesButton.x, position.height - 15f - 8f, 15f, 15f);
            GUI.Button(rectResizeInspector, "", GUI.skin.GetStyle("ResizeTrackThumb"));
            EditorGUIUtility.AddCursorRect(rectResizeInspector, MouseCursor.ResizeHorizontal);
            if (rectResizeInspector.Contains(e.mousePosition) && mouseOverElement == (int)ElementType.None)
            {
                mouseOverElement = (int)ElementType.ResizeInspector;
            }

            if (GUILayout.Button("All", GUILayout.Width(42f)))
            {
                foreach (var key in dictTracks.Keys.ToList())
                {
                    dictTracks[key] = true;
                }
                refreshCode();
            }
            if (GUILayout.Button("None", GUILayout.Width(42f)))
            {
                foreach (var key in dictTracks.Keys.ToList())
                {
                    dictTracks[key] = false;
                }
                refreshCode();
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("JSON...", GUILayout.Width(58f)))
            {
                // export json
                exportJSON();
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(inspector_space);
            GUILayout.EndVertical();
        }
        GUILayout.EndHorizontal();
        #endregion
        GUILayout.EndHorizontal();
    }
示例#28
0
    void OnGUI()
    {
        AMTimeline.loadSkin(oData, ref skin, ref cachedSkinName, position);
        if(!aData) {
            AMTimeline.MessageBox("Animator requires an AnimatorData component in your scene. Launch Animator to add the component.",AMTimeline.MessageBoxType.Warning);
            return;
        }
        if(!oData) oData = AMOptionsFile.loadFile();
        GUILayout.BeginHorizontal();
        #region tab selection
        //GUI.DrawTexture(new Rect(0f,0f,120f,position.height),GUI.skin.GetStyle("GroupElementBG")/*GUI.skin.GetStyle("GroupElementBG").onNormal.background*/);
        GUIStyle styleTabSelectionBG = new GUIStyle(GUI.skin.GetStyle("GroupElementBG"));
        styleTabSelectionBG.normal.background = EditorStyles.toolbar.normal.background;
        GUILayout.BeginVertical(/*GUI.skin.GetStyle("GroupElementBG")*/styleTabSelectionBG, GUILayout.Width(121f));
            EditorGUIUtility.LookLikeControls();
            GUIStyle styleTabButton = new GUIStyle(EditorStyles.toolbarButton);
            styleTabButton.fontSize = 12;
            styleTabButton.fixedHeight = 30;
            styleTabButton.onNormal.background = styleTabButton.onActive.background;
            styleTabButton.onFocused.background = null;
            styleTabButton.onHover.background = null;
            tabIndex = GUILayout.SelectionGrid(tabIndex, tabNames, 1, styleTabButton);
        GUILayout.EndVertical();
        #endregion
        #region options
        GUILayout.BeginVertical();
            EditorGUIUtility.LookLikeControls();

            GUIStyle styleArea = new GUIStyle(GUI.skin.textArea);
            scrollView = GUILayout.BeginScrollView(scrollView,styleArea);
            List<string> takeNames = getTakeNames();

            GUIStyle styleTitle = new GUIStyle(GUI.skin.label);
            styleTitle.fontSize = 20;
            styleTitle.fontStyle = FontStyle.Bold;

            // tab title
            GUILayout.BeginHorizontal();
                GUILayout.Space(width_indent);
                GUILayout.Label(tabNames[tabIndex], styleTitle);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);

            #region general
            if(tabIndex == (int)tabType.General) {
                List<string> takeNamesWithNone = new List<string>(takeNames);
                takeNamesWithNone.Insert(0, "None");
                // play on start
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.Space(1f);
                        GUILayout.Label ("Play On Start");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(setPlayOnStartIndex(EditorGUILayout.Popup(playOnStartIndex,takeNamesWithNone.ToArray(),GUILayout.Width(200f)))) {
                        if(playOnStartIndex == 0) aData.playOnStart = null;
                        else aData.playOnStart = aData.getTake(takeNames[playOnStartIndex-1]);
                    }
                GUILayout.EndHorizontal();
                // gizmo size
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f),GUILayout.Width (80f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Gizmo size",GUILayout.Width (80f));
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(aData.setGizmoSize(GUILayout.HorizontalSlider(aData.gizmo_size,0f,0.1f,GUILayout.ExpandWidth(true)))) {
                        GUIUtility.keyboardControl = 0;
                        EditorUtility.SetDirty(aData);
                    }
                    GUILayout.BeginVertical(GUILayout.Height(26f),GUILayout.Width (75f));
                        GUILayout.FlexibleSpace();
                        if(aData.setGizmoSize(EditorGUILayout.FloatField(aData.gizmo_size,GUI.skin.textField,GUILayout.Width (75f)))) {
                            EditorUtility.SetDirty(aData);
                        }
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                // time instead of frame numbers
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Show time instead of frame numbers");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(oData.setTimeNumbering(GUILayout.Toggle(oData.time_numbering,""))) {
                        // save
                        EditorUtility.SetDirty(oData);
                    }
                GUILayout.EndHorizontal();
                // scrubby zoom cursor
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Scrubby zoom cursor");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(oData.setScrubbyZoomCursor(GUILayout.Toggle(oData.scrubby_zoom_cursor,""))) {
                        // save
                        EditorUtility.SetDirty(oData);
                    }
                GUILayout.EndHorizontal();
                // scrubby zoom slider
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Scrubby zoom slider");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(oData.setScrubbyZoomSlider(GUILayout.Toggle(oData.scrubby_zoom_slider,""))) {
                        // save
                        EditorUtility.SetDirty(oData);
                    }
                GUILayout.EndHorizontal();
                // show warning for lost references
                /*GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Show warning for lost references");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(oData.setShowWarningForLostReferences(GUILayout.Toggle(oData.showWarningForLostReferences,""))) {
                        // save
                        EditorUtility.SetDirty(oData);
                    }
                GUILayout.EndHorizontal();*/
                // ignore minimum window size warning
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Ignore minimum window size warning");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(oData.setIgnoreMinimumSizeWarning(GUILayout.Toggle(oData.ignoreMinSize,""))) {
                        // save
                        EditorUtility.SetDirty(oData);
                    }
                GUILayout.EndHorizontal();
                // show frames for collapsed tracks
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Show frames for collapsed tracks");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(oData.setShowFramesForCollapsedTracks(GUILayout.Toggle(oData.showFramesForCollapsedTracks,""))) {
                        // save
                        EditorUtility.SetDirty(oData);
                    }
                GUILayout.EndHorizontal();
                // disable timeline actions
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Hide Timeline Actions (May increase editor performance)");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(oData.setDisableTimelineActions(GUILayout.Toggle(oData.disableTimelineActions,""))) {
                        // save
                        EditorUtility.SetDirty(oData);
                        AMTimeline.recalculateNumFramesToRender();
                    }
                GUILayout.EndHorizontal();
                // disable timeline actions tooltip
                if(oData.disableTimelineActions) GUI.enabled = false;
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.FlexibleSpace();
                        GUILayout.Label ("Enable Timeline Actions tooltip");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    if(oData.disableTimelineActions) {
                        GUILayout.Toggle(false,"");
                    } else {
                        if(oData.setDisableTimelineActionsTooltip(!GUILayout.Toggle(!oData.disableTimelineActionsTooltip,""))) {
                            // save
                            EditorUtility.SetDirty(oData);
                        }
                    }
                GUILayout.EndHorizontal();
                GUI.enabled = true;
                // skin
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical(GUILayout.Height(26f));
                        GUILayout.Space(1f);
                        GUILayout.Label ("Skin");
                        GUILayout.FlexibleSpace();
                    GUILayout.EndVertical();
                    skinIndex = EditorGUILayout.Popup(skinIndex,skin_names,GUILayout.Width(200f));
                    if(oData.setSkin(skin_ids[skinIndex])) {
                        //if(playOnStartIndex == 0) aData.playOnStart = null;
                        //else aData.playOnStart = aData.getTake(takeNames[playOnStartIndex-1]);
                    }
                GUILayout.EndHorizontal();
            }
            #endregion
            #region quick add
            else if(tabIndex == (int)tabType.QuickAdd) {
                    EditorGUIUtility.LookLikeControls();
                    GUILayout.Space(3f);
                    GUILayout.BeginHorizontal();
                        GUILayout.Space(width_indent);
                        GUILayout.Label("Combinations");
                    GUILayout.EndHorizontal();
                    if(oData.quickAdd_Combos == null) oData.quickAdd_Combos = new List<List<int>>();
                    for(int j=0;j<oData.quickAdd_Combos.Count;j++) {
                        GUILayout.Space(3f);
                        GUILayout.BeginHorizontal();
                            GUILayout.Space(width_indent);
                            for(int i=0; i<oData.quickAdd_Combos[j].Count; i++) {
                                if(oData.setQuickAddCombo(j,i,EditorGUILayout.Popup(oData.quickAdd_Combos[j][i],AMTimeline.TrackNames,GUILayout.Width(80f)))) {
                                    oData.flatten_quickAdd_Combos();
                                    EditorUtility.SetDirty(oData);
                                }
                                if(i<oData.quickAdd_Combos[j].Count -1) GUILayout.Label("+");
                            }
                            GUILayout.FlexibleSpace();
                            if(oData.quickAdd_Combos[j].Count > 0)
                                if(GUILayout.Button("-", GUILayout.Width(20f), GUILayout.Height(20f))) {
                                    oData.quickAdd_Combos[j].RemoveAt(oData.quickAdd_Combos[j].Count-1);
                                    if(oData.quickAdd_Combos[j].Count == 0) {
                                        oData.quickAdd_Combos.RemoveAt(j);
                                        j--;
                                    }
                                    oData.flatten_quickAdd_Combos();
                                    EditorUtility.SetDirty(oData);
                                }
                            if(GUILayout.Button("+", GUILayout.Width(20f), GUILayout.Height(20f))) {
                                oData.quickAdd_Combos[j].Add ((int)AMTimeline.Track.Translation);
                                oData.flatten_quickAdd_Combos();
                                EditorUtility.SetDirty(oData);
                            }
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.Space(3f);
                    GUILayout.BeginHorizontal();
                        if(oData.quickAdd_Combos.Count <= 0) {
                            GUILayout.Space(width_indent);
                            GUILayout.Label("Click '+' to add a new combination");
                        }
                        GUILayout.FlexibleSpace();
                        // new combo
                        if(GUILayout.Button("+", GUILayout.Width(20f), GUILayout.Height(20f))) {
                            oData.quickAdd_Combos.Add(new List<int> {(int)AMTimeline.Track.Translation});
                            oData.flatten_quickAdd_Combos();
                            EditorUtility.SetDirty(oData);
                        }
                    GUILayout.EndHorizontal();
            }
            #endregion
            #region import / export
            else if(tabIndex == (int)tabType.ImportExport) {
                GUIStyle labelRight = new GUIStyle(GUI.skin.label);
                labelRight.alignment = TextAnchor.MiddleRight;
                GUILayout.Space(10f);
                GUILayout.BeginHorizontal(GUILayout.Width(300f));
                    GUILayout.Space(width_indent);
                    GUILayout.BeginVertical();
                    GUILayout.Space(1f);
                    GUILayout.Label("Take(s):",labelRight,GUILayout.Width(55f));
                    GUILayout.EndVertical();
                    GUILayout.BeginVertical();
                    GUILayout.Space(1f);
                    if(GUILayout.Button("Import",GUILayout.Width(60f))) {
                        AMTimeline.registerUndo("Import Take(s)");
                        string importTakesPath = EditorUtility.OpenFilePanel("Import Take(s)","Assets/","unity");
                        if(importTakesPath != "") AMTakeImport.openAdditiveAndDeDupe(importTakesPath);
                    }
                    GUILayout.EndVertical();
                    GUILayout.BeginVertical();
                    GUILayout.Space(1f);
                    if(GUILayout.Button("Export:",GUILayout.Width(60f))) {
                        if(!exportAllTakes) AMTakeExport.take = aData.getTake(takeNames[exportTakeIndex]);
                        else AMTakeExport.take = null;
                        //AMTakeExport.aData = aData;
                        //EditorWindow.GetWindow (typeof (AMTakeExport)).ShowUtility();
                        EditorWindow windowExport = ScriptableObject.CreateInstance<AMTakeExport>();
                        windowExport.ShowUtility();
                    }
                    GUILayout.EndVertical();
                    GUILayout.BeginVertical();
                    exportAllTakes = (GUILayout.Toggle(!exportAllTakes, "") ? false : exportAllTakes);
                    GUILayout.EndVertical();
                    GUILayout.BeginVertical();
                    GUILayout.Space(4f);
                    setExportTakeIndex(EditorGUILayout.Popup(exportTakeIndex,takeNames.ToArray(),GUILayout.Width(100f)));
                    GUILayout.EndVertical();
                    GUILayout.BeginVertical();
                    exportAllTakes = (GUILayout.Toggle(exportAllTakes, "") ? true : exportAllTakes);
                    GUILayout.EndVertical();
                    GUILayout.BeginVertical();
                    GUILayout.Space(2f);
                    GUILayout.Label("All Takes");
                    GUILayout.EndVertical();

                GUILayout.EndHorizontal();
                GUILayout.Space(3f);
                GUILayout.BeginHorizontal();
                    GUILayout.Space(width_indent);
                    GUILayout.Label("Options:",labelRight,GUILayout.Width(55f));
                    if(GUILayout.Button("Import",GUILayout.Width(60f))) {
                        AMTimeline.registerUndo("Import Options");
                        string importOptionsPath = EditorUtility.OpenFilePanel("Import Options","Assets/Animator","unitypackage");
                        if(importOptionsPath != "") {
                            AssetDatabase.ImportPackage(importOptionsPath,true);
                            this.Close();
                        }
                    }
                    if(GUILayout.Button("Export",GUILayout.Width(60f))) {
                        AMOptionsFile.export();
                    }
                GUILayout.EndHorizontal();
            }
            #endregion
            #region about
            else if(tabIndex == (int)tabType.About) {
                GUILayout.Space(3f);

                string message = "Animator v"+version+", Created by Abdulla Ameen (c) 2012.\nAMTween is derived from Bob Berkebile's iTween which falls under the MIT license.\n\nPlease have a look at the documentation if you need help, or e-mail [email protected] for further assistance.";
                message += "\n\nAdditional code contributions by:\nQuick Fingers, Eric Haines";
                GUIStyle styleInfo = new GUIStyle(GUI.skin.label);
                GUILayout.BeginHorizontal();
                    GUILayout.Space(5);
                    styleInfo.wordWrap = true;
                    GUILayout.Label(message,styleInfo);
                GUILayout.EndHorizontal();
            }
            #endregion
            GUILayout.EndScrollView();
            GUILayout.EndVertical();
            #endregion
        GUILayout.EndHorizontal();
    }
示例#29
0
    void OnEnable()
    {
        this.title = "Resolve Duplicates";
        this.minSize = new Vector2(590f,120f);
        actions = new List<int>();
        for(int i=0;i<newReference.Count;i++) actions.Add(0);

        oData = AMOptionsFile.loadFile();
    }
示例#30
0
    void OnEnable()
    {
        if(!texLoaded) {
            tex_orb = AMEditorResource.LoadEditorTexture("am_orb");
            texLoaded = true;
        }

        window = this;
        this.maxSize = new Vector2(715f,398f);
        this.minSize = this.maxSize;
        this.wantsMouseMove = true;
        loadAnimatorData();
        oData = AMOptionsFile.loadFile();
        setupFilteredCategories();

        selectedIndex = getCategoryIndexForEase(key.easeType);

        if(getSelectedEaseName(category,selectedIndex) == "Custom") {
            isCustomEase = true;
        }
        if(isCustomEase && key.customEase.Count > 0) {
            curve = key.getCustomEaseCurve();
        } else {
            setEasingCurve();
        }
    }