This feature might already exist, but it depends on what you're looking for.
What do you mean make a skin not visible?
If you "unload" a skin, what do you expect to happen?
Why would you need to make two skins for each damage decal? What is a damage decal in the first place?
You're a Spine-C user, right?
It's a bit tricker to juggle Skin stuff in C, but you can do it.
If you need a "skin" without anything in it (ie, a skin that's not visible), you need to create a new one at runtime since Spine Editor won't export empty skins.
Just call spSkin_create
, I guess. It'll return an spSkin and that will be empty. If you pass it to the skeleton, it'll get no attachments for all your "skin placeholders".
If you only want one or some of its attachments disappear, that's a bit tricker and there are multiple ways to do it. Some of these ways are more reliable but slightly more complicated to implement than others, but how reliable you need it to be depends on how the character was animated in the first place.
One way is to find the slot using spSkeleton_findSlot
, then manually calling spSlot_setAttachment
. I think you're supposed to pass a 0 or NULL if you want to remove the attachment? Anyway, this will break if your animations key anything on that slot.
The other ways are to duplicate or directly modify the currently used skin and then removing skin entries from the spSkin struct/object.
since spSkin is implemented as a linked list, it'll be a bit of a chore/a basic data structures machine problem, to wire up the pointers together when you remove or remove skin entries around. You'll have to keep a hold of the _Entry
you removed too. Otherwise, you won't be able to . The benefit is that it'll work correctly even if Animations key that slot with the attachment, and also when you call spSkeleton_setToSetupPose.