Title: file: rework saving and loading for correctness and to avoid copying by iscgar · Pull Request #1538 · solvespace/solvespace · GitHub
Open Graph Title: file: rework saving and loading for correctness and to avoid copying by iscgar · Pull Request #1538 · solvespace/solvespace
X Title: file: rework saving and loading for correctness and to avoid copying by iscgar · Pull Request #1538 · solvespace/solvespace
Description: Rework the object attributes to avoid needlessly iterating over all of them when needing to save a specific object or load a specific attribute of an object. While at it, add type verification for member serialisation. This caught an issue with the Group::forceToMesh member, which was incorrectly serialised as an int, rather than as a bool. Thankfully this didn't overwrite the next member because there are padding bytes in between, but we shouldn't continue to rely on this broken behaviour. However, this change unfortunately breaks the tests, since the save logic skips int members which are set to 0, but not boolean members which are set to false. This now causes the Group::forceToMesh member to be emitted into the file where it previously wasn't. If we add the same logic to boolean as well, this would still break the tests because other boolean values were previously serialised. So we need to update the tests either way, but I'm not sure if I should just change the existing files, or back them up with _v31 added to their name, like the other ones which have _v20 and _v21. @ruevs, @phkahler please advise on the way to do it, and if I should change the boolean serialisation logic to match the one used for ints, and skip members set to false. Also change the file saving logic so that it doesn't have to go through the sv member of SolveSpaceUI, which needlessly requires copying objects over and over. This leaves sv to be used only as a temporary during file loading, but there's no reason to keep it as a member for this, so it is now made a local variable in the two functions that need it.
Open Graph Description: Rework the object attributes to avoid needlessly iterating over all of them when needing to save a specific object or load a specific attribute of an object. While at it, add type verification for ...
X Description: Rework the object attributes to avoid needlessly iterating over all of them when needing to save a specific object or load a specific attribute of an object. While at it, add type verification for ...
Opengraph URL: https://github.com/solvespace/solvespace/pull/1538
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:45c9650f-15af-56d4-7bf4-66dec28885c9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B05E:343EA:1795B91:1FE2C32:696EADA7 |
| html-safe-nonce | 0a62b95e98f2c346144aff078377f6058d5f184bd330da8df1e1115ddf59221b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDVFOjM0M0VBOjE3OTVCOTE6MUZFMkMzMjo2OTZFQURBNyIsInZpc2l0b3JfaWQiOiI4MjEzMzc5NTMzNzI5ODY5MjIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 065a2349e3ea5aae6dc413982d169267b94769e052e56084a8f4e8943fcfa803 |
| hovercard-subject-tag | pull_request:2366342815 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/solvespace/solvespace/pull/1538/files |
| twitter:image | https://avatars.githubusercontent.com/u/1956576?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1956576?s=400&v=4 |
| og:image:alt | Rework the object attributes to avoid needlessly iterating over all of them when needing to save a specific object or load a specific attribute of an object. While at it, add type verification for ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/solvespace/solvespace git https://github.com/solvespace/solvespace.git |
| octolytics-dimension-user_id | 18541596 |
| octolytics-dimension-user_login | solvespace |
| octolytics-dimension-repository_id | 32905910 |
| octolytics-dimension-repository_nwo | solvespace/solvespace |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 32905910 |
| octolytics-dimension-repository_network_root_nwo | solvespace/solvespace |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width