Closed mysterybear closed 1 year ago
Ah, also mappings from CV-MAP are not saved
Ah if I use STRIP everything's fine... I guess that's the suggested solution?
The selection-function is integrated in Rack, unfortunately there is no support for mappings or custom elements (like labels). I suggest a feature request on Rack's development.
Feature request submited to the VCV-support.
I like to propose a feature for Rack v2: Currently mappings within CV-Map are lost when loaded or cloned using the selection feature. The problem is obviously, that added modules included in the selection get new module-ids which can't be addressed from the preset loaded into CV-Map. CV-Map must get knowledge which "old" ids map to "new" ids and update the preset accordingly while loading. Some other modules could be benefit from this feature, like my labeling module "GLUE": vcvrack-packone/Glue.md at v2-dev · stoermelder/vcvrack-packone (github.com)
vcvrack-packone/Glue.md at v2-dev · stoermelder/vcvrack-packone Modules for VCV Rack . Contribute to stoermelder/vcvrack-packone development by creating an account on GitHub. github.com
The routine for pasting a selection had to look this way then:
- Add modules from the selection to Rack and create a map for old ids to new ids
- Load the presets of the modules from the selection, supplied with the map
- Do rest of the stuff, like cables
Following this, the signature of
void Module::dataFromJson(json_t*)
should be changed to something likeModule::dataFromJson(const LoadParams&)
withstruct LoadParaParams { json_t* data; std::map<int64_t, int64_t> newModuleIds; };
I am aware that this would be an ABI breaking change, so maybe it can be implemented as an "extension" class until the next major update of Rack. Something like this:
struct ModuleLoadEx { struct LoadParams { json_t* rootJ; std::map<int64_t, int64_t> newModuleIds; }; virtual void dataFromJson(const LoadParams& params) { Module* m = dynamic_cast<Module*>(this); if (m) { m->dataFromJson(params.rootJ); } } };
Which can be used this way:
struct MyModule : Module, ModuleLoadEx { void dataFromJson(const LoadParams& params) override { // do stuff here } };
Later on (Rack v3, vor example) this could be set to the default behavior without breaking the current API. Thanks for your consideration, Ben
VCV support responded they would not add something for this scenario at the moment, so I close this for now.
Just to let you know: I added module S++ which adds options to paste or import Rack selections while preserving GLUE's labels. 146d3d366a5e91ec5c4518e486d7c54b05175990
Hey,
Is it just me or are glue labels not saved as part of saved selections?