Ejemplo n.º 1
0
        /// <summary>Initializes the struct with default values.</summary>
        public static AnimationClipState Default()
        {
            AnimationClipState value = new AnimationClipState();

            value.layer    = 0;
            value.time     = 0f;
            value.speed    = 1f;
            value.weight   = 1f;
            value.wrapMode = AnimWrapMode.Loop;
            value.stopped  = false;

            return(value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the caller to play an animation clip during edit mode. This form of animation playback is limited as
        /// you have no control over clip properties, and features like blending, cross fade or animation events are not
        /// supported.
        ///
        /// Caller will need to manually call <see cref="UpdateFloatProperties"/> in order to apply evaluated animation data
        /// to relevant float properties (if required).
        ///
        /// Caller will also need to manually call <see cref="RefreshClipMappings"/> whenever the curves internal to the
        /// animation clip change. This should be called before the call to <see cref="UpdateFloatProperties"/>.
        /// </summary>
        /// <param name="clip">Animation clip to play.</param>
        /// <param name="startTime">Time to start playing at, in seconds.</param>
        /// <param name="freeze">If true, only the frame at the specified time will be shown, without advancing the
        ///                      animation.</param>
        internal void EditorPlay(RRef <AnimationClip> clip, float startTime, bool freeze = false)
        {
            bool inPreviewMode = Internal__togglePreviewMode(mCachedPtr, true);

            if (!inPreviewMode)
            {
                return;
            }

            if (freeze)
            {
                Sample(clip, startTime);
            }
            else
            {
                AnimationClipState clipState = AnimationClipState.Default();
                clipState.time = startTime;

                SetState(clip, clipState);
            }

            Internal__refreshClipMappings(mCachedPtr);
        }
Ejemplo n.º 3
0
 private static extern void Internal_setState(IntPtr thisPtr, RRef <AnimationClip> clip, ref AnimationClipState state);
Ejemplo n.º 4
0
 private static extern bool Internal_getState(IntPtr thisPtr, RRef <AnimationClip> clip, out AnimationClipState state);
Ejemplo n.º 5
0
 /// <summary>
 /// Changes the state of a playing animation clip. If animation clip is not currently playing the playback is started for
 /// the clip.
 /// </summary>
 /// <param name="clip">Clip to change the state for.</param>
 /// <param name="state">New state of the animation (e.g. changing the time for seeking).</param>
 public void SetState(RRef <AnimationClip> clip, AnimationClipState state)
 {
     Internal_setState(mCachedPtr, clip, ref state);
 }
Ejemplo n.º 6
0
 /// <summary>Retrieves detailed information about a currently playing animation clip.</summary>
 /// <param name="clip">Clip to retrieve the information for.</param>
 /// <param name="state">
 /// Animation clip state containing the requested information. Only valid if the method returns true.
 /// </param>
 /// <returns>True if the state was found (animation clip is playing), false otherwise.</returns>
 public bool GetState(RRef <AnimationClip> clip, out AnimationClipState state)
 {
     return(Internal_getState(mCachedPtr, clip, out state));
 }