Skip to content

[ImGui] User interface for Snapshot feature#289

Open
Lucas-TJ wants to merge 63 commits into
sofa-framework:masterfrom
Lucas-TJ:saveSnapshotAPI2
Open

[ImGui] User interface for Snapshot feature#289
Lucas-TJ wants to merge 63 commits into
sofa-framework:masterfrom
Lucas-TJ:saveSnapshotAPI2

Conversation

@Lucas-TJ

@Lucas-TJ Lucas-TJ commented Jul 16, 2026

Copy link
Copy Markdown

PR SofaImGui - Snapshot

Snapshot (in SofaImGui)

Related to sofa-framework/sofa#6168 (Do not merge before)

Overview

This Pull Request adds a graphical user interface for the Snapshot feature in SofaImGui. It allows users to:

  • Save/Load snapshots in memory
  • Save/Load snapshots from a file
  • Save/Load a set of snapshots from a single file

Demonstration

Setup

The Snapshot window is available from the "Windows" menu

Capture d’écran du 2026-07-15 10-44-19

Save/Load in Memory or File

In the Snapshot window, users can choose whether to save/load snapshots in memory or from a file. It is also possible to save/load a set of snapshots in a single file.

Capture d’écran du 2026-07-15 10-45-33

API

The implementation relies on ImGui widgets. A new WindowState, winManagerSnapshot, has been added to ImGuiGUIEngine, along with the showSnapshot() function responsible for displaying the Snapshot window.

showSnapshot() use uses several ImGui widgets, mainly ImGui::Button(), to build the interface. Each button is associated with a corresponding function from SnapshotManager:

  • The "Memory" button in the "Save" section calls doMemorySave(). The "Memory (recent)" button in the "Load" section calls doMemoryLoad(), which restores the most recently saved snapshot
  • The "File" button in the "Save" section calls doFileSave() with the parameter isSet set to false. The corresponding "File" button in the "Load" section calls doFileLoad() with the parameter isSet set to false
  • The "Set of Snapshots" button in the "Save" section calls doFileSave() with the parameter isSet set to true. The corresponding "Set of Snapshots" button in the "Load" section calls doFileLoad() with the parameter isSet set to true
  • The right side of the window displays the list of available snapshots. If no snapshots are available, the message "(No recent files)" is displayed. Otherwise, all available snapshots are listed and can be clicked to restore them. Snapshots stored on disk and snapshots stored in memory are handled separately.

By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

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.

1 participant