Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stephengold opened this issue Feb 11, 2025 · 0 comments
Open

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

stephengold opened this issue Feb 11, 2025 · 0 comments
Labels
defect Something that is supposed to work, but doesn't. Less severe than a "bug"

Comments

@stephengold
Copy link
Member

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.

@stephengold stephengold added the defect Something that is supposed to work, but doesn't. Less severe than a "bug" label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Something that is supposed to work, but doesn't. Less severe than a "bug"
Projects
None yet
Development

No branches or pull requests

1 participant