예제 #1
0
        private bool EditGameObjectInternal(GameObject gameObject, IAnimationWindowControl controlInterface)
        {
            bool result;

            if (EditorUtility.IsPersistent(gameObject))
            {
                result = false;
            }
            else if ((gameObject.hideFlags & HideFlags.NotEditable) != HideFlags.None)
            {
                result = false;
            }
            else
            {
                GameObjectSelectionItem gameObjectSelectionItem = GameObjectSelectionItem.Create(gameObject);
                if (this.ShouldUpdateGameObjectSelection(gameObjectSelectionItem))
                {
                    this.m_AnimEditor.selectedItem             = gameObjectSelectionItem;
                    this.m_AnimEditor.overrideControlInterface = controlInterface;
                    result = true;
                }
                else
                {
                    UnityEngine.Object.DestroyImmediate(gameObjectSelectionItem);
                    result = false;
                }
            }
            return(result);
        }
예제 #2
0
        private bool EditGameObjectInternal(GameObject gameObject, IAnimationWindowControl controlInterface)
        {
            bool result;

            if (EditorUtility.IsPersistent(gameObject))
            {
                result = false;
            }
            else if ((gameObject.hideFlags & HideFlags.NotEditable) != HideFlags.None)
            {
                result = false;
            }
            else
            {
                GameObjectSelectionItem gameObjectSelectionItem = GameObjectSelectionItem.Create(gameObject);
                if (this.ShouldUpdateGameObjectSelection(gameObjectSelectionItem))
                {
                    this.m_AnimEditor.selection = gameObjectSelectionItem;
                    this.m_AnimEditor.overrideControlInterface = controlInterface;
                    this.m_LastSelectedObjectID = ((!(gameObject != null)) ? 0 : gameObject.GetInstanceID());
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
예제 #3
0
        private bool EditGameObjectInternal(GameObject gameObject, IAnimationWindowControl controlInterface)
        {
            if (EditorUtility.IsPersistent(gameObject))
            {
                return(false);
            }

            if ((gameObject.hideFlags & HideFlags.NotEditable) != 0)
            {
                return(false);
            }

            var newSelection = GameObjectSelectionItem.Create(gameObject);

            if (ShouldUpdateGameObjectSelection(newSelection))
            {
                m_AnimEditor.selection = newSelection;
                m_AnimEditor.overrideControlInterface = controlInterface;

                m_LastSelectedObjectID = gameObject != null?gameObject.GetInstanceID() : 0;
            }
            else
            {
                return(false);
            }

            return(true);
        }
예제 #4
0
 public void EditGameObject(GameObject gameObject)
 {
     if (!EditorUtility.IsPersistent(gameObject) && ((gameObject.hideFlags & HideFlags.NotEditable) == HideFlags.None))
     {
         GameObjectSelectionItem selectedItem = GameObjectSelectionItem.Create(gameObject);
         if (this.ShouldUpdateSelection(selectedItem))
         {
             this.m_AnimEditor.state.recording = false;
             this.m_AnimEditor.selectedItem    = selectedItem;
         }
         else
         {
             UnityEngine.Object.DestroyImmediate(selectedItem);
         }
     }
 }
예제 #5
0
        private bool ShouldUpdateSelection(GameObjectSelectionItem selectedItem)
        {
            bool result;

            if (this.m_AnimEditor.locked)
            {
                result = false;
            }
            else if (selectedItem.rootGameObject == null)
            {
                result = true;
            }
            else
            {
                AnimationWindowSelectionItem currentlySelectedItem = this.m_AnimEditor.selectedItem;
                if (currentlySelectedItem != null)
                {
                    if (selectedItem.rootGameObject != currentlySelectedItem.rootGameObject)
                    {
                        result = true;
                    }
                    else if (currentlySelectedItem.animationClip == null)
                    {
                        result = true;
                    }
                    else
                    {
                        if (currentlySelectedItem.rootGameObject != null)
                        {
                            AnimationClip[] animationClips = AnimationUtility.GetAnimationClips(currentlySelectedItem.rootGameObject);
                            if (!Array.Exists <AnimationClip>(animationClips, (AnimationClip x) => x == currentlySelectedItem.animationClip))
                            {
                                result = true;
                                return(result);
                            }
                        }
                        result = false;
                    }
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
예제 #6
0
        private bool ShouldUpdateGameObjectSelection(GameObjectSelectionItem selectedItem)
        {
            if (m_LockTracker.isLocked)
            {
                return(false);
            }

            if (state.linkedWithSequencer)
            {
                return(false);
            }

            // Selected game object with no animation player.
            if (selectedItem.rootGameObject == null)
            {
                return(true);
            }

            AnimationWindowSelectionItem currentSelection = m_AnimEditor.selection;

            // Game object holding animation player has changed.  Update selection.
            if (selectedItem.rootGameObject != currentSelection.rootGameObject)
            {
                return(true);
            }

            // No clip in current selection, favour new selection.
            if (currentSelection.animationClip == null)
            {
                return(true);
            }

            // Make sure that animation clip is still referenced in animation player.
            if (currentSelection.rootGameObject != null)
            {
                AnimationClip[] allClips = AnimationUtility.GetAnimationClips(currentSelection.rootGameObject);
                if (!Array.Exists(allClips, x => x == currentSelection.animationClip))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #7
0
 private bool ShouldUpdateSelection(GameObjectSelectionItem selectedItem)
 {