Skip to content

Move editor UI settings out of the locally saved project file - #9131

Open
prafulaa wants to merge 1 commit into
4ian:masterfrom
prafulaa:fix/issue-1983-move-ui-settings
Open

prafulaa wants to merge 1 commit into
4ian:masterfrom
prafulaa:fix/issue-1983-move-ui-settings

Conversation

@prafulaa

Copy link
Copy Markdown

Fixes #1983

Problem

The editor (IDE) settings of a project — scene zoom, grid settings, window mask, etc. — are stored inside the project file (as uiSettings on each layout and editionSettings on each external layout / custom object variant). This is user specific data, so:

  • it is exported with the game, adding unnecessary content to it;
  • it is rewritten whenever someone merely moves around in a scene, generating noise and conflicts for people collaborating on a project with git.

Solution

When a project is saved locally, its editor settings are now moved to a sidecar file stored next to the project file, in a .gdevelop folder:

MyGame/
├── game.json                          <- no more user specific data
└── .gdevelop/
    └── game.editor-settings.json      <- editor settings, one file per project file
  • Teams can gitignore .gdevelop/ (a single entry) to stop sharing/committing these settings. Projects saved in the same folder get distinct sidecar files.
  • When the project is opened, the sidecar settings are read back into the project, so the editors behave exactly as before.
  • Migration is automatic and lossless: a project still containing editor settings (last saved by an older version, or an autosave — which keeps embedding them for recovery) opens with its embedded settings, which are then moved to the sidecar on the next save.
  • The sidecar is written before the project file: if it cannot be written, the save fails rather than silently losing the settings. A stale sidecar is removed when there is nothing left to store.
  • Cloud/online storage providers are untouched: editor settings stay in the project, as there is no "gitignore" concept there.
  • Note: the settings remain in memory (and thus in previews/exports payload), as the in-game editor relies on them (sceneData.uiSettings) to restore the editor state.

Implementation

  • New LocalEditorSettingsSidecar.js in LocalFileStorageProvider: computes the sidecar path (<project folder>/.gdevelop/<project file name>.editor-settings.json), extractProjectEditorSettings (finds and removes uiSettings/editionSettings from a serialized project) and applyProjectEditorSettings (fills them back, never overriding settings already present in the project).
  • LocalProjectWriter writes the sidecar (and removes it when empty) during save — for both single-file and folder projects (extraction happens before splitting, so partial files stay clean too).
  • LocalProjectOpener re-applies the sidecar content when the project (and autosave recovery) is opened.

Tests

  • New LocalEditorSettingsSidecar.spec.js (8 tests): sidecar path mapping per project, extraction/stripping of all three settings kinds (layouts, external layouts, custom object default variant + variants), round-trip restoration, null result when nothing to store, non-destructive application (embedded settings win), robustness against malformed project/sidecar content.
  • Validated against a real serialized game file (GDJS/tests/games/Text.json): extraction strips the settings, round-trip restores identical values, and the rest of the project JSON is untouched.
  • Full newIDE test suite, ESLint, Prettier and Flow pass locally.

Editor settings (scene zoom, grid, window mask...) are user specific
data. They are now stored in a sidecar file next to the project file
(.gdevelop/<project name>.editor-settings.json), which can be
gitignored, instead of inside the project file - avoiding them being
shared with collaborators (and generating git conflicts) and shipped
with the game.

Settings found in a project saved by an older version are migrated to
the sidecar file the next time it is saved.

Fixes 4ian#1983
@prafulaa
prafulaa requested a review from 4ian as a code owner September 22, 2026 20:53

This branch has not been deployed

No deployments
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.

[$20] Move UI settings

1 participant