public void OnEnable() { this.m_ClipCurveEditor = new ClipInspectorCurveEditor(); this.m_DefaultIcon = EditorGUIUtility.FindTexture("DefaultAsset Icon"); this.m_SelectionCache = new List <ClipInspector.EditorClipSelection>(); Object[] targets = base.get_targets(); for (int i = 0; i < targets.Length; i++) { Object @object = targets[i]; EditorClip editorClip = @object as EditorClip; if (editorClip != null) { if (!this.IsTimelineAssetValidForEditorClip(editorClip)) { this.m_SelectionCache.Clear(); return; } this.m_SelectionCache.Add(new ClipInspector.EditorClipSelection(editorClip)); } } this.m_SelectionInfo = this.BuildSelectionInfo(); if (this.m_SelectionInfo.selectedAssetTypesAreHomogeneous) { Object[] objects = (from e in this.m_SelectionCache select e.clip.asset).ToArray <Object>(); this.m_SelectedPlayableAssetsInspector = TimelineInspectorUtility.GetInspectorForObjects(objects); } this.m_MultiselectionHeaderTitle = this.m_SelectionCache.Count + " " + ClipInspector.Styles.MultipleSelectionTitle.get_text(); this.m_ClipAssetTitle.set_text(this.PlayableAssetSectionTitle()); this.InitializeProperties(); }
public static TimelineClip Clone(TimelineClip clip, PlayableDirector directorInstance) { EditorClip editorClip = EditorItemFactory.GetEditorClip(clip); TimelineClip clip2 = Object.Instantiate <EditorClip>(editorClip).clip; SelectionManager.Remove(clip2); clip2.parentTrack = null; clip2.ClearAnimatedParameterCurves(); if (clip.curves != null) { AnimatedParameterExtensions.CreateCurvesIfRequired(clip2, clip.parentTrack); EditorUtility.CopySerialized(clip.curves, clip2.curves); } ScriptableObject scriptableObject = clip2.asset as ScriptableObject; if (scriptableObject != null && clip2.asset is IPlayableAsset) { ScriptableObject scriptableObject2 = TimelineHelpers.CloneReferencedPlayableAsset(scriptableObject, directorInstance); TimelineHelpers.SaveCloneToOriginalAsset(scriptableObject, scriptableObject2); clip2.asset = scriptableObject2; AnimationPlayableAsset animationPlayableAsset = scriptableObject2 as AnimationPlayableAsset; if (clip2.recordable && animationPlayableAsset != null && animationPlayableAsset.clip != null) { clip2.displayName = animationPlayableAsset.clip.get_name(); } } return(clip2); }
private void MixOutCurveUpdated(AnimationCurve curve, EditorCurveBinding binding) { curve.set_keys(CurveEditUtility.SanitizeCurveKeys(curve.get_keys(), false)); this.m_MixOutCurveProperty.set_animationCurveValue(curve); base.get_serializedObject().ApplyModifiedProperties(); EditorClip editorClip = base.get_target() as EditorClip; if (editorClip != null) { editorClip.lastHash = editorClip.GetHashCode(); } this.RefreshCurves(); }
public TimelineClipGUI(TimelineClip clip, IRowGUI parent, IZOrderProvider provider) : base(parent) { zOrderProvider = provider; zOrder = provider.Next(); m_EditorItem = EditorClipFactory.GetEditorClip(clip); m_ClipEditor = CustomTimelineEditorCache.GetClipEditor(clip); supportResize = true; leftHandle = new TimelineClipHandle(this, TrimEdge.Start); rightHandle = new TimelineClipHandle(this, TrimEdge.End); ItemToItemGui.Add(clip, this); }
public TimelineClipGUI(TimelineClip clip, IRowGUI parent, IZOrderProvider provider) : base(parent) { zOrderProvider = provider; zOrder = provider.Next(); m_EditorItem = EditorClipFactory.GetEditorClip(clip); clip.dirtyHash = 0; supportResize = true; m_LeftHandle = new TimelineClipHandle(this, TrimEdge.Start); m_RightHandle = new TimelineClipHandle(this, TrimEdge.End); ItemToItemGui.Add(clip, this); }
private void ApplyModifiedProperties() { if (base.get_serializedObject().ApplyModifiedProperties()) { Object[] targetObjects = base.get_serializedObject().get_targetObjects(); for (int i = 0; i < targetObjects.Length; i++) { Object @object = targetObjects[i]; EditorClip editorClip = @object as EditorClip; if (editorClip != null && editorClip.clip != null && editorClip.clip.parentTrack != null) { EditorUtility.SetDirty(editorClip.clip.parentTrack); } } } }
public EditorClipSelection(EditorClip anEditorClip) { this.< editorClip > k__BackingField = anEditorClip; this.lastCurveVersion = -1; this.lastEvalTime = -1.0; SerializedObject serializedObject = new SerializedObject(this.editorClip); SerializedProperty serializedProperty = serializedObject.FindProperty("m_Item.m_Asset"); if (serializedProperty != null) { PlayableAsset playableAsset = serializedProperty.get_objectReferenceValue() as PlayableAsset; if (playableAsset != null) { this.< playableAssetObject > k__BackingField = new SerializedObject(playableAsset); } } }
public EditorClipSelection(EditorClip anEditorClip) { editorClip = anEditorClip; lastCurveVersion = -1; lastEvalTime = -1; var so = new SerializedObject(editorClip); var playableAssetProperty = so.FindProperty("m_Clip.m_Asset"); if (playableAssetProperty != null) { var asset = playableAssetProperty.objectReferenceValue as UnityEngine.Playables.PlayableAsset; if (asset != null) { serializedPlayableAsset = new SerializedObject(asset); } } }
private bool IsTimelineAssetValidForEditorClip(EditorClip editorClip) { TimelineAsset timelineAsset = editorClip.clip.parentTrack.timelineAsset; bool result; if (this.m_TimelineAsset == null) { this.m_TimelineAsset = timelineAsset; } else if (timelineAsset != this.m_TimelineAsset) { this.m_TimelineAsset = null; result = false; return(result); } result = true; return(result); }
private void SetCurveEditorTrackHead() { if (!(TimelineWindow.instance == null) && TimelineWindow.instance.state != null) { if (!this.hasMultipleSelection) { EditorClip editorClip = base.get_target() as EditorClip; if (!(editorClip == null)) { PlayableDirector currentDirector = TimelineWindow.instance.state.currentDirector; if (!(currentDirector == null)) { this.m_ClipCurveEditor.trackTime = ClipInspectorCurveEditor.kDisableTrackTime; } } } } }
protected void GUIContent() { var marks = track.marks; if (marks != null) { SetupEMarks(); foreach (var mark in emarks) { mark.ProcessEvent(); } } var clips = track.clips; if (clips != null) { int len = clips.Length; if (eClips == null || eClips.Length != len) { eClips = new EditorClip[len]; for (int i = 0; i < len; i++) { eClips[i] = new EditorClip(this, clips[i]); } } for (int i = 0; i < clips.Length; i++) { eClips[i].OnGUI(); } } if (marks != null) { for (int i = 0; i < marks.Length; i++) { emarks[i].OnGUI(RenderRect); } } if (track.locked) { GUI.Box(RenderRect, "", TimelineStyles.lockedBG); } OnGUIContent(); }
public void OnEnable() { this.m_EditorClip = (Selection.get_activeObject() as EditorClip); SceneView.onSceneGUIDelegate = (SceneView.OnSceneFunc)Delegate.Combine(SceneView.onSceneGUIDelegate, new SceneView.OnSceneFunc(this.OnSceneGUI)); this.m_PositionProperty = base.get_serializedObject().FindProperty("m_Position"); this.m_PositionProperty.set_isExpanded(true); this.m_RotationProperty = base.get_serializedObject().FindProperty("m_Rotation"); this.m_AnimClipProperty = base.get_serializedObject().FindProperty("m_Clip"); this.m_UseTrackMatchFieldsProperty = base.get_serializedObject().FindProperty("m_UseTrackMatchFields"); this.m_UseTrackMatchFieldsProperty.set_isExpanded(true); this.m_MatchTargetFieldsProperty = base.get_serializedObject().FindProperty("m_MatchTargetFields"); this.m_MatchTargetFieldsProperty.set_isExpanded(true); this.m_LastPosition = this.m_PositionProperty.get_vector3Value(); this.m_LastRotation = this.m_RotationProperty.get_quaternionValue(); if (this.m_EditorClip != null && this.m_EditorClip.clip != null) { this.m_TrackSerializedObject = new SerializedObject(this.m_EditorClip.clip.parentTrack); this.m_TrackMatchTargetFieldsProperty = this.m_TrackSerializedObject.FindProperty("m_MatchTargetFields"); } }
bool IsTimelineAssetValidForEditorClip(EditorClip editorClip) { var trackAsset = editorClip.clip.GetParentTrack(); if (trackAsset == null) { return(false); } var clipTimelineAsset = trackAsset.timelineAsset; if (m_TimelineAsset == null) { m_TimelineAsset = clipTimelineAsset; } else if (clipTimelineAsset != m_TimelineAsset) { m_TimelineAsset = null; return(false); } return(true); }
public void OnEnable() { if (target == null) // case 946080 { return; } m_EditorClip = UnityEditor.Selection.activeObject as EditorClip; m_EditorClips = UnityEditor.Selection.objects.OfType <EditorClip>().ToArray(); SceneView.duringSceneGui += OnSceneGUI; m_PositionProperty = serializedObject.FindProperty("m_Position"); m_PositionProperty.isExpanded = true; m_RotationProperty = serializedObject.FindProperty("m_EulerAngles"); m_AnimClipProperty = serializedObject.FindProperty("m_Clip"); m_UseTrackMatchFieldsProperty = serializedObject.FindProperty("m_UseTrackMatchFields"); m_MatchTargetFieldsProperty = serializedObject.FindProperty("m_MatchTargetFields"); m_RemoveStartOffsetProperty = serializedObject.FindProperty("m_RemoveStartOffset"); m_ApplyFootIK = serializedObject.FindProperty("m_ApplyFootIK"); m_LastPosition = m_PositionProperty.vector3Value; m_LastRotation = m_RotationProperty.vector3Value; }