Hey team,
Can we have a dispose function on BABYLON.InstantiatedEntries included in core?
When using AssetContainer.instantiateModelsToScene() to clone a set of character assets, animations, etc, i couldn’t find a built-in function for disposing just 1 specific instance of the container
e.g.
All of those elements will be disposed individually when the scene disposes, as they are registered with the scene. There is no problem adding a “disposeEntries()” function (exactly the function you have provided), but when should it be called? Or is it just for you to be able to dispose them? in that case a help function on this class would be more than enough
Yeah, so basicly i instantiate models from an asset container multiple times to clone it correctly with animationGroups retargeted and everything.
Now i want to remove a specific model, say the " b " instance of the container from the PG scene.
Disposing the rootNode wont dispose skeletons or animationGroups, so a overall dispose function would be super helpful.
the dispose functions are called automatically, so I will prefer not to name it “dispose” , but “removeFromScene” or even “disposeFromScene” makes sense to me. Want to offer a PR?
But it says formatting/linting fail,
i don’t really use typescript & copy/pasted from the assetContainer dispose function, so i’m not sure what it wants from me
Finishing: Formatting
[warn] packages/dev/core/src/assetContainer.ts
[warn] Code style issues found in the above file. Forgot to run Prettier?
##[warning]Couldn’t find a debug log in the cache or working directory
##[error]Error: Npm failed with return code: 1
I’m trying to call .dispose() on an InstantiatedEntries object but it doesn’t seem to have any effect.
I just ran npm upgrade to babylonjs version 5.46.0. Any insights?
Hey thanks, @Takemura! It may be related to my npm/webpack configuration, or some part of my implementation. As long as I know that it works for others I’ll keep trying to make it work in my environment.
@RaananW I may share a reproduction environment but I’m leaning towards trying to solve it myself for now. Appreciate the offer/suggestion, thank you!
I got it figured out, turned out to be an implementation error I’d made an had been too tired to debug properly until today. @aWeirdo that is indeed the message I’m seeing after upgrading, I appreciate your help.
And thanks everyone for the support! I’ve been a lurker for some time now and am excited to have joined the discussion
I have a question about using rotation quaternions that I’ll start another thread about, with a proper reproduction environment.