Skip to content

Conversation

Copy link

Copilot AI commented Feb 11, 2026

InstancedNode loses its InstanceNodeControl after serialization/deserialization, leaving the node non-functional. The control's node field was not being serialized, resulting in a null reference on load.

InstancedNode node = new InstancedNode("test");
// ... populate with instanced geometries ...
node.instance();

InstancedNode loaded = (InstancedNode) BinaryExporter.saveAndLoad(assetManager, node);
loaded.getNumControls(); // returns 0 - control is missing

Changes

  • InstancedNode.java: Override write(JmeExporter) and read(JmeImporter) to explicitly serialize/deserialize the control field
  • Pattern mirrors existing CameraNode and LightNode implementations
  • InstancedNodeTest.java: Verify control preservation across serialization

The inner InstancedNodeControl class has empty write/read methods, so while the control was being serialized through the parent Spatial class's controls list, its internal node reference was not. Explicit serialization at the InstancedNode level resolves this.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.8-bin/dl7vupf4psengwqhwktix4v1/gradle-8.8/lib/gradle-launcher-8.8.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.8-bin/dl7vupf4psengwqhwktix4v1/gradle-8.8/lib/agents/gradle-instrumentation-agent-8.8.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>InstancedNode: missing InstanceNodeControl after deserialization</issue_title>
<issue_description>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
```</issue_description>

<agent_instructions>investigate the issue and figure out if it needs a patch and how to patch it properly</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 11, 2026 21:49
…e control

Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing InstanceNodeControl after deserialization Fix InstancedNode losing InstanceNodeControl after deserialization Feb 11, 2026
@riccardobl riccardobl marked this pull request as ready for review February 11, 2026 21:53
Copilot AI requested a review from riccardobl February 11, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InstancedNode: missing InstanceNodeControl after deserialization

2 participants