示例#1
0
        public override void OnInspectorGUI()
        {
            var SMBScript = target as IKHelperToolSMB;

            GUI.enabled = true;
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            EditorStyles.label.fontStyle = FontStyle.Bold;
            int iID = EditorGUILayout.IntField("State IK ID:", SMBScript.id);

            EditorStyles.label.fontStyle = FontStyle.Normal;
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Changed ID");
                SMBScript.id = iID;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            iID = EditorGUILayout.Popup("IK Type:", SMBScript.selectorIKType, IKHelperUtils.IKGoalNames, EditorStyles.popup);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Changed IK Goal");
                SMBScript.selectorIKType = iID;
                SMBScript.goal           = (IKType)iID;
            }
            GUILayout.EndHorizontal();

            IKHelperUtils.DrawUILine(Color.black, 1, 5);

            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Attachment ID: 00", EditorStyles.boldLabel);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            bool iBool = EditorGUILayout.Toggle("Smooth Entry", SMBScript.smoothEntry);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Change Smooth Entry");
                SMBScript.smoothEntry = iBool;
            }
            GUILayout.EndHorizontal();

            if (SMBScript.smoothEntry)
            {
                GUI.enabled = true;
            }
            else
            {
                GUI.enabled = false;
            }

            if (SMBScript.speed < 0.01f)
            {
                SMBScript.speed = 0.01f;
            }

            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            float iFloat = EditorGUILayout.FloatField("Speed (seconds):", SMBScript.speed);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Change IK Speed");
                SMBScript.speed = iFloat;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            iBool = EditorGUILayout.Toggle("Skip First Time", SMBScript.defaultState);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Change Skip First Time");
                SMBScript.defaultState = iBool;
            }
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            IKHelperUtils.DrawUILine(Color.black, 1, 5);

            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            bool clearExit = EditorGUILayout.Toggle("Clear IK on Exit:", SMBScript.clearOnExit);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Change Clear IK on Exit");
                SMBScript.clearOnExit = clearExit;
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(2);

            GUILayout.BeginHorizontal();
            GUIContent buttonContent;

            if (EditorApplication.isPlaying)
            {
                if (IKHelperUtils.singleClipboard)
                {
                    buttonContent = new GUIContent("Variables copied!", "Copy changes made in Play Mode");
                }
                else
                {
                    buttonContent = new GUIContent("Copy variables", "Copy changes made in Play Mode");
                }
                if (GUILayout.Button(buttonContent))
                {
                    IKHelperUtils.savedSingleSMB.id             = SMBScript.id;
                    IKHelperUtils.savedSingleSMB.selectorIKType = SMBScript.selectorIKType;
                    IKHelperUtils.savedSingleSMB.goal           = SMBScript.goal;
                    IKHelperUtils.savedSingleSMB.smoothEntry    = SMBScript.smoothEntry;
                    IKHelperUtils.savedSingleSMB.speed          = SMBScript.speed;
                    IKHelperUtils.savedSingleSMB.defaultState   = SMBScript.defaultState;
                    IKHelperUtils.savedSingleSMB.clearOnExit    = SMBScript.clearOnExit;
                    IKHelperUtils.singleClipboard = true;
                }
            }
            else
            {
                GUI.enabled   = IKHelperUtils.singleClipboard;
                buttonContent = new GUIContent("Paste variables", "Paste changes made in Play Mode");
                if (GUILayout.Button(buttonContent))
                {
                    EditorGUI.BeginChangeCheck();
                    GUI.changed = true;

                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Pasted variables");
                    }

                    SMBScript.id             = IKHelperUtils.savedSingleSMB.id;
                    SMBScript.selectorIKType = IKHelperUtils.savedSingleSMB.selectorIKType;
                    SMBScript.goal           = IKHelperUtils.savedSingleSMB.goal;
                    SMBScript.smoothEntry    = IKHelperUtils.savedSingleSMB.smoothEntry;
                    SMBScript.speed          = IKHelperUtils.savedSingleSMB.speed;
                    SMBScript.defaultState   = IKHelperUtils.savedSingleSMB.defaultState;
                    SMBScript.clearOnExit    = IKHelperUtils.savedSingleSMB.clearOnExit;
                    Debug.Log("Pasted variables.");
                }
                GUI.enabled = true;
            }
            GUILayout.EndHorizontal();

            if (GUI.changed)
            {
                if (!EditorApplication.isPlaying)
                {
                    EditorUtility.SetDirty(target);
                    EditorApplication.MarkSceneDirty();
                }
            }
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            var iKScript = target as IKHelperTool;

            if (iKScript.stateIKs == null)
            {
                iKScript.stateIKs = new List <StateIK>();
            }
            List <StateIK> iStateIKs = new List <StateIK>(iKScript.stateIKs);

            GUILayout.Space(5);

            GUIContent buttonContent = null;

            //Edit Mode Button
            GUILayout.BeginHorizontal();
            GUILayout.Space(30);
            GUI.enabled = EditorApplication.isPlaying;
            if (iKScript.editingIK)
            {
                buttonContent = new GUIContent("[Editing Mode ON]\nAnimation stopped.", "Click to return to normal speed.");
                if (GUILayout.Button(buttonContent))
                {
                    iKScript.animator.speed = iKScript.animatorSpeed;
                    iKScript.editingIK      = false;
                }
            }
            else
            {
                buttonContent = new GUIContent("[Editing Mode OFF]\n(Only in Play mode)", "Easily edit your attachment (Play mode only).");
                if (GUILayout.Button(buttonContent))
                {
                    iKScript.animatorSpeed  = iKScript.animator.speed;
                    iKScript.animator.speed = 0f;
                    iKScript.editingIK      = true;
                }
            }
            GUILayout.EndHorizontal();
            GUI.enabled = true;

            //Separator line
            GUILayout.BeginHorizontal();
            GUILayout.Space(30);
            IKHelperUtils.DrawUILine(Color.black, 1, 5);
            GUILayout.EndHorizontal();

            //IK States
            for (int i = 0; i < iKScript.stateIKs.Count; i++)
            {
                //[X] Remove IK Button
                GUILayout.BeginHorizontal();
                GUILayout.Space(30);
                buttonContent = new GUIContent("[X]", "Remove this IK State");
                if (GUILayout.Button(buttonContent, GUILayout.Width(30)))
                {
                    EditorGUI.BeginChangeCheck();
                    GUI.changed = true;
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Removed State IK");
                    }
                    iKScript.stateIKs.RemoveAt(i);
                    break;
                }

                //Open State Button (ID and Name)
                string stateName     = "ID: " + i.ToString("00") + " - " + iKScript.stateIKs[i].iKName;
                Color  previousColor = GUI.color;

                if (iKScript.playing && iKScript.stateIKs[i].isActive)
                {
                    stateName = stateName + " (PLAYING)";

                    if (iKScript.stateIKs[i].incomplete)
                    {
                        GUI.color = IKColors.incompleteIKColor;
                    }
                    else
                    {
                        GUI.color = IKColors.workingIKColor;
                    }
                }

                if (iKScript.stateIKs[i].open)
                {
                    GUI.skin.button.alignment = TextAnchor.MiddleLeft;
                    if (GUILayout.Button("▼ " + stateName))
                    {
                        iKScript.stateIKs[i].open = !iKScript.stateIKs[i].open;
                    }
                    GUI.color = previousColor;
                    GUILayout.EndHorizontal();
                    GUI.skin.button.alignment = TextAnchor.MiddleCenter;

                    //Rename field
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(60);
                    EditorGUI.BeginChangeCheck();
                    string iName = EditorGUILayout.TextField("", iKScript.stateIKs[i].iKName);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "IK State rename");
                        iKScript.stateIKs[i].iKName = iName;
                    }
                    GUILayout.EndHorizontal();

                    //Single IK / Sequence IK Buttons
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(60);
                    GUI.enabled   = iKScript.stateIKs[i].isSequence;
                    buttonContent = new GUIContent("Single IK", "Use only 1 IK per animation (default)");
                    if (GUILayout.Button(buttonContent))
                    {
                        iKScript.stateIKs[i].isSequence = !iKScript.stateIKs[i].isSequence;
                    }

                    if (iKScript.stateIKs[i].IKs.Count <= 0)
                    {
                        iKScript.stateIKs[i].IKs.Add(new IKAttachment());
                    }

                    GUI.enabled   = !iKScript.stateIKs[i].isSequence;
                    buttonContent = new GUIContent("Sequence of IK", "Use more than 1 IK in the same animation");
                    if (GUILayout.Button(buttonContent))
                    {
                        iKScript.stateIKs[i].isSequence = !iKScript.stateIKs[i].isSequence;
                    }
                    GUILayout.EndHorizontal();

                    //IK Attachments
                    GUI.enabled = true;
                    List <IKAttachment> iIKAttachments = new List <IKAttachment>(iKScript.stateIKs[i].IKs);
                    for (int k = 0; k < iKScript.stateIKs[i].IKs.Count; k++)
                    {
                        int incompleteFields = 0;

                        //Open State Button (ID and Name)
                        string ikName = "Attachment ID: " + k.ToString("00");
                        if (iKScript.playing && iKScript.stateIKs[i].isActive && iKScript.stateIKs[i].activeAttachment == k)
                        {
                            ikName = ikName + " [PLAYING]";
                        }

                        GUILayout.BeginHorizontal();
                        GUILayout.Space(60);
                        EditorGUILayout.LabelField(ikName, EditorStyles.boldLabel);
                        GUILayout.EndHorizontal();


                        GUILayout.BeginHorizontal();
                        GUILayout.Space(60);

                        //Remove IK Attachment (IK Sequence only)
                        if (iKScript.stateIKs[i].isSequence)
                        {
                            if (k > 0)
                            {
                                buttonContent = new GUIContent("[X]", "Remove this IK Attachment");
                                if (GUILayout.Button(buttonContent, GUILayout.Width(30)))
                                {
                                    EditorGUI.BeginChangeCheck();
                                    GUI.changed = true;
                                    if (EditorGUI.EndChangeCheck())
                                    {
                                        Undo.RegisterUndo(target, "Removed IK Attachment");
                                    }
                                    iKScript.stateIKs[i].IKs.RemoveAt(k);
                                    break;
                                }
                            }
                        }

                        if (iKScript.stateIKs[i].IKs[k].iKAttachment == null)
                        {
                            GUI.color        = IKColors.incompleteIKColor;
                            incompleteFields = 2;
                        }

                        //IK Attachment Transform field (Game Object)
                        EditorGUI.BeginChangeCheck();
                        Transform iIKAttachment = EditorGUILayout.ObjectField("", iKScript.stateIKs[i].IKs[k].iKAttachment, typeof(Transform)) as Transform;
                        if (EditorGUI.EndChangeCheck())
                        {
                            Undo.RegisterUndo(target, "Change IK Attachment");
                            iKScript.stateIKs[i].IKs[k].iKAttachment = iIKAttachment;
                        }
                        GUILayout.EndHorizontal();
                        GUI.color = previousColor;

                        if (!iKScript.stateIKs[i].IKs[k].useLocation)
                        {
                            if (!iKScript.stateIKs[i].IKs[k].useRotation)
                            {
                                GUI.color = IKColors.incompleteIKColor;
                            }
                            incompleteFields++;
                        }

                        //Enable follow IK Attachment Location
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(60);
                        EditorGUI.BeginChangeCheck();
                        bool iUseLocation = EditorGUILayout.Toggle("Use Location", iKScript.stateIKs[i].IKs[k].useLocation);
                        if (EditorGUI.EndChangeCheck())
                        {
                            Undo.RegisterUndo(target, "Change IK Use Location");
                            iKScript.stateIKs[i].IKs[k].useLocation = iUseLocation;
                        }
                        GUILayout.EndHorizontal();
                        GUI.color = previousColor;


                        if (!iKScript.stateIKs[i].IKs[k].useRotation)
                        {
                            if (!iKScript.stateIKs[i].IKs[k].useLocation)
                            {
                                GUI.color = IKColors.incompleteIKColor;
                            }
                            incompleteFields++;
                        }

                        //Enable follow IK Attachment Rotation
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(60);
                        EditorGUI.BeginChangeCheck();
                        bool iUseRotation = EditorGUILayout.Toggle("Use Rotation", iKScript.stateIKs[i].IKs[k].useRotation);
                        if (EditorGUI.EndChangeCheck())
                        {
                            Undo.RegisterUndo(target, "Change IK Use Rotation");
                            iKScript.stateIKs[i].IKs[k].useRotation = iUseRotation;
                        }
                        GUILayout.EndHorizontal();
                        GUI.color = previousColor;

                        if (incompleteFields >= 2)
                        {
                            iKScript.stateIKs[i].incomplete = true;
                        }
                        else
                        {
                            iKScript.stateIKs[i].incomplete = false;
                        }

                        //Copy IK Attachment Transform values in Play Mode
                        GUI.enabled = true;
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(60);
                        if (EditorApplication.isPlaying)
                        {
                            if (IKHelperUtils.IKClipboard && IKHelperUtils.IKClipBoardId == k)
                            {
                                buttonContent = new GUIContent("IK " + k.ToString("00") + " copied!", "Copy changes made in Play Mode");
                            }
                            else
                            {
                                buttonContent = new GUIContent("Copy IK Position/Rotation", "Copy changes made in Play Mode");
                            }
                            if (GUILayout.Button(buttonContent))
                            {
                                IKHelperUtils.copiedPos = iKScript.stateIKs[i].IKs[k].iKAttachment.localPosition;
                                IKHelperUtils.copiedRot = iKScript.stateIKs[i].IKs[k].iKAttachment.localEulerAngles;

                                IKHelperUtils.IKClipboard   = true;
                                IKHelperUtils.IKClipBoardId = k;
                            }
                        }
                        else
                        {
                            //Paste IK Attachment Transform values from Play Mode
                            GUI.enabled = IKHelperUtils.IKClipboard;

                            buttonContent = new GUIContent("Paste IK Position/Rotation", "Paste changes made in Play Mode");

                            if (GUILayout.Button(buttonContent))
                            {
                                EditorGUI.BeginChangeCheck();
                                GUI.changed = true;

                                if (EditorGUI.EndChangeCheck())
                                {
                                    Undo.RegisterUndo(target, "Pasted " + k.ToString("00") + " IK Pos/Rot");
                                }

                                iKScript.stateIKs[i].IKs[k].iKAttachment.localPosition    = IKHelperUtils.copiedPos;
                                iKScript.stateIKs[i].IKs[k].iKAttachment.localEulerAngles = IKHelperUtils.copiedRot;

                                Debug.Log("Pasted IK Position/Rotation on IK Attachment " + k.ToString("00") + " in State " + i.ToString("00") + ".");
                            }
                            GUI.enabled = true;
                        }
                        GUILayout.EndHorizontal();

                        if (iKScript.stateIKs[i].isSequence)
                        {
                            GUILayout.BeginHorizontal();
                            GUILayout.Space(60);
                            IKHelperUtils.DrawUILine(Color.black, 1, 10);
                            GUILayout.EndHorizontal();
                        }
                        else
                        {
                            break;
                        }
                    }

                    //Add IK Attachment (IK Sequence only)
                    if (iKScript.stateIKs[i].isSequence)
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(60);

                        iIKAttachments = new List <IKAttachment>(iKScript.stateIKs[i].IKs);
                        buttonContent  = new GUIContent("[+] Add IK Attachment", "Add a new IK attachment");
                        if (GUILayout.Button(buttonContent))
                        {
                            EditorGUI.BeginChangeCheck();
                            GUI.changed = true;

                            if (EditorGUI.EndChangeCheck())
                            {
                                Undo.RegisterUndo(target, "Added IK Attachment");
                            }

                            iKScript.stateIKs[i].IKs.Add(new IKAttachment());
                        }
                        GUILayout.EndHorizontal();
                    }
                }
                else
                {
                    GUI.skin.button.alignment = TextAnchor.MiddleLeft;
                    if (GUILayout.Button("► " + stateName))
                    {
                        iKScript.stateIKs[i].open = !iKScript.stateIKs[i].open;
                    }
                    GUI.color = previousColor;
                    GUILayout.EndHorizontal();
                    GUI.skin.button.alignment = TextAnchor.MiddleCenter;
                }
                GUILayout.BeginHorizontal();
                GUILayout.Space(30);
                IKHelperUtils.DrawUILine(Color.black, 1, 5);
                GUILayout.EndHorizontal();
            }

            //[+] Add State IK Button
            GUILayout.BeginHorizontal();
            GUILayout.Space(30);
            iStateIKs     = new List <StateIK>(iKScript.stateIKs);
            buttonContent = new GUIContent("[+] Add State IK", "Add a new IK to take effect while in a state");
            if (GUILayout.Button(buttonContent))
            {
                EditorGUI.BeginChangeCheck();
                GUI.changed = true;

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterUndo(target, "Added State IK");
                }

                iKScript.stateIKs.Add(new StateIK());
            }
            GUILayout.EndHorizontal();

            if (GUI.changed)
            {
                if (!EditorApplication.isPlaying)
                {
                    EditorUtility.SetDirty(target);
                    EditorApplication.MarkSceneDirty();
                }
            }
        }
示例#3
0
        public override void OnInspectorGUI()
        {
            var SMBScript = target as IKHelperToolSequenceSMB;

            if (SMBScript.iKSequence == null)
            {
                SMBScript.iKSequence = new List <IKSequence>();
            }

            GUI.enabled = true;
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            EditorStyles.label.fontStyle = FontStyle.Bold;
            int iID = EditorGUILayout.IntField("State IK ID:", SMBScript.id);

            EditorStyles.label.fontStyle = FontStyle.Normal;
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Changed ID");
                SMBScript.id = iID;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            iID = EditorGUILayout.Popup("IK Type:", SMBScript.selectorIKType, IKHelperUtils.IKGoalNames, EditorStyles.popup);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Changed IK Goal");
                SMBScript.selectorIKType = iID;
                SMBScript.goal           = (IKType)iID;
            }
            GUILayout.EndHorizontal();

            IKHelperUtils.DrawUILine(Color.black, 1, 5);

            GUIContent buttonContent = null;

            for (int i = 0; i < SMBScript.iKSequence.Count; i++)
            {
                if (!SMBScript.iKSequence[i].useDefault)
                {
                    GUILayout.BeginHorizontal();
                    EditorGUI.BeginChangeCheck();
                    EditorStyles.label.fontStyle = FontStyle.Bold;
                    iID = EditorGUILayout.IntField("#" + i + "- Attachment ID: ", SMBScript.iKSequence[i].attachment);
                    EditorStyles.label.fontStyle = FontStyle.Normal;
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Changed ID");
                        SMBScript.iKSequence[i].attachment = iID;
                    }
                    GUILayout.EndHorizontal();
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("#" + i + "- Default Animation", EditorStyles.boldLabel);
                    GUILayout.EndHorizontal();
                }

                GUI.enabled = true;
                GUILayout.BeginHorizontal();
                EditorGUI.BeginChangeCheck();
                bool iDefault = EditorGUILayout.Toggle("Use default animation:", SMBScript.iKSequence[i].useDefault);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterUndo(target, "Change Use Default Animation");
                    SMBScript.iKSequence[i].useDefault = iDefault;
                }
                GUILayout.EndHorizontal();

                if (i == 0)
                {
                    GUILayout.BeginHorizontal();
                    EditorGUI.BeginChangeCheck();
                    bool iBool = EditorGUILayout.Toggle("Smooth Entry:", SMBScript.smoothEntry);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Change Smooth Entry");
                        SMBScript.smoothEntry = iBool;
                    }
                    GUILayout.EndHorizontal();

                    if (SMBScript.smoothEntry)
                    {
                        GUI.enabled = true;
                    }
                    else
                    {
                        GUI.enabled = false;
                    }

                    GUILayout.BeginHorizontal();
                    EditorGUI.BeginChangeCheck();
                    float iFloat = EditorGUILayout.FloatField("Speed (seconds):", SMBScript.iKSequence[i].speed);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Change IK Speed");
                        SMBScript.iKSequence[i].speed = iFloat;
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    EditorGUI.BeginChangeCheck();
                    iBool = EditorGUILayout.Toggle("Skip First Time:", SMBScript.defaultState);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Change Skip First Time");
                        SMBScript.defaultState = iBool;
                    }
                    GUILayout.EndHorizontal();
                    GUI.enabled = true;
                }
                else
                {
                    if (SMBScript.iKSequence[i].speed < 0.01f)
                    {
                        SMBScript.iKSequence[i].speed = 0.01f;
                    }

                    GUILayout.BeginHorizontal();
                    EditorGUI.BeginChangeCheck();
                    float iFloat = EditorGUILayout.FloatField("Delay (seconds):", SMBScript.iKSequence[i].time);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Change IK Delay");
                        SMBScript.iKSequence[i].time = iFloat;
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    EditorGUI.BeginChangeCheck();
                    iFloat = EditorGUILayout.FloatField("Speed (seconds):", SMBScript.iKSequence[i].speed);
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Change IK Speed");
                        SMBScript.iKSequence[i].speed = iFloat;
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    buttonContent = new GUIContent("[X] Delete this IK Entry", "Remove this IK Entry");
                    if (GUILayout.Button(buttonContent))
                    {
                        EditorGUI.BeginChangeCheck();
                        GUI.changed = true;
                        if (EditorGUI.EndChangeCheck())
                        {
                            Undo.RegisterUndo(target, "Removed IK Entry");
                        }
                        SMBScript.iKSequence.RemoveAt(i);
                        break;
                    }
                    GUILayout.EndHorizontal();
                }

                IKHelperUtils.DrawUILine(Color.black, 1, 5);
            }

            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            bool clearExit = EditorGUILayout.Toggle("Clear IK on Exit:", SMBScript.clearOnExit);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterUndo(target, "Change Clear IK on Exit");
                SMBScript.clearOnExit = clearExit;
            }
            GUILayout.EndHorizontal();

            IKHelperUtils.DrawUILine(Color.black, 1, 5);

            GUILayout.BeginHorizontal();
            List <IKSequence> iIKSequence = new List <IKSequence>(SMBScript.iKSequence);

            buttonContent = new GUIContent("[+] Add IK Entry (IK Attachment)", "Add a new IK entry to link with an IK Attachment");
            if (GUILayout.Button(buttonContent))
            {
                EditorGUI.BeginChangeCheck();
                GUI.changed = true;

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RegisterUndo(target, "Added IK Entry");
                }

                SMBScript.iKSequence.Add(new IKSequence());
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(2);

            GUILayout.BeginHorizontal();
            if (EditorApplication.isPlaying)
            {
                if (IKHelperUtils.sequenceClipboard)
                {
                    buttonContent = new GUIContent("Variables copied!", "Copy changes made in Play Mode");
                }
                else
                {
                    buttonContent = new GUIContent("Copy variables", "Copy changes made in Play Mode");
                }
                if (GUILayout.Button(buttonContent))
                {
                    IKHelperUtils.savedSequenceSMB.id             = SMBScript.id;
                    IKHelperUtils.savedSequenceSMB.selectorIKType = SMBScript.selectorIKType;
                    IKHelperUtils.savedSequenceSMB.goal           = SMBScript.goal;
                    IKHelperUtils.savedSequenceSMB.smoothEntry    = SMBScript.smoothEntry;
                    IKHelperUtils.savedSequenceSMB.defaultState   = SMBScript.defaultState;
                    IKHelperUtils.savedSequenceSMB.clearOnExit    = SMBScript.clearOnExit;
                    IKHelperUtils.savedSequenceSMB.iKSequence     = new List <IKSequence>(SMBScript.iKSequence);

                    IKHelperUtils.sequenceClipboard = true;
                }
            }
            else
            {
                GUI.enabled   = IKHelperUtils.sequenceClipboard;
                buttonContent = new GUIContent("Paste variables", "Paste changes made in Play Mode");
                if (GUILayout.Button(buttonContent))
                {
                    EditorGUI.BeginChangeCheck();
                    GUI.changed = true;

                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RegisterUndo(target, "Pasted variables");
                    }

                    SMBScript.id             = IKHelperUtils.savedSequenceSMB.id;
                    SMBScript.selectorIKType = IKHelperUtils.savedSequenceSMB.selectorIKType;
                    SMBScript.goal           = IKHelperUtils.savedSequenceSMB.goal;
                    SMBScript.smoothEntry    = IKHelperUtils.savedSequenceSMB.smoothEntry;
                    SMBScript.defaultState   = IKHelperUtils.savedSequenceSMB.defaultState;
                    SMBScript.clearOnExit    = IKHelperUtils.savedSequenceSMB.clearOnExit;
                    SMBScript.iKSequence     = new List <IKSequence>(IKHelperUtils.savedSequenceSMB.iKSequence);

                    Debug.Log("Pasted variables.");
                }
                GUI.enabled = true;
            }
            GUILayout.EndHorizontal();

            if (GUI.changed)
            {
                if (!EditorApplication.isPlaying)
                {
                    EditorUtility.SetDirty(target);
                    EditorApplication.MarkSceneDirty();
                }
            }
        }