-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pdx.lua: Add prereload/postreload callback methods (experimental).
These methods are invoked when an object script gets reloaded, so that you can customize the reload process. This was suggested by @ben-wes, thanks Ben! - self:prereload(), if it exists, gets invoked immediately *before* reloading the script file. - self:postreload(), if it exists, gets invoked immediately *after* reloading the script file. Both prereload() and postreload() may change the member variables of the object in any desired way. The only difference is that prereload() still runs in the *old* script, while postreload() uses the *new* script which has just been loaded. Thus, prereload() would typically be used to save some essential state which might be lost during reloading, so that it can be retrieved later (e.g., in the postreload() method). Note that these methods can, in particular, change the inlets and outlets members of the object. In this case, after running the postreload() method, the object's iolets will be adjusted accordingly. To make this work, we modified the internal inlet/outlet creation routines in pdlua.c so that they will update the iolets (instead of always creating them from scratch), while preserving as many existing connections as possible. Note that this may still cause some cords to be removed, if the new configuration has less iolets or iolets of different (control/signal) types.
- Loading branch information
Showing
2 changed files
with
161 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters