UnityEditor.Timeline.TimelineHelpers.CloneReferencedPlayableAsset(UnityEngine.ScriptableObject, UnityEngine.IExposedPropertyTable, UnityEngine.IExposedPropertyTable, UnityEngine.Object)

Here are the examples of the csharp api UnityEditor.Timeline.TimelineHelpers.CloneReferencedPlayableAsset(UnityEngine.ScriptableObject, UnityEngine.IExposedPropertyTable, UnityEngine.IExposedPropertyTable, UnityEngine.Object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : TimelineHelpers.cs
License : MIT License
Project Creator : BattleDawnNZ

internal static TimelineClip Clone(TimelineClip clip, IExposedPropertyTable sourceTable, IExposedPropertyTable destTable, Playablereplacedet newOwner)
        {
            var editorClip = EditorClipFactory.GetEditorClip(clip);
            // Workaround for Clips not being unity object, replacedign it to a editor clip wrapper, clone it, and pull the clip back out
            var newClip = Object.Instantiate(editorClip).clip;

            // perform fix ups for what Instantiate cannot properly detect
            SelectionManager.Remove(newClip);
            newClip.parentTrack = null;
            newClip.curves = null; // instantiate might copy the reference, we need to clear it

            // curves are explicitly owned by the clip
            if (clip.curves != null)
            {
                newClip.CreateCurves(AnimationTrackRecorder.GetUniqueRecordedClipName(newOwner, clip.curves.name));
                EditorUtility.CopySerialized(clip.curves, newClip.curves);
                TimelineCreateUtilities.SavereplacedetIntoObject(newClip.curves, newOwner);
            }

            ScriptableObject playablereplacedet = newClip.replacedet as ScriptableObject;
            if (playablereplacedet != null && newClip.replacedet is IPlayablereplacedet)
            {
                var clone = CloneReferencedPlayablereplacedet(playablereplacedet, sourceTable, destTable, newOwner);
                newClip.replacedet = clone;

                // special case to make the name match the recordable clips, but only if they match on the original clip
                var originalRecordedreplacedet = clip.replacedet as AnimationPlayablereplacedet;
                if (clip.recordable && originalRecordedreplacedet != null && originalRecordedreplacedet.clip != null)
                {
                    AnimationPlayablereplacedet clonedAnimationreplacedet = clone as AnimationPlayablereplacedet;
                    if (clonedAnimationreplacedet != null && clonedAnimationreplacedet.clip != null)
                    {
                        clonedAnimationreplacedet.clip = CloneAnimationClip(originalRecordedreplacedet.clip, newOwner);
                        if (clip.displayName == originalRecordedreplacedet.clip.name && newClip.recordable)
                        {
                            clonedAnimationreplacedet.name = clonedAnimationreplacedet.clip.name;
                            newClip.displayName = clonedAnimationreplacedet.name;
                        }
                    }
                }
            }

            return newClip;
        }