We have a spine that uses multiple tracks -
track 1 - base animation. for idle, walking, etc.
track 2 - for special overrides when you have something equipped in your right hand
track 3 - for special overrides when you have something equipped in your left hand
for tracks 2 & 3, we've placed keyframes in some of these animations that nudge the draw order of slots
example: unsheathing a sword from behind your back should move the sword from behind the character to in front of it. if we want to unsheath two swords independently of each other, each track animation will have a keyframe to nudge the relevant slots around.
from what i've gathered, it seems spine doesn't handle this set up well. It seems that the draw order timeline for the highest track stomps on any draw order changes done by tracks beneath it. In other words, a keyframe that adjusts the draw order ends up being like an absolute snapshot of the draw order for the entire rig, instead of just relevant slots you want to move around.
It looks like the json for a spine only includes the relevant draw order changes for a keyframe, so I was thinking of doing something like this in DrawOrderTimeline.Apply -
for (int i = 0, n = drawOrderToSetupIndex.Length; i < n; i++)
{
if (drawOrderToSetupIndex[i] != i)
{
drawOrderItems[i] = slotsItems[drawOrderToSetupIndex[i]];
}
}
basically i just tweaked this loop to only update the draw order if the draw order from the json is different (otherwise it will just use whatever draw order was set previously)
this kinda seems to work, but there's some loose ends and little bugs this introduces. for example, i often clear a track by calling SetEmptyAnimation
on the track, but it unfortunately isn't resetting the draw order here.
I can try to chase down all the edgecases, but i figured I'd shoot a message here in case this is a solved problem already.
Thanks!
also i'm curious, is there an advantage to treating draw order the way spine does? opposed to just introducing a z axis? it feels very rigid, but i suppose it's simpler/more straightforward