Fixes mat param override reading null integenr params as 0
This commit is contained in:
parent
f85624a20a
commit
631794f7d6
@ -140,6 +140,9 @@ public final class MatParamOverride extends MatParam {
|
||||
super.write(ex);
|
||||
OutputCapsule oc = ex.getCapsule(this);
|
||||
oc.write(enabled, "enabled", true);
|
||||
if (value == null) {
|
||||
oc.write(true, "isNull", false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -147,5 +150,9 @@ public final class MatParamOverride extends MatParam {
|
||||
super.read(im);
|
||||
InputCapsule ic = im.getCapsule(this);
|
||||
enabled = ic.readBoolean("enabled", true);
|
||||
boolean isNull = ic.readBoolean("isNull", false);
|
||||
if (isNull) {
|
||||
setValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,35 +49,9 @@ public class TestModelExportingCloning extends SimpleApplication {
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
cam.setLocation(new Vector3f(10f, 3f, 40f));
|
||||
cam.lookAtDirection(Vector3f.UNIT_Z.negate(), Vector3f.UNIT_Y);
|
||||
Spatial s = assetManager.loadModel("Models/gltf/human/human.j3o");
|
||||
rootNode.attachChild(s);
|
||||
|
||||
DirectionalLight dl = new DirectionalLight();
|
||||
dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
|
||||
dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
|
||||
rootNode.addLight(dl);
|
||||
|
||||
AnimControl control;
|
||||
AnimChannel channel;
|
||||
|
||||
Spatial originalModel = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
|
||||
control = originalModel.getControl(AnimControl.class);
|
||||
channel = control.createChannel();
|
||||
channel.setAnim("Walk");
|
||||
rootNode.attachChild(originalModel);
|
||||
|
||||
Spatial clonedModel = originalModel.clone();
|
||||
clonedModel.move(10, 0, 0);
|
||||
control = clonedModel.getControl(AnimControl.class);
|
||||
channel = control.createChannel();
|
||||
channel.setAnim("push");
|
||||
rootNode.attachChild(clonedModel);
|
||||
|
||||
Spatial exportedModel = BinaryExporter.saveAndLoad(assetManager, originalModel);
|
||||
exportedModel.move(20, 0, 0);
|
||||
control = exportedModel.getControl(AnimControl.class);
|
||||
channel = control.createChannel();
|
||||
channel.setAnim("pull");
|
||||
rootNode.attachChild(exportedModel);
|
||||
rootNode.addLight(new DirectionalLight(new Vector3f(-1,-1,-1)));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user