Remove the fragile camNode.getControl(0).setEnabled()

and replaced it with camNode.setEnabled().
A) it is kind of scary to rely on the control index in
this case.
B) CameraNode.setEnabled() already calls setEnabled()
on the CameraControl.
An acceptable alternative would be:
camNode.getControl(CameraControl.class).setEnabled()
but I didn't see the point of it.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9267 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 13 years ago
parent 0e315d57da
commit 4e12127f27
  1. 6
      engine/src/test/jme3test/animation/TestCameraMotionPath.java

@ -73,7 +73,7 @@ public class TestCameraMotionPath extends SimpleApplication {
cam.setLocation(new Vector3f(8.4399185f, 11.189463f, 14.267577f)); cam.setLocation(new Vector3f(8.4399185f, 11.189463f, 14.267577f));
camNode = new CameraNode("Motion cam", cam); camNode = new CameraNode("Motion cam", cam);
camNode.setControlDir(ControlDirection.SpatialToCamera); camNode.setControlDir(ControlDirection.SpatialToCamera);
camNode.getControl(0).setEnabled(false); camNode.setEnabled(false);
path = new MotionPath(); path = new MotionPath();
path.setCycle(true); path.setCycle(true);
path.addWayPoint(new Vector3f(20, 3, 0)); path.addWayPoint(new Vector3f(20, 3, 0));
@ -170,11 +170,11 @@ public class TestCameraMotionPath extends SimpleApplication {
playing = false; playing = false;
cameraMotionControl.stop(); cameraMotionControl.stop();
chaser.setEnabled(true); chaser.setEnabled(true);
camNode.getControl(0).setEnabled(false); camNode.setEnabled(false);
} else { } else {
playing = true; playing = true;
chaser.setEnabled(false); chaser.setEnabled(false);
camNode.getControl(0).setEnabled(true); camNode.setEnabled(true);
cameraMotionControl.play(); cameraMotionControl.play();
} }
} }

Loading…
Cancel
Save