Nodes which have been used for batching are not removed after batching

Hello dear community,

I am playing around with batching at the moment and noticed that the nodes (in my case AssetLinkNodes) which have been used for batching are still there after the batching process. Is this a intended behaviour or is this a “bug”?

In the following you see two screenshots, one before and the other after batching:

Before batching

After batching:

I also tested this in code and it I got the same result.

public void simpleInitApp() {
    Node scene = (Node) assetManager.loadModel("Scenes/BatchTest.j3o");
    System.out.println(scene.getChildren().size()); // output is 6

So do I have to remove the empty nodes manually after batching?

Best regards

Note: that based on my understanding, the above call is meaningless as you aren’t capturing the results but maybe you are just using it for testing to show us.

Based on the javadoc for optimize():
“Optimizes a scene by combining Geometry with the same material. All Geometries found in the scene are detached from their parent and a new Node containing the optimized Geometries is attached.”

If you have node children then they won’t be removed. Only the geometry gets removed.

Perhaps that’s what is happening here.

First of all, thank you for your answer!

I remember a use-case tutorial of @normen where he also used batching and when I remember correctly the nodes there got removed as well.

Concerning the rest of your post your are probably correct.

Maybe create a child node in the “Scene” node.
Put the linked models into the newly created node.
Batch the newly created node instead of the “Scene” node.

Would that make a difference?

No actually not,sorry.This must be intended behavior.
Perhaps Normen paused his recorder and deleted the empty nodes manually?
It would be a useful feature to be added in the SDK though,deleting the empty nodes automatically after batching.