JSON access in module constructor

Hi,

Is it possible to obtain JSON data stored in the “data” data field using some method and not by the callback “dataFromJson”. I need specific JSON data at the time when the plugins module ctor is called.

“dataFromJson” seems to be called by Rack in unclear intervals. Sometimes when a new plugin instance is created, it is called, sometimes not. Is there a rule, when it is called?

Thx, rma

What’s limiting you from using the dataFromJson to initialise the objects you would create in the ctor ?

ctor is called before dataFromJson is called by Rack or do I misunderstand that?

I initialize process data in the ctor, thus I need all data from the json at construction time.

yes, of course, constructor is called before, and immediately after is called the “fromJson”

I don’t understand why you can’t init or change the status to your members in the “fromJson”

of course “dataFromJson” will be called only for modules coming from open file - cut&paste - undo&redo actions

Blockquote immediately after is called the “fromJson”

I wasn’t aware it is always called immediately after, will implement a “delayed” init of the params then. Thanks also for the hint on when dataFromJson is called otherwise :smiley:

Your MyModule() constructor should initialize your module in its default state. When dataFromJson() is called, its state should be replaced by the given JSON.

It is called if creating a module with a template preset, cloning a module, loading a patch, etc.