示例#1
0
        private static void HandlePrefabRecordAnimation(USTimelineAnimation timelineAnimation, string relativeScriptableObjectPath)
        {
            EditorUtility.SetDirty(timelineAnimation);

            foreach (var track in timelineAnimation.AnimationTracks)
            {
                if (!AssetDatabase.Contains(track.GetInstanceID()))
                {
                    var assetName = AssetDatabase.GenerateUniqueAssetPath(string.Format("{0}/{1}.asset", relativeScriptableObjectPath, track.GetInstanceID()));
                    AssetDatabase.CreateAsset(track, assetName);
                }

                EditorUtility.SetDirty(track);

                foreach (var clipData in track.TrackClips)
                {
                    if (!AssetDatabase.Contains(clipData.GetInstanceID()))
                    {
                        var assetName = AssetDatabase.GenerateUniqueAssetPath(string.Format("{0}/{1}.asset", relativeScriptableObjectPath, clipData.GetInstanceID()));
                        AssetDatabase.CreateAsset(clipData, assetName);
                    }

                    EditorUtility.SetDirty(clipData);
                }
            }
        }
示例#2
0
        private static List <UnityEngine.Object> CollectUsedAssetsForObjectPath(USTimelineAnimation timelineAnimation)
        {
            var usedAssets = new List <UnityEngine.Object>();

            foreach (var track in timelineAnimation.AnimationTracks)
            {
                usedAssets.Add(track);
                foreach (var clipData in track.TrackClips)
                {
                    usedAssets.Add(clipData);
                }
            }

            return(usedAssets);
        }
示例#3
0
        public static void ProcessAnimationTimeline(USTimelineAnimation animationTimeline)
        {
            var animationTracks = new List <AnimationTrack>();

            foreach (var animationTrack in animationTimeline.AnimationTracks)
            {
                var duplicateAnimationTrack = Instantiate(animationTrack) as AnimationTrack;

                var animationClipData = new List <AnimationClipData>();
                foreach (var animationClip in animationTrack.TrackClips)
                {
                    animationClipData.Add(Instantiate(animationClip) as AnimationClipData);
                }

                duplicateAnimationTrack.SetClipData(animationClipData);
                animationTracks.Add(duplicateAnimationTrack);
            }

            animationTimeline.SetTracks(animationTracks);
        }