Skip to content

MotionEvent.cloneFields() should deeply clone the path field #2370

Closed
@stephengold

Description

@stephengold

The MotionEvent class implements Control and could therefore be included in a model asset. It also contains a mutable MotionPath field, which gets serialized and de-serialized. And MotionPath contains a mutable Spline field, which gets serialized and de-serialized.

The usual use case for deserialization is to load scene-graph assets. Scene graphs are "smart assets" that get cached on first load. Subsequent loads are supposed to yield deep clones of the cached assets.

MotionPath and Spline are mutable objects; they ought to be replicated in any deep clone. However, path field isn't cloned in MotionEvent.cloneFields(), probably because MotionPath isn't cloneable. And MotionPath can't be cloned because Spline isn't cloneable.

MotionPath and Spline should implement the JmeCloneable interface, and MotionEvent.cloneFields() should clone the path field.

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions