Example #1
0
        /// <summary>
        /// Get the filename of the format {model}@{anim}.fbx from the given object
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>filename for use for exporting animation clip</returns>
        public static string GetFileName(Object obj)
        {
            if (!ModelExporter.IsEditorClip(obj))
            {
                // not an editor clip so just return the name of the object
                return(obj.name);
            }

            TimelineClip timeLineClip = GetTimelineClipFromEditorClip(obj);

            // if the timeline clip name already contains an @, then take this as the
            // filename to avoid duplicate @
            if (timeLineClip.displayName.Contains("@"))
            {
                return(timeLineClip.displayName);
            }

            var goBound = GetGameObjectBoundToEditorClip(obj);

            if (goBound == null)
            {
                return(obj.name);
            }
            return(string.Format("{0}@{1}", goBound.name, timeLineClip.displayName));
        }
Example #2
0
        /// <summary>
        /// Get the GameObject and it's corresponding animation clip from the given editor clip.
        /// </summary>
        /// <param name="editorClip"></param>
        /// <returns>KeyValuePair containing GameObject and corresponding AnimationClip</returns>
        public static KeyValuePair <GameObject, AnimationClip> GetGameObjectAndAnimationClip(Object editorClip)
        {
            if (!ModelExporter.IsEditorClip(editorClip))
            {
                return(new KeyValuePair <GameObject, AnimationClip>());
            }

            TimelineClip timeLineClip = GetTimelineClipFromEditorClip(editorClip);

            var animationTrackGO = GetGameObjectBoundToEditorClip(editorClip);

            if (animationTrackGO == null)
            {
                return(new KeyValuePair <GameObject, AnimationClip>());
            }

            return(new KeyValuePair <GameObject, AnimationClip>(animationTrackGO, timeLineClip.animationClip));
        }