Inspector not refreshing correctly after removing and creating new bones

Original question: What’s the proper way to delete a Bone and all its children from a Skeleton?

Hello,

I have an actor composed by a hierarchy of Skeleton + Bones, and I’m struggling with the way to remove a Bone and all its children. Disposing a Bone doesn’t make it disapear from the inspector, it just loses its paren.

What’s the proper way to do this?
I don’t find a method in the Skeleton to rermove a bone.

Should I remove the bone from the skeleton bones property manually?
This is working for me, but seems to be quite dangerous… :ghost:

I just gave it a try ( bone.dispose() ), and it appears the inspector needed an action (like collapsing and expanding again the bone hierachy) to see the bone disappear. So regarless of the display in the Inspector, it seems to work on my side :thinking:

NB: FYI when you select any item in the inspector, globalThis.debugNode is then pointing to this item. So you can select a bone and go :
bone = globalThis.debugNode
In the console, before being able to play with this bone reference

You are right, the problem seems to be the inspector.

Also, if I dispose a skeleton, and then I create it again, it will never appear in the inspector, but it is in the scene.

Inspector doesn’t refresh the correct view even pressing the Refresh the explorer button after removing and creating skeletons and bones.

Moving the question to bugs.

Do you have a repro in the PG so I can try to fix that?

Hi, there you go :slight_smile:

I’m sorry but what is the problem with this PG ?:slight_smile:

If I click on the selection it seems to accuralely create or dispose the skeleton for instance (switching between 0 and 1)

wait! all good I got it ;D

Add missing Bone.dispose() by deltakosh · Pull Request #15861 · BabylonJS/Babylon.js

3 Likes