Skip to content

Spline's type can only be deserialized as CatmullRom #2366

@xiaojiao-zsw

Description

@xiaojiao-zsw

When Spline is serialized, type will be serialized to SplineType.CatmullRom by default, regardless of the current type value.

public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.writeSavableArrayList((ArrayList) controlPoints, "controlPoints", null);
oc.write(type, "type", SplineType.CatmullRom);

Also, when deserializing, type reads the key name as “pathSplineType” instead of “type”.

public void read(JmeImporter im) throws IOException {
InputCapsule in = im.getCapsule(this);
controlPoints = in.readSavableArrayList("controlPoints", new ArrayList<>());
/* Empty List as default, prevents null pointers */
float list[] = in.readFloatArray("segmentsLength", null);
if (list != null) {
segmentsLength = new ArrayList<>(list.length);
for (int i = 0; i < list.length; i++) {
segmentsLength.add(list[i]);
}
}
type = in.readEnum("pathSplineType", SplineType.class, SplineType.CatmullRom);

Metadata

Metadata

Assignees

Labels

defectSomething that is supposed to work, but doesn't. Less severe than a "bug"

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions