-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a more reliable way to get script path, added _reload method to…
… reload any object dynamically
- Loading branch information
1 parent
d2b7ddd
commit 1bea6f1
Showing
2 changed files
with
56 additions
and
2 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
1bea6f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tim, I just came across this old commit (and the followup a98b114, both included in #35) while fixing up the menu open code. It flew under my radar until now, but unfortunately, it now interferes with the changes in the menu open code and my own live-coding extension that I've been working on lately.
First, there's lines 436..439 which inject an inlet method into each and every Lua object. Maybe you added this as a convenience, but defining inlet callback methods in the loader, where the user must override them to get rid of them (if he's aware of them at all) is not a good idea, to put it mildly. :) In any case, live reloading can now be done much easier by just sending a
reload
message to the globalpdluax
receiver. This is implemented by the pdx.lua extension which has already been there for a while, but is now enabled by default.Second, the
whereami()
method. I have mixed feelings about this, too. It adds infrastructure that needs to be maintained going forward, and it doesn't work with the built-in objects (pdlua and pdluax) where thefullpath
data is never set. And we already have that kind of data by means ofwhoami()
and_loadpath
. In any case, I've since fixed the bugs in the menu_open code which thewhereami()
method addressed. So I think that the generic menu open code should just work in plugdata now, and the special-case code you inserted at the beginning of pdlua_menu_open in this commit shouldn't be needed anymore.Long story short, I've reverted this commit along with rev. a98b114 now, so that we can test the latest implementation and see whether it works with plugdata now.
Do you disagree? Then please let me know! The reversion is just a single commit (rev. 28a0187), so I can easily roll it back if needed. But I'd rather not have to. ;-)
1bea6f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, getting back to my remarks about
whereami()
above, it would be easy to add this as an object method if you really want it. Something like this should do the trick (well, you'd probably need to add some more checking to get the corner cases right, but you get the idea):1bea6f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
Fine with me: in plugdata the reload feature is used whenever you edit a Lua file from the built-in code editor, so that you don't have to restart for changes to take effect. It's not working perfectly right now anyway, so definitely get rid of it! I didn't know there was an extension for this, I should be using that instead anyway
1bea6f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I was a bit worried that I might inadvertently break some essential functionality in plugdata with this change.
And yes, pdx.lua makes live-coding a lot easier now. I mean, once you set up the reload message in your patch, you don't even have to think about it any more, it's always at your fingertips.
And of course you can initiate a reload from your code editor if you add some shortcuts for pdsend (we already have that for Emacs and VS Code). To get this working from plugdata, all you have to do is to send the reload message to the pdluax receiver instead. Add the class name (basename of the script without the .pd_lua extension) as an argument to the reload message, and it will just update that one object class. Otherwise it will reload all classes. Easy as pie.
I'm still ironing out some remaining kinks with the new prereload and postreload methods, which btw were suggested by @ben-wes, go Ben! 👍 But this shouldn't take long. Expect a new release in the next 1-2 days. :)
1bea6f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, I implemented the multi-layer drawing concept for pdlua in plugdata, which works! Though plugdata will be the easiest platform to do this on. For pd (and probably purr-data), we'll need to create a group tag for each layer, send ordering messages to make sure the groups are correctly stacked. I will take a look at that very soon too!
1bea6f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also getting there with Pd now! Not spectacular demo, but the green bit is on a separate layer
1bea6f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As promised: https://github.com/agraef/pd-lua/releases/tag/0.12.11. Let me know how it works in plugdata. I thoroughly tested it in vanilla and purr-data, on Linux/Mac/Windows, and it seems that I finally squashed all the nasty bugs at least. :)
That's awesome! If you can do it in vanilla/tk, I can do it in purr-data/nw.js whose svg support is vastly more powerful. Just send me a PR when it's finished and I'll port it over, no problem.
1bea6f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timothyschoen Just a quick heads-up that I fixed quite a few more bugs in the meantime, so 0.12.15 is the latest and greatest now.