/// <summary> Refreshes the entire database by removing nulls, renaming the preset file names to their animation names, sorting the database and updating the animation names list </summary>
        /// <param name="saveAssets"> Write all unsaved asset changes to disk? </param>
        public void RefreshDatabase(bool saveAssets)
        {
            RemoveNullEntries(false);
            RenameAssetFileNamesToReflectAnimationNames();
            Sort(false);

            if (DatabaseName.Equals(UIAnimations.DEFAULT_DATABASE_NAME))
            {
                UIAnimationData defaultData = AddDefaultData(true);
                Database.Remove(defaultData);
                Database.Insert(0, defaultData);
            }

            UpdateAnimationNames(saveAssets);
        }
 /// <summary> [Editor Only] Iterates through the database to look for the UIAnimationData. If found, deletes the entry and the asset file and returns TRUE </summary>
 /// <param name="data"> UIAnimationData to search for </param>
 /// <param name="saveAssets"> Write all unsaved asset changes to disk? </param>
 public bool Delete(UIAnimationData data, bool saveAssets)
 {
     if (data == null)
     {
         return(false);
     }
     if (!Database.Contains(data))
     {
         return(false);
     }
     Database.Remove(data);
     DestroyImmediate(data, true);
     RefreshDatabase(false);
     SetDirty(saveAssets);
     return(true);
 }
        /// <summary> [Editor Only] Renames an UIAnimationData animation name (including the asset filename). Returns TRUE if the operation was successful </summary>
        /// <param name="oldAnimationName"> The previous animation name</param>
        /// <param name="newAnimationName"> The new animation name </param>
        private void Rename(string oldAnimationName, string newAnimationName)
        {
            UIAnimationData data = Get(oldAnimationName);

            if (data == null)
            {
                return;
            }
            newAnimationName = newAnimationName.Trim();
            if (Contains(newAnimationName))
            {
                return;
            }
            DoozyUtils.UndoRecordObjects(new Object[] { data, this }, UILabels.Rename);
            data.Name = newAnimationName;
            data.name = data.Name;
            data.SetDirty(false);
            SetDirty(false);
            UpdateAnimationNames(true);
        }
예제 #4
0
        /// <summary>
        ///     Iterates through all the UIAnimationDatabase databases of the given database type (AnimationType) to find the one that has the given database name (preset category), then looks for the animation name (preset name).
        ///     If found, returns a deep copy of the corresponding UIAnimation, else it returns null.
        /// </summary>
        /// <param name="animationType"> The type of animations contained in the target database</param>
        /// <param name="presetCategory"> The database name to search for </param>
        /// <param name="presetName"> The animation name to search for </param>
        public static UIAnimation LoadPreset(AnimationType animationType, string presetCategory, string presetName)
        {
            UIAnimationData data = Instance.Get(animationType, presetCategory, presetName);

            return(data == null ? null : data.Animation.Copy());
        }
 /// <summary> Returns TRUE if the UIAnimationData has been found in the database </summary>
 /// <param name="data"> UIAnimationData to search for </param>
 public bool Contains(UIAnimationData data)
 {
     return(data != null && Database.Contains(data));
 }