Skip to content

InstancedNode: missing InstanceNodeControl after deserialization #2592

@capdevon

Description

@capdevon

When deserializing a InstancedNode, the associated InstanceNodeControl is missing.

https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedNode.java#L124

Minimal Example:
The following code creates an InstancedNode, populates it with many instanced geometries, and then serializes/deserializes it using BinaryExporter.saveAndLoad.
After loading, the InstancedNode no longer contains its InstanceNodeControl.

        InstancedNode instancedNode = new InstancedNode("instanced_node");

        int extent = 30;
        Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        material.setBoolean("UseInstancing", true);
        material.setColor("Color", ColorRGBA.Red);

        for (int y = -extent; y < extent; y++) {
            for (int x = -extent; x < extent; x++) {
                Geometry geo = createInstance(x, y);
                geo.setMaterial(material);
                instancedNode.attachChild(instance);
            }
        }

        instancedNode.instance();
        rootNode.attachChild(instancedNode);

        InstancedNode load = (InstancedNode) BinaryExporter.saveAndLoad(assetManager, instancedNode);
        load.getNumControls(); // returns 0

Metadata

Metadata

Labels

To be investigatedbugSomething that is supposed to work, but doesn't. More severe than a "defect".

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions