Example #1
0
 /// <summary>
 /// Changes the state of a playing animation clip. If animation clip is not currently playing the state change is
 /// ignored.
 /// </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(AnimationClip clip, AnimationClipState state)
 {
     if (_native != null)
     {
         _native.SetState(clip, state);
     }
 }
Example #2
0
        /// <summary>
        /// Creates a new clip state, with default values initialized.
        /// </summary>
        /// <returns>New animation clip state.</returns>
        public static AnimationClipState Create()
        {
            AnimationClipState state = new AnimationClipState();
            state.speed = 1.0f;
            state.weight = 1.0f;
            state.wrapMode = AnimWrapMode.Loop;

            return state;
        }
Example #3
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(AnimationClip clip, out AnimationClipState state)
        {
            if (_native != null)
            {
                return(_native.GetState(clip, out state));
            }

            state = new AnimationClipState();
            return(false);
        }
        public void SetState(AnimationClip clip, AnimationClipState state)
        {
            IntPtr clipPtr = IntPtr.Zero;

            if (clip != null)
            {
                clipPtr = clip.GetCachedPtr();
            }

            Internal_SetState(mCachedPtr, clipPtr, ref state);
        }
        public bool GetState(AnimationClip clip, out AnimationClipState state)
        {
            IntPtr clipPtr = IntPtr.Zero;

            if (clip != null)
            {
                clipPtr = clip.GetCachedPtr();
            }

            return(Internal_GetState(mCachedPtr, clipPtr, out state));
        }
        /// <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);
        }
Example #7
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);
        }
 private static extern void Internal_setState(IntPtr thisPtr, RRef <AnimationClip> clip, ref AnimationClipState state);
 private static extern bool Internal_getState(IntPtr thisPtr, RRef <AnimationClip> clip, out AnimationClipState state);
 /// <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);
 }
 /// <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));
 }
Example #12
0
 private static extern void Internal_SetState(IntPtr thisPtr, IntPtr clipPtr, ref AnimationClipState state);
Example #13
0
 private static extern bool Internal_GetState(IntPtr thisPtr, IntPtr clipPtr, out AnimationClipState state);
Example #14
0
 /// <summary>
 /// Changes the state of a playing animation clip. If animation clip is not currently playing the state change is
 /// ignored.
 /// </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(AnimationClip clip, AnimationClipState state)
 {
     switch (this.state)
     {
         case State.Active:
         case State.EditorActive:
             _native.SetState(clip, state);
             break;
     }
 }
Example #15
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(AnimationClip clip, out AnimationClipState state)
 {
     switch (this.state)
     {
         case State.Active:
         case State.EditorActive:
             return _native.GetState(clip, out state);
         default:
             state = new AnimationClipState();
             return false;
     }
 }