Skip to content

Feat: Session saving and loading with mappersession#33

Merged
malloch merged 9 commits intolibmapper:mainfrom
bboettcher3:feat/sessions
Dec 16, 2022
Merged

Feat: Session saving and loading with mappersession#33
malloch merged 9 commits intolibmapper:mainfrom
bboettcher3:feat/sessions

Conversation

@bboettcher3
Copy link
Copy Markdown
Contributor

@bboettcher3 bboettcher3 commented Nov 12, 2022

  • Adds a requirements.txt to install mappersession (which installs libmapper) and netifaces
  • Uses the new mappersession python module to save, load and stage session files
    • Stages the current session by default
  • User can click "Unload" to clear the current session
    • Opening a new session will automatically clear as well
    • Handles enabling/disabling of Unload button depending on if file is loaded
  • Shows currently loaded session name:

image

@DocSunset
Copy link
Copy Markdown
Contributor

So I have a few thoughts.

I think it's important that we keep the old file format load functionality accessible in some fashion, since otherwise it will be impossible to load old files with the new webmapper. I think eventually we could get rid of that functionality (mark it deprecated, move it to legacy, etc. etc.), but until mappersession is for sure stable, and until anyone with old mappings has had lots of time to adopt it, there should be a way to keep using those old mappings. This would also make it easier for naive users to transition to the new system without having to run two versions of webmapper (one to load the old format and one to save the new one). I guess the easiest thing would be for the load button to detect if the file being loaded is in the old format and default to using the old load method.

Otherwise this all seems very reasonable.

One feature I would request on top of this feature pull request might be for a saved map to be automatically moved into the staged slot without having to be loaded manually.

@malloch
Copy link
Copy Markdown
Member

malloch commented Nov 16, 2022

@DocSunset I agree! We have been including file format version numbers in mapping files for this exact reason – webmapper should be able to read legacy versions.

@malloch
Copy link
Copy Markdown
Member

malloch commented Nov 16, 2022

@bboettcher3 I have some questions about the "clearing" you mention in the description above. When unloading or loading a new session are all the current maps removed? How do we handle multiple concurrent sessions on the network?

@bboettcher3
Copy link
Copy Markdown
Contributor Author

@DocSunset legacy loading with the fileversion tag is in the pipeline, i'll add this soon. Same for adding new maps to the staging list. (marking PR as draft until ready)
@malloch I suppose this can be fixed by asking the user if they want to clear each time they load a new session, I'll add that to my TODO list too

@bboettcher3 bboettcher3 marked this pull request as draft November 16, 2022 03:55
@malloch
Copy link
Copy Markdown
Member

malloch commented Nov 19, 2022

@bboettcher3 we should also consider a scenario where a single user is juggling multiple concurrent/overlapping sessions, so that sessions/scenes are not mutually exclusive. Your load/unload model works well here, but we might need a list of active sessions with unload buttons, or a menu for load and a separate menu for unload...

@edumeneses
Copy link
Copy Markdown

Nice discussion/comments.

I suggest we fix the legacy loading in this PR and merge it as soon as possible.

Then we open a new PR/branch for the concurrent mapping session options. My suggestions for that one:

  • open session button (add a session to the list of available sessions)
  • close session button (remove a session from the list of available sessions)
  • save session button
  • load session button (manually load selected session: apply/create all saved mappings)
    • Suggestion: Clear checkmark (clear all maps before loading the session)
    • Suggestion: replace checkmark (replace all maps for the devices saved on the map, i.e., clean only the devices mentioned in the session file)
  • stage switch (on/off)

@bboettcher3
Copy link
Copy Markdown
Contributor Author

bboettcher3 commented Nov 22, 2022

Update to the appearance of the panel:
image

And a prompt for clearing also added when loading:
image

Just need to add legacy file loading and it should be set (if we agree with Edu's proposal above)

@malloch
Copy link
Copy Markdown
Member

malloch commented Nov 22, 2022

For consistency we should use the term "maps" not "connections". Also, what do you think of changing the prompt to "clear active sessions" instead of "clear all connections before loading"? Existing maps that are also included in the session to be loaded should be modified rather than cleared and reloaded though...

@bboettcher3
Copy link
Copy Markdown
Contributor Author

what do you think of changing the prompt to "clear active sessions" instead of "clear all connections before loading"?

Sounds good to me! Just pushed that fix.

@bboettcher3
Copy link
Copy Markdown
Contributor Author

Do either @malloch or @DocSunset have any sessions saved with fileversion 2.2 or older that I can test with?

@malloch
Copy link
Copy Markdown
Member

malloch commented Nov 22, 2022

@edumeneses
Copy link
Copy Markdown

For consistency we should use the term "maps" not "connections". Also, what do you think of changing the prompt to "clear active sessions" instead of "clear all connections before loading"? Existing maps that are also included in the session to be loaded should be modified rather than cleared and reloaded though...

If we think about it, even the term "session" is misleading. The session, in this case, is a collection of mappings that do not necessarily represent the entire state of the network mappings: some devices may not be part of the saved mappings but are available in the network (same session?)

This is not an issue, but more food for thought.

@malloch
Copy link
Copy Markdown
Member

malloch commented Nov 22, 2022

I agree that the terminology is confusing – what should we call a collection of maps (and possibly other state) that a user wishes to store/load together? Terms like session and scene imply that they include the entire network state (as pointed out by @edumeneses) and thus don't make sense for concurrent states.
Some other possibilities: collection, mapping ...

@DocSunset
Copy link
Copy Markdown
Contributor

DocSunset commented Nov 22, 2022 via email

@bboettcher3
Copy link
Copy Markdown
Contributor Author

I like sub-session :). Also @malloch and @DocSunset , I'm finishing up the legacy file loading using the files you supplied as references (along with webmapper's existing parsing) and see that:

  • version 2.0 expressions use the format d[0]=s[0]
  • version 2.1 uses dest[0]=src[0]
  • version 2.2 uses d[0]=s[0]

Just confirming that this switch and switch back isn't an error in the files you shared? Seemed odd enough to ask haha

@malloch
Copy link
Copy Markdown
Member

malloch commented Nov 23, 2022

I think v2.2 should use the format dst[0]=src[0]

@bboettcher3
Copy link
Copy Markdown
Contributor Author

bboettcher3 commented Nov 23, 2022

ufmg2011.soprano_v2.2.json.zip

^This file you sent uses the format "d[0]=abs(s[0])*0.05" and it's in 2.2

@malloch
Copy link
Copy Markdown
Member

malloch commented Nov 23, 2022

@bboettcher3 interesting... that may be a mistake then. The v2.2 parsing code in webmapper is clearly expecting src and dst.

@bboettcher3
Copy link
Copy Markdown
Contributor Author

Yep, i noticed that too. Do you have any more 2.2 files so that we can figure out if its a mistake on webmapper's side or that file?

@bboettcher3 bboettcher3 marked this pull request as ready for review November 27, 2022 00:43
@bboettcher3
Copy link
Copy Markdown
Contributor Author

@malloch @DocSunset Tested with loading 2.0-2.3 (and the current version 2.4), all should be good now :)

@malloch
Copy link
Copy Markdown
Member

malloch commented Dec 16, 2022

Here is my proposal:

  • a mapping file should contain one or more "groups" of maps and static signal values.
  • loading the file in webmapper (or a similar UI) creates mini UIs for each group with buttons for load, unload, and solo, and text stating the number of maps contained in the group. This enables to load map groups in parallel. Unloading a map group doesn't close the file, and doesn't destroy maps that are also members of another active group.
  • users can also drag selected maps onto existing groups or create a new one. I'm not sure yet how to easily remove maps from a group, since groups could contain 'offline' maps that are not normally displayable in the main views.
  • multiple files can be open at the same time as well, so groups belonging to a file should be ganged together visually

@malloch malloch merged commit cd28db4 into libmapper:main Dec 16, 2022
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.

4 participants