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

Update get/toJSON/loadJSON methods with focalOffset #137

Merged
merged 2 commits into from
Oct 8, 2020

Conversation

nikhilxb
Copy link
Contributor

  • Mirror other properties (target, position, etc.) by adding getFocalOffset().
    • Useful because sometimes setFocalOffset() values need to be calculated as a function of the current values, which are changed during trucking.
  • Preserve focalOffset, focalOffset0 in toJSON()/loadJSON().
    • Needed for completeness for recreating camera state.

- Mirror other properties (target, position, etc.) by adding `get` method
- Update `save`/`load` methods focalOffset + focalOffset0 so state can be preserved
@nikhilxb
Copy link
Contributor Author

nikhilxb commented Sep 25, 2020

Note that this could be a breaking change, because loadJSON() currently does not seem to use default values in case obj.focalOffset/obj.position/etc do not exist. So it is not possible to use loadJSON() with JSON saved from earlier versions.

But this problem is not specific to focalOffset, as any adding any new field in the future will result in the same problem. Not sure if it matters to you at this stage, just thought I'd bring it up.

@yomotsu
Copy link
Owner

yomotsu commented Sep 26, 2020

Thanks for your first contribution!
Looks perfect!

If you could, would you mind adding getFocalOffset to the doc(readme.md) as well?

Note that this could be a breaking change

I will manage that later👍

@nikhilxb
Copy link
Contributor Author

nikhilxb commented Oct 8, 2020

Done!

@yomotsu
Copy link
Owner

yomotsu commented Oct 8, 2020

Thank you so much!

@yomotsu yomotsu merged commit 0bb08c1 into yomotsu:dev Oct 8, 2020
@yomotsu
Copy link
Owner

yomotsu commented Oct 8, 2020

just merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants