Browse Source

SDK:
- fix VehicleCreator camera threading

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8630 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

nor..67 14 năm trước cách đây
mục cha
commit
96ec3afec4

+ 7 - 0
jme3-vehicle-creator/src/com/jme3/gde/vehiclecreator/VehicleCreatorTopComponent.java

@@ -44,6 +44,7 @@ public final class VehicleCreatorTopComponent extends TopComponent implements Sc
     private boolean testing = false;
     DirectionalLight dirLight = new DirectionalLight();
     private HelpCtx ctx = new HelpCtx("sdk.vehicle_creator");
+    private VehicleCreatorCameraController cameraController;
 
     public VehicleCreatorTopComponent() {
         initComponents();
@@ -889,6 +890,8 @@ public final class VehicleCreatorTopComponent extends TopComponent implements Sc
             currentRequest = null;
             final VehicleEditorController controller = editorController;
             setLoadedScene(null, false);
+            cameraController.disable();
+            cameraController = null;
             SceneApplication.getApplication().enqueue(new Callable<Void>() {
 
                 public Void call() throws Exception {
@@ -904,6 +907,10 @@ public final class VehicleCreatorTopComponent extends TopComponent implements Sc
         if (request == sentRequest) {
             currentRequest = request;
             editorController = newEditorController;
+            cameraController = new VehicleCreatorCameraController(SceneApplication.getApplication().getCamera(), SceneApplication.getApplication().getInputManager());
+            cameraController.setMaster(this);
+            cameraController.enable();
+            cameraController.setVehicle(request.getRootNode());
             setLoadedScene(currentRequest.getDataObject().getNodeDelegate(), true);
             final VehicleEditorController controller = editorController;
             SceneApplication.getApplication().enqueue(new Callable<Void>() {

+ 0 - 7
jme3-vehicle-creator/src/com/jme3/gde/vehiclecreator/VehicleEditorController.java

@@ -60,7 +60,6 @@ public class VehicleEditorController implements LookupListener, ActionListener {
     private Result<VehicleWheel> result2;
     private List<Geometry> list = new LinkedList<Geometry>();
     private SceneToolController toolController;
-    private VehicleCreatorCameraController cameraController;
     private Node toolsNode;
     private BulletAppState bulletState;
     private boolean testing = false;
@@ -107,16 +106,10 @@ public class VehicleEditorController implements LookupListener, ActionListener {
         SceneApplication.getApplication().getInputManager().addMapping("VehicleEditor_Space", new KeyTrigger(KeyInput.KEY_SPACE));
         SceneApplication.getApplication().getInputManager().addMapping("VehicleEditor_Reset", new KeyTrigger(KeyInput.KEY_RETURN));
         SceneApplication.getApplication().getInputManager().addListener(this, "VehicleEditor_Left", "VehicleEditor_Right", "VehicleEditor_Up", "VehicleEditor_Down", "VehicleEditor_Space", "VehicleEditor_Reset");
-        cameraController = new VehicleCreatorCameraController(SceneApplication.getApplication().getCamera(), SceneApplication.getApplication().getInputManager());
-        cameraController.setMaster(this);
-        cameraController.enable();
-        cameraController.setVehicle(rootNode);
     }
 
     public void cleanupApplication() {
         SceneApplication.getApplication().getInputManager().removeListener(this);
-        cameraController.disable();
-        cameraController = null;
         SceneApplication.getApplication().getStateManager().detach(getBulletState());
     }