Fix VehicleCreator not receiving keyboard input
Keyboard events for vehicle controls (WASD, Space, Enter) never reached VehicleEditorController.onAction() because SceneViewerTopComponent forwards AWT key events only to the active camera controller's onKeyEvent(), bypassing the jME3 InputManager entirely.
Changes
-
VehicleCreatorCameraController: Override
onKeyEvent()to forward key events toVehicleEditorController, following the pattern used byComposerCameraController -
VehicleEditorController: Add
onKeyEvent()that translates key codes to action bindings and delegates toonAction() - VehicleCreatorTopComponent: Wire up the editor controller reference to the camera controller
// VehicleCreatorCameraController.java
@Override
public void onKeyEvent(KeyInputEvent kie) {
super.onKeyEvent(kie);
if (editorController != null) {
editorController.onKeyEvent(kie);
}
}
[!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:
archive.apache.org
- 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.6-bin/afr5mpiioh2wthjmwnkmdsd5w/gradle-8.6/lib/gradle-launcher-8.6.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.6-bin/afr5mpiioh2wthjmwnkmdsd5w/gradle-8.6/lib/agents/gradle-instrumentation-agent-8.6.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon(dns block)java.sun.com
- Triggering command:
/opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/working/files-to-index8852255008887610968.list --sourceArchiveDir=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/trap/java(dns block)www.netbeans.org
- Triggering command:
/opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/working/files-to-index8852255008887610968.list --sourceArchiveDir=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/trap/java(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)
Original prompt
This section details on the original issue you should resolve
<issue_title>VehicleCreator not receiving input</issue_title> <issue_description>For some reasons the inputs don't reach the onAction method. I've tried adding it as a RawInputListener. Events are emitted, as I've seen them in debug in the camera class (which is also a RawInputListener) There I can see that the VehicleEditorController is indeed in the list.
Why would events come to the camera, but not the VehicleEditorController?
The only reason I can see is if the event is consumed, somehow. But why? And who?</issue_description>
<agent_instructions>This is going to be really difficult to debug without running the actual build, but give it a try. Analyze why events don't reach VehicleEditorController, but obviously are emitted since the camera gets them. The sub project is: https://github.com/jMonkeyEngine/sdk/tree/master/jme3-vehicle-creator </agent_instructions>
Comments on the Issue (you are @copilot in this section)
- Fixes jMonkeyEngine/sdk#581
⨠Let Copilot coding agent set things up for you â coding agent works faster and does higher quality work when set up for your repo.