Maltakreuz

In some my animations i need to change draw order by keyframes. So i need to reset draw order for another animations, on transition. How can i achieve that? I have found way to reset the whole skeleton here (http://esotericsoftware.com/spine-using-runtimes/#Animation-changes) by calling setToSetupPose, setBonesToSetupPose, or setSlotsToSetupPose. But it resets too much, i just need to reset draw order. Is there any better solution, but adding draw order keyframe in begin of all animations?
Аватара пользователя
Maltakreuz
  • Сообщения: 43

Pharan

Just open Skeleton.cs

And add the method that only resets draw order:
public void SetDrawOrderToSetupPose () {
ExposedList<Slot> slots = this.slots;
drawOrder.Clear();
for (int i = 0, n = slots.Count; i < n; i++)
drawOrder.Add(slots.Items[i]);
}
It's basically SetSlotsToSetupPose but without the slots resetting.

I'll run the idea by Nate when he gets back.
Аватара пользователя
Pharan
  • Сообщения: 5366

Maltakreuz

[quote="Pharan"][/quote]Oh, that' great. Changing draw order for overlapping things is a really common task, i suppose it could be usefull not only for me. Thank you.

-- 21 Mar 2016, 13:13 --

udp: I find extension method is more safe on the place, because I update spine-libs pretty oft.
public static void SetDrawOrderToSetupPose(this Skeleton skeleton) {
ExposedList<Slot> slots = skeleton.slots;
skeleton.drawOrder.Clear();
for (int i = 0, n = slots.Count; i < n; i++) {
skeleton.drawOrder.Add(slots.Items[i]);
}
}
Аватара пользователя
Maltakreuz
  • Сообщения: 43


Вернуться в Unity