Пример #1
0
        public void reloadAnimate()
        {
            aData = null;
            loadAnimatorData();
            bool shouldClose = true;

            if (aData != null)
            {
                Take take = aData.currentTake;
                // update references for track and key
                foreach (var _track in take.trackValues)
                {
                    if (track == _track)
                    {
                        track = _track;
                        foreach (Key _key in track.keys)
                        {
                            if (key == _key)
                            {
                                key         = _key;
                                shouldClose = false;
                            }
                        }
                    }
                }
            }
            if (shouldClose)
            {
                this.Close();
            }
        }
        static void DrawGizmos(Animate aData, GizmoType gizmoType)
        {
            //check if it's the one opened
            if (TimelineWindow.window != null && TimelineWindow.window.aData != null && TimelineWindow.window.aData.IsDataMatch(aData))
            {
                AnimateEditControl eData = TimelineWindow.AnimEdit(aData);

                List <Take> _t = eData.takes;

                if (_t == null || _t.Count == 0)
                {
                    return;
                }
                if (eData.currentTakeInd < 0)
                {
                    eData.currentTakeInd = 0;
                }
                else if (eData.currentTakeInd >= _t.Count)
                {
                    eData.currentTakeInd = _t.Count - 1;
                }

                _t[eData.currentTakeInd].drawGizmos(eData.target, AnimateTimeline.e_gizmoSize, Application.isPlaying);
            }
        }
Пример #3
0
        void OnEnable()
        {
            aData = new AnimateEditControl(target as Animate);
            GenerateTakeLabels();

            mMissingsFoldout = true;
        }
Пример #4
0
 void OnDisable()
 {
     window  = null;
     justSet = false;
     key     = null;
     track   = null;
     aData   = null;
 }
Пример #5
0
 public void MergeWith(AnimateEditControl _aData)
 {
     if (meta == null && _aData.meta == null)
     {
         foreach (var take in _aData.takes)
         {
             takes.Add(take);
             MakeTakeNameUnique(take);
         }
     }
 }
Пример #6
0
 void loadAnimatorData()
 {
     if (TimelineWindow.window)
     {
         mData = TimelineWindow.window.aData;
     }
     else
     {
         mData = null;
     }
 }
Пример #7
0
 void loadAnimatorData()
 {
     if (TimelineWindow.window != null)
     {
         __aData = TimelineWindow.window.aData;
         if (__aData != null)
         {
             exportTakeIndex = __aData.currentTakeInd;
         }
     }
 }
Пример #8
0
 void loadAnimate()
 {
     if (TimelineWindow.window)
     {
         aData        = TimelineWindow.window.aData;
         dependencies = aData.GetDependencies(take);
     }
     else
     {
         this.Close();
     }
 }
Пример #9
0
 void loadAnimatorData()
 {
     if (TimelineWindow.window)
     {
         __aData = TimelineWindow.window.aData;
         if (track != null)
         {
             _go = track.GetTarget(__aData.target) as GameObject;
             // refresh
             updateComponentArray();
         }
     }
 }
Пример #10
0
        void OnEnable()
        {
            mAnim = target as Animate;
            aData = new AnimateEditControl(mAnim);
            GenerateTakeLabels();

            mMissingsFoldout = true;

            mDebugCurPlayingTakeInd = -1;
            mDebugPlayTakeInd       = mAnim.currentPlayingTakeIndex != -1 ? mAnim.currentPlayingTakeIndex + 1 : 0;

            mDebugPlayAtMode  = PlayAtMode.Frame;
            mDebugPlayAtFrame = 0;
            mDebugPlayAtTime  = 0f;
            mDebugPlayIsLoop  = false;

            mDebugGotoAtMode = PlayAtMode.Frame;
            mDebugGotoFrame  = 0;
            mDebugGotoTime   = 0f;

            mAnim.takeCompleteCallback += OnTakeComplete;
        }
Пример #11
0
        bool saveSelectedItemsToScene()
        {
            string saveScenePath = UnityEditor.EditorUtility.SaveFilePanel("Export Take", "Assets/", (take != null ? take.name : "All_Takes"), "unity");

            if (saveScenePath == "")
            {
                return(false);
            }
            // delete unselected GameObjects
            foreach (GameObject go in gameObjs)
            {
                if (!go)
                {
                    continue;
                }
                Animate dat = go.GetComponent <Animate>();
                if (dat)  //...
                {
                    if (take != null)
                    {
                        AnimateEditControl datEdit = new AnimateEditControl(dat);
                        datEdit.DeleteAllTakesExcept(take);
                    }
                    continue;
                }
                int index = gameObjs.IndexOf(go);
                if (gameObjsSelected[index] != null && (bool)!gameObjsSelected[index])
                {
                    DestroyImmediate(go);
                }
            }
            // save with changes
            EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene(), saveScenePath, true);
            // restore scene
            EditorSceneManager.OpenScene(saveScenePath);
            // refresh project directory
            AssetDatabase.Refresh();
            return(true);
        }
Пример #12
0
 public void reloadAnimate()
 {
     __aData = null;
     loadAnimatorData();
 }
Пример #13
0
        void saveChanges()
        {
            if (!TimelineWindow.window)
            {
                return;
            }
            AnimateEditControl aData = TimelineWindow.window.aData;

            if (aData == null)
            {
                return;
            }

            List <GameObject> keepReferences    = new List <GameObject>();
            List <GameObject> replaceReferences = new List <GameObject>();

            for (int i = 0; i < newReference.Count; i++)
            {
                if (actions[i] == 0)
                {
                    continue;
                }
                if (newReference[i] == oldReference[i])
                {
                    continue;
                }
                if (!newReference[i] || !oldReference[i])
                {
                    continue;                                       // skip null values
                }
                else if (actions[i] == 1)
                {
                    keepReferences.Add(newReference[i]);
                    replaceReferences.Add(oldReference[i]);
                }
                else if (actions[i] == 2)
                {
                    keepReferences.Add(oldReference[i]);
                    replaceReferences.Add(newReference[i]);
                }
            }

            if (keepReferences.Count <= 0)
            {
                this.Close();
                return; // return if no changes made
            }
            //TODO: undo "Resolve Duplicates"
            // update references
            List <GameObject> lsFlagToKeep = aData.UpdateDependencies(keepReferences, replaceReferences);

            // reset event track method info
            //TimelineWindow.resetIndexMethodInfo(); //TODO: if ever we actually fix importing, check if this is needed
            TimelineWindow.shouldCheckDependencies = false;
            //aData.shouldCheckDependencies = false;
            // delete replaced references
            int count = 0;

            for (int i = 0; i < replaceReferences.Count; i++)
            {
                if (lsFlagToKeep.Contains(replaceReferences[i]))
                {
                    continue;
                }
                DestroyImmediate(replaceReferences[i]);
                replaceReferences.RemoveAt(i);
                count++;
                i--;
            }
            replaceReferences = new List <GameObject>();

            Debug.Log("Animator: Resolved Duplicate" + (count > 1 ? "s" : "") + ". Deleted " + count + " GameObject" + (count > 1 ? "s" : "") + ".");
            this.Close();
        }
Пример #14
0
 public void reloadAnimate()
 {
     aData = null;
     loadAnimate();
 }