riverman_paul

I am the programmer, viewing Spines created by our artist. In-code, everything is in seconds, so I'd like to view the animation in seconds rather than frames. The duration of each frame is also dependent on the Dopesheet FPS, which further confuses the issue when I'm trying to convert between frames and seconds in my head.

Is it possible to change the dopeheet's timeline view from frames to seconds? Sorry if this is an easy answer!
User avatar
riverman_paul
  • Posts: 29

Nate

It currently isn't, sorry. This would only really useful for programmers, since animators like discrete frames. Can you say what tasks your are doing where seconds would be beneficial to see in the dopesheet?
User avatar
Nate

Nate
  • Posts: 12213

Pharan

I was lobbying in the past for more prominently showing where the seconds are. Like at 30fps, having 30, 60, 90 be bold or have a more prominent line.
Or 24, 48, 72 for 24fps.

No traction. :p
User avatar
Pharan
  • Posts: 5366

Nate

We can do it, it's just a question of visualization.

User avatar
Nate

Nate
  • Posts: 12213

riverman_paul

As the programmer, when I import an animation, I always open the Spine to see what's going on, to read the names of the animations, to sync things up, etc. Here are some examples of why I need to know the seconds rather than the frames:

1. I want to make sure that each part of my animations are actually playing at the speed my animator intended, because a lot of things can affect timing of Spine animations in code (animation speed multipliers, mixing, track speed multipliers, etc. can all modify the timing). This requires me to know how long a frame is (dopesheet fps) but not take into account playback speed (dopesheet speed) and then multiply the number of frames by this value in my head, for each value I'm interested in.

2. I have a scripting system where various things in the game world happen based on specific keyframes of an animation, so I need to know when those keyframes happen. I can't use event callbacks for this because I need to know when they're going to happen ahead of time, so other things in the world can be in position when the keyframe occurs.

3. I need to change the internal state of the actor based on specific keyframes. Again, it's often not practical to use Spine event callbacks to accomplish this, because they don't fit with the existing control flow of that entity.
User avatar
riverman_paul
  • Posts: 29

Nate

Thanks.

Could #2 and #3 be solved by using frames in your code? Eg, your code might read if (animationTime > framesToSeconds(23)). Would that also solve #1?

One of the issues with using seconds is it takes more horizontal space. Labeling the entire timeline in seconds isn't very pretty. Would it be sufficient to show seconds in a popup, maybe at the mouse location, when dragging the timeline position?
User avatar
Nate

Nate
  • Posts: 12213

riverman_paul

Correct me if I'm wrong, but wouldn't a framesToSeconds() function only return the correct value if it took the dopesheet FPS into account, which is impossible because the dopesheet FPS is not exported?
One of the issues with using seconds is it takes more horizontal space. Labeling the entire timeline in seconds isn't very pretty. Would it be sufficient to show seconds in a popup, maybe at the mouse location, when dragging the timeline position?
Yes I understand, it probably wouldn't look that pleasant going all across the timeline. But I think the approach you described would work well enough for my purposes, since I'm really only reading one frame into the code at a time. I don't need to know them all at once.
User avatar
riverman_paul
  • Posts: 29

Pharan

I like the seconds on drag idea.
User avatar
Pharan
  • Posts: 5366

Nate

riverman_paul wrote:Correct me if I'm wrong, but wouldn't a framesToSeconds() function only return the correct value if it took the dopesheet FPS into account, which is impossible because the dopesheet FPS is not exported?
That is true. I would try to avoid using multiple dopesheet FPS settings for the same application.

We'll see what we can do about showing the time in seconds for the timeline position while dragging.
User avatar
Nate

Nate
  • Posts: 12213

riverman_paul

Great, thank you!
User avatar
riverman_paul
  • Posts: 29

kap100

Have you made it possible to display the duration of the animation in seconds? This function is very necessary, since we select the duration of the sounds by the duration of the animation. Controlling the start and end of the animation is not suitable, since events occur in the middle of the animation, which should coincide with the corresponding sound. We load sounds separately from animations in assets.
kap100
  • Posts: 1

Misaki

@kap100 Displaying the duration in seconds is not yet realized, but if your issue is to match sounds and animations, you may want to import audio files into your Spine project to match. Setting an audio path in the Audio node of the Tree view allows you to set an audio event during animation that allows you to specify when to play an audio file: Events - Spine User Guide: Audio node
The exported skeleton data will not contain the audio file itself, so you will need to load the audio file in your application separately from the animation assets, as you are already doing.
User avatar
Misaki

Misaki
  • Posts: 1164


Return to Editor