Beispiel #1
0
        public static void ProcessObserverTimeline(USTimelineObserver observerTimeline)
        {
            var keyframes = new List <USObserverKeyframe>();

            foreach (var keyframe in observerTimeline.observerKeyframes)
            {
                keyframes.Add(Instantiate(keyframe) as USObserverKeyframe);
            }

            observerTimeline.SetKeyframes(keyframes);
        }
Beispiel #2
0
 private void Start()
 {
     USTimelineContainer[] array = this.TimelineContainers;
     for (int i = 0; i < array.Length; i++)
     {
         USTimelineContainer uSTimelineContainer = array[i];
         if (uSTimelineContainer)
         {
             USTimelineBase[] timelines = uSTimelineContainer.Timelines;
             for (int j = 0; j < timelines.Length; j++)
             {
                 USTimelineBase  uSTimelineBase  = timelines[j];
                 USTimelineEvent uSTimelineEvent = uSTimelineBase as USTimelineEvent;
                 if (uSTimelineEvent)
                 {
                     USEventBase[] events = uSTimelineEvent.Events;
                     for (int k = 0; k < events.Length; k++)
                     {
                         USEventBase uSEventBase = events[k];
                         uSEventBase.FixupAdditionalObjects();
                     }
                 }
                 USTimelineObserver uSTimelineObserver = uSTimelineBase as USTimelineObserver;
                 if (uSTimelineObserver)
                 {
                     foreach (USObserverKeyframe current in uSTimelineObserver.observerKeyframes)
                     {
                         if (!(current.cameraPath == string.Empty))
                         {
                             GameObject gameObject = GameObject.Find(current.cameraPath);
                             if (gameObject)
                             {
                                 Camera component = gameObject.GetComponent <Camera>();
                                 if (component)
                                 {
                                     current.KeyframeCamera = component;
                                 }
                             }
                         }
                     }
                 }
                 USTimelineObjectPath uSTimelineObjectPath = uSTimelineBase as USTimelineObjectPath;
                 if (uSTimelineObjectPath)
                 {
                     uSTimelineObjectPath.FixupAdditionalObjects();
                 }
             }
         }
     }
 }
Beispiel #3
0
        private static List <UnityEngine.Object> CollectUsedAssetsForObserver(USTimelineObserver timelineObserver)
        {
            var usedAssets = new List <UnityEngine.Object>();

            foreach (var observerKeyframe in timelineObserver.observerKeyframes)
            {
                if (!observerKeyframe)
                {
                    continue;
                }

                usedAssets.Add(observerKeyframe);
            }

            return(usedAssets);
        }
Beispiel #4
0
        private static void HandlePrefabRecordObserver(USTimelineObserver timelineObserver, string relativeScriptableObjectPath)
        {
            EditorUtility.SetDirty(timelineObserver);
            foreach (var observerKeyframe in timelineObserver.observerKeyframes)
            {
                if (!observerKeyframe)
                {
                    continue;
                }

                observerKeyframe.cameraPath = observerKeyframe.KeyframeCamera.transform.GetFullHierarchyPath();

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

                EditorUtility.SetDirty(observerKeyframe);
            }
        }