myArmature.armature.getBone("someBone").offset.x += 100
But this doesn't:
myArmature.armature.getSlot("someSlot").offset.x += 100
How do I offset a slot rather than a bone?
I'm trying to replace an image in a slot with an armature (basically a static item with some variants).
The replacement works fine, but when it gets replaced, the new image shows up with an offset from where it's supposed to be.
Now, I know where this offset comes from, but not how to go about dealing with it.
On the main armature (a character), the image (of an item) I'm replacing has an offset from the bone it's on, say (X, Y).
The armature I'm putting in its place (of a different item) has the images at the root - that is, at offset (0, 0) from the bone they're on.
I've tried adding a dummy bone to the character that's at an offset and then putting the image on that, so it's at offset (0, 0) from the bone it's on, and that works, but I'd really rather find a better solution as doing this will require me to put lots of dummy bones everywhere.
So my question is:
Assuming I know what the offset of a slot in an armature (let's call it myArmature), which I've already discovered I can get like so:
X = dbfactory.getArmatureData(armatureName, dragonBonesName).defaultSkin.displays[slotName].transform.x
(and similar for y)
And now I replace this slot with another armature like so:
dbfactory.replaceSlotDisplay(otherDragonBonesName, otherArmatureName, otherSlotName, otherDisplayName, myArmature.armature.getSlot(mySlotName));
I now want to offset this new armature that I put in the slot by the (X, Y) offset I found.
Anyone know how I can do this?
Changing the value in the armature data does nothing (I suspect it's just a copy of the data, or at least that it's not used after creation).
Any help would be greatly appreciated. ^_^