playMaker

Author Topic: Spine Actions  (Read 7972 times)

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Spine Actions
« on: July 20, 2017, 02:25:17 AM »
Hello. I will be posting updates to the spine actions here in this thread. Please comment if you would like to follow the updates. I am open to suggestions about which actions you would like to see (within my programming abilities and spines unity capabilities).

I've created a single action to start off, and make sure that it is working for everyone. Please note, I am using unity 2017.1 (although this should work with 5.6 as well) and the newest version of the Spine-Unity 3.6 runtime unitypackage. It is required that you have this (free) package installed in order to use these actions. You can download it here: http://esotericsoftware.com/spine-unity-download

It is likely to work on earlier version of unity/spine runtime package, but is untested. Please always backup your project before trying something new.

Today I have attached a single action. I will open a github account to host the actions soon. Once there is enough actions for it to be considered "working", I will move them over to the ecosystem.

Please note these actions are NOT upgradable from other spine actions that may have been released before.

Action: Spine Play Animation.

Allows you set an animation for a spline character by string. Please note I chose to use strings because they can be saved a playmaker variables easily.

Options: looping, track index.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Spine Actions
« Reply #1 on: July 20, 2017, 01:47:43 PM »
I have updated the "Spine Play Animation" to use an event. The event will trigger once the animation is complete. If the event is left blank, it will go to the next state immediately.

Also here is a flip X / Y action.

Thanks for sticking with me until I get a better handle on the spine API  8)

Wayne191

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Spine Actions
« Reply #2 on: July 21, 2017, 07:25:43 AM »
Thank you for your help.  :) :)

I tested it with Unity 5.4 and Spine 3.5 and it works. Other actions could be Time Scale ( we can adjust it in Inspector, but not with different  animation name ) or Skins function.

Here is a link to the page for Skins function in case you need it:
http://esotericsoftware.com/spine-runtime-skins

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Spine Actions
« Reply #3 on: July 21, 2017, 08:36:22 AM »
I will test these as soon as I can... thank you for this!

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Spine Actions
« Reply #4 on: July 21, 2017, 09:51:43 AM »
Thanks for the suggestions. Ive added the actions to my github for now, to make it easier to manage. https://github.com/dumbgamedev/spine_playmaker

Actions added:

Spine Add Animation (similar to play animation, but add them to the queue, rather than playing immediately).
Spine Add Empty Animation
Spine Get Mix Duration
Spine Set Time Scale (for all animations)


Actions Updated (no breaking changes):

Spine Play Animation (added set time scale per this animation state only)

To Do Next:

Actions for Skins Function

pixelpaste

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Spine Actions
« Reply #5 on: October 07, 2017, 11:04:41 PM »
Whoo thanks a lot for this!

artixpro

  • Playmaker Newbie
  • *
  • Posts: 18
    • Funtyx
Re: Spine Actions
« Reply #6 on: January 15, 2018, 07:45:07 AM »
using UnityEngine;


namespace HutongGames.PlayMaker.Actions
{

   [ActionCategory("Artix")]
   [Tooltip("Artix Production")]
   public class SendEventEndAnimation : FsmStateAction
   {

      [RequiredField]
      [CheckForComponent(typeof(UnityEngine.Animator))]
      [Tooltip("The GameObject to be observed.")]
      public FsmOwnerDefault gameObject;

      [RequiredField]
      [Tooltip("Send this event when animation finished.")]
      public FsmEvent sendEvent;

      [RequiredField]
      [Tooltip("The name of the animation to be observed.")]
      public FsmString animationName;

      private Animator animator;

      public override void Reset() {
         gameObject = null;
         sendEvent = null;
         animationName = null;
      }

      // Code that runs on entering the state.
      public override void OnEnter() {
         var go = Fsm.GetOwnerDefaultTarget(gameObject);
         animator = go.GetComponent<Animator>();
      }

      // Code that runs every frame.
      public override void OnUpdate() {
         var a = animator.GetCurrentAnimatorStateInfo(0);
         if (a.IsName(animationName.Value) && a.normalizedTime >= 0.98f) {
            Fsm.Event(sendEvent);
         }
      }
   }
}
Jungle Town "Birthday Quest" | funtyx.com

rondmc

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Spine Actions
« Reply #7 on: February 12, 2018, 04:28:50 PM »
Gonna follow for this, thanks! I just got Spine and PlayMaker functionality is always welcomed.