diff --git a/engine/src/core/com/jme3/scene/CameraNode.java b/engine/src/core/com/jme3/scene/CameraNode.java index c6bb48b94..6777b7257 100644 --- a/engine/src/core/com/jme3/scene/CameraNode.java +++ b/engine/src/core/com/jme3/scene/CameraNode.java @@ -31,6 +31,10 @@ */ package com.jme3.scene; +import java.io.IOException; + +import com.jme3.export.JmeExporter; +import com.jme3.export.JmeImporter; import com.jme3.renderer.Camera; import com.jme3.scene.control.CameraControl; import com.jme3.scene.control.CameraControl.ControlDirection; @@ -90,4 +94,16 @@ public class CameraNode extends Node { // this.lookAt(position, upVector); // camControl.getCamera().lookAt(position, upVector); // } + + @Override + public void read(JmeImporter im) throws IOException { + super.read(im); + camControl = (CameraControl)im.getCapsule(this).readSavable("camControl", null); + } + + @Override + public void write(JmeExporter ex) throws IOException { + super.write(ex); + ex.getCapsule(this).write(camControl, "camControl", null); + } } diff --git a/engine/src/core/com/jme3/scene/LightNode.java b/engine/src/core/com/jme3/scene/LightNode.java index 5e6dc7655..6122b2fbf 100644 --- a/engine/src/core/com/jme3/scene/LightNode.java +++ b/engine/src/core/com/jme3/scene/LightNode.java @@ -31,6 +31,10 @@ */ package com.jme3.scene; +import java.io.IOException; + +import com.jme3.export.JmeExporter; +import com.jme3.export.JmeImporter; import com.jme3.light.Light; import com.jme3.scene.control.LightControl; import com.jme3.scene.control.LightControl.ControlDirection; @@ -90,4 +94,16 @@ public class LightNode extends Node { public Light getLight() { return lightControl.getLight(); } + + @Override + public void read(JmeImporter im) throws IOException { + super.read(im); + lightControl = (LightControl)im.getCapsule(this).readSavable("lightControl", null); + } + + @Override + public void write(JmeExporter ex) throws IOException { + super.write(ex); + ex.getCapsule(this).write(lightControl, "lightControl", null); + } } diff --git a/engine/src/core/com/jme3/scene/control/CameraControl.java b/engine/src/core/com/jme3/scene/control/CameraControl.java index 9fe5e5fec..5ccb2a5b5 100644 --- a/engine/src/core/com/jme3/scene/control/CameraControl.java +++ b/engine/src/core/com/jme3/scene/control/CameraControl.java @@ -31,8 +31,12 @@ */ package com.jme3.scene.control; +import java.io.IOException; + +import com.jme3.export.InputCapsule; import com.jme3.export.JmeExporter; import com.jme3.export.JmeImporter; +import com.jme3.export.OutputCapsule; import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; import com.jme3.renderer.Camera; @@ -40,7 +44,6 @@ import com.jme3.renderer.RenderManager; import com.jme3.renderer.ViewPort; import com.jme3.scene.Spatial; import com.jme3.util.TempVars; -import java.io.IOException; /** * This Control maintains a reference to a Camera, @@ -142,18 +145,21 @@ public class CameraControl extends AbstractControl { return control; } private static final String CONTROL_DIR_NAME = "controlDir"; - + private static final String CAMERA_NAME = "camera"; + @Override public void read(JmeImporter im) throws IOException { super.read(im); - im.getCapsule(this).readEnum(CONTROL_DIR_NAME, - ControlDirection.class, ControlDirection.SpatialToCamera); + InputCapsule ic = im.getCapsule(this); + controlDir = ic.readEnum(CONTROL_DIR_NAME, ControlDirection.class, ControlDirection.SpatialToCamera); + camera = (Camera)ic.readSavable(CAMERA_NAME, null); } @Override public void write(JmeExporter ex) throws IOException { super.write(ex); - ex.getCapsule(this).write(controlDir, CONTROL_DIR_NAME, - ControlDirection.SpatialToCamera); + OutputCapsule oc = ex.getCapsule(this); + oc.write(controlDir, CONTROL_DIR_NAME, ControlDirection.SpatialToCamera); + oc.write(camera, CAMERA_NAME, null); } } \ No newline at end of file diff --git a/engine/src/core/com/jme3/scene/control/LightControl.java b/engine/src/core/com/jme3/scene/control/LightControl.java index 940d9c451..70305200f 100644 --- a/engine/src/core/com/jme3/scene/control/LightControl.java +++ b/engine/src/core/com/jme3/scene/control/LightControl.java @@ -31,8 +31,12 @@ */ package com.jme3.scene.control; +import java.io.IOException; + +import com.jme3.export.InputCapsule; import com.jme3.export.JmeExporter; import com.jme3.export.JmeImporter; +import com.jme3.export.OutputCapsule; import com.jme3.light.DirectionalLight; import com.jme3.light.Light; import com.jme3.light.PointLight; @@ -42,7 +46,6 @@ import com.jme3.renderer.RenderManager; import com.jme3.renderer.ViewPort; import com.jme3.scene.Spatial; import com.jme3.util.TempVars; -import java.io.IOException; /** * This Control maintains a reference to a Camera, @@ -173,18 +176,21 @@ public class LightControl extends AbstractControl { return control; } private static final String CONTROL_DIR_NAME = "controlDir"; - + private static final String LIGHT_NAME = "light"; + @Override public void read(JmeImporter im) throws IOException { super.read(im); - im.getCapsule(this).readEnum(CONTROL_DIR_NAME, - ControlDirection.class, ControlDirection.SpatialToLight); + InputCapsule ic = im.getCapsule(this); + controlDir = ic.readEnum(CONTROL_DIR_NAME, ControlDirection.class, ControlDirection.SpatialToLight); + light = (Light)ic.readSavable(LIGHT_NAME, null); } @Override public void write(JmeExporter ex) throws IOException { super.write(ex); - ex.getCapsule(this).write(controlDir, CONTROL_DIR_NAME, - ControlDirection.SpatialToLight); + OutputCapsule oc = ex.getCapsule(this); + oc.write(controlDir, CONTROL_DIR_NAME, ControlDirection.SpatialToLight); + oc.write(light, LIGHT_NAME, null); } } \ No newline at end of file