Make the output of Polygon2D to Bone2D NodePaths more usable. (Not sure if this is technically a bug) #10676
BunkWire2X8
started this conversation in
2D
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Polygon2D NodePaths to their Bone2Ds are weird, and I dunno if it's "intentional" like some kind of internal optimization, but I'd at least like a function that outputs them properly without me having to process them all weird.
Here's an example.
In this Polygon2D, the output for these node paths bones 0-3 and 10-12 are compatible with Skeleton2D.get_node().
For reference, here's how they're (properly) stored in the scene tree:
Do you see the problem? At strange points, it outputs things like
Hip/LeftArm
, when it should instead outputHip/Chest/LeftArm
. Still though, despite the node paths being stored in such a strange way, these bones still work, so I'm assuming that this might be some kind of optimization, which is why I didn't report it as a bug. Also, despite this, I've been able to at least program a workaround to all of this: In a loop where it iterates through all the bones, do something like this:Is this the most optimized, foolproof solution? Probably not, as I'd imagine that bones that are named the same would cause some issues. I might be able to work around this by experimenting more and being able to predict when it should make the mistake (Side note: If someone could send me the source code that interprets these NodePaths in Polygon2D, I'd really appreciate it). Still though, internal optimization or not, I'm a little peeved that I need to do this kind of Bone2D NodePath reinterpretation in the first place. I'd really appreciate a function that gets around this.
"Why not just fetch all the bones from Skeleton2D normally?" Good question, and if I was iterating through these bones for the sake of it, I would gladly scrap the above code and do so. Unfortunately though, I'm trying to get the weights for the Polygon2Ds, and I need to know which bones the weights are relevant to.
Beta Was this translation helpful? Give feedback.
All reactions