Cycling74 / rnbo-runner-panel

Web interface to the RNBO runner
MIT License
11 stars 2 forks source link

FR: Persist Graph Node Coordinates #52

Closed fde31 closed 11 months ago

fde31 commented 11 months ago

Currently the graph coordinates are only persistent during a session and not recalled when reloading the page. Would be great to find a way to persist them by also making it specific to a runner instance

fde31 commented 11 months ago

Seems like /rnbo/info/system_id provides a unique system id that could be used to store graph information on the client, however that means that opening the UI from different devices will lead to different graph layouts. Any other ideas @x37v ?

x37v commented 11 months ago

I was wondering if we might want to allow for storing some metadata in the runner database.. right now there is an idea of 'sets' that let you store/restore graphs and their connections, there is also an unnamed "last" set that restores your last graph on reboot even if you didn't save, we could add metadata to the sets so that the web client could add position information?

fde31 commented 11 months ago

Cool. Sets sounds a bit like a follow-up FR as u documented already in #47 for which as a user I'd suspect the coordinates to persist as well. So maybe we start with storing the coordinates on the runner - if you can provide some insight on the API and data struct for that it shouldn't be too problematic to add

x37v commented 11 months ago

@fde31 there is now a string field (I assume you'd stringify JSON) meta in sets You can write to it, read from it on other hosts.. if we load a set, that field will be sent, if you save a set, that field will be saved with the set data.. and you don't have to utilize the save/load directly immediately, sets are used to save/restore between runner restarts, so you can simply populate meta, wait a moment, restart the runner and you should see it pop up as it was before.

{
  "FULL_PATH": "/rnbo/inst/control/sets",
  "CONTENTS": {
    "meta": {
      "FULL_PATH": "/rnbo/inst/control/sets/meta",
      "TYPE": "s",
      "VALUE": "{\"foo\": false}",
      "ACCESS": 2,
      "CLIPMODE": "none",
      "DESCRIPTION": "Set/get the metadata for the current set"
    },
    "save": {
      "FULL_PATH": "/rnbo/inst/control/sets/save",
      "TYPE": "s",
      "VALUE": "foo",
      "ACCESS": 2,
      "CLIPMODE": "none",
      "DESCRIPTION": "Save a set of instances assigning the given name"
    },
    "load": {
      "FULL_PATH": "/rnbo/inst/control/sets/load",
      "TYPE": "s",
      "VALUE": "foo",
      "RANGE": [
        {
          "VALS": [
            "foo"
          ]
        }
      ],
      "ACCESS": 2,
      "CLIPMODE": "both",
      "DESCRIPTION": "Load a set with the given name"
    }
  }
}