public void FromSequencePath(SequencePath path, bool forceRebuild) { if (!NeedsUpdate(path, forceRebuild)) { return; } Clear_Internal(); var rootObject = EditorUtility.InstanceIDToObject(path.selectionRoot); if (rootObject == null) { UpdateSerializedPath(); return; } var candidateAsset = rootObject as TimelineAsset; if (candidateAsset != null) { Add_Internal(candidateAsset, null, null); UpdateSerializedPath(); return; } var candidateGameObject = rootObject as GameObject; if (candidateGameObject == null) { UpdateSerializedPath(); return; } var director = TimelineUtility.GetDirectorComponentForGameObject(candidateGameObject); var asset = TimelineUtility.GetTimelineAssetForDirectorComponent(director); Add_Internal(asset, director, null); if (!path.subElements.Any()) { UpdateSerializedPath(); return; } List <SequenceBuildingBlock> buildingBlocks; if (ValidateSubElements(path.subElements, director, out buildingBlocks)) { foreach (var buildingBlock in buildingBlocks) { Add_Internal(buildingBlock.asset, buildingBlock.director, buildingBlock.hostClip); } } UpdateSerializedPath(); }
void SetCurrentSelection(Object obj) { var selectedGameObject = obj as GameObject; if (selectedGameObject != null) { PlayableDirector director = TimelineUtility.GetDirectorComponentForGameObject(selectedGameObject); SetCurrentTimeline(director); } else { var selectedSequenceAsset = obj as TimelineAsset; if (selectedSequenceAsset != null) { SetCurrentTimeline(selectedSequenceAsset); } } Repaint(); }