Any callback when I duplicate module?


I’d like to know if there are any callback to the module I’m duplicating within Rack that I use to manage some data arriving from the duplicate one. Is there any?


There is no „callback“ I know off but I’m using the test if (APP->engine->getModule(id) != NULL) in dataFromJson() to test if a module is been duplicated.

1 Like

I see the trick :slight_smile: I keep this as a workaround for the moment :slight_smile: Hope in a solid callback in Rack v.2 :stuck_out_tongue:

Thanks master

Duplicating a module is functionally the same as copying it and pasting into the rack. There is no callback for this aggregate process.

Ok :slight_smile: So a onPaste event would be nice, since (after pasting stuff), it could be necessary to shape the copied data in some way.

That’s very vague. How would it differ from dataToJson(). Should it be called immediately after dataToJson()? Would it be called when a new module is created by pasting (Ctrl-V) in the rack? And most importantly, what are the use cases? I can’t think of any legitimate ones. All I can think of are uses that would promote poor design of plugin architecture.

You’re going to have to do a lot of convincing if you want a feature like this, such as a 60 second elevator pitch.

Just think to set a custom UUID for each plugin you are duplicate (for common tasks). Can’t get the dataToJson() value from the copied one, otherwise it would be the same (not a UUID anymore). You need to generate new one after duplicating it. That’s just an exaple…

Yeah, that sounds like “uses that would promote poor design of plugin architecture”. I can’t think of a single problem that a random ID would solve without creating 10 more problems.

It’s not a random id, its a UUID (very different thing).

Would be useful for link processing data in the background on each plugin, which involves use of I/O and be temporany. That’s just an example anyway; you could also think of it for stats, trigger future events, or whatever.

But do whatever you want man, I’m not here to convince you :slight_smile:

Note: this is true also for copy/paste preset, not only Duplicate. Just a note of caution :stuck_out_tongue: Not sure if it can be discriminate the copy/paste from duplicate action…

For my purposes this is perfectly fine. I have a couple of modules for which presets make no sense. Loading data from the patch file must work though.

1 Like

Hey @stoermelder , did you figure this out to work in v2?

Your tricks seems to introduce some deadlocks with new Rack internal process.

Any other way to avoid data to be loaded on fromJson when a module in v2 is duplicated (and/or template/preset be loaded)?