Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
90343c5
add optional alignment arg to draw_text
ben-wes Oct 22, 2024
ce1e5dc
simplified arg check with luaL_optinteger
ben-wes Oct 22, 2024
e434b68
make some more args optional
ben-wes Oct 25, 2024
84e2362
immediate mouse_up() call for Pd vanilla
ben-wes Jan 16, 2025
f221089
add mouse_enter() and mouse_exit() for Pd vanilla
ben-wes Jan 16, 2025
cefb1e7
hide proxycanvas code for PLUGDATA
ben-wes Jan 18, 2025
cf0cc0e
Implement svg rendering for pd-vanilla and plugdata
timothyschoen Mar 5, 2025
fa1de4e
Make macros consistent, get rid of deprecated sys_vgui, fix a bunch o…
timothyschoen Mar 6, 2025
c76c7db
Add svg rendering demo to helpfile
timothyschoen Mar 6, 2025
4d49c3e
Fix bug when deleting a duplicate svg image
timothyschoen Mar 7, 2025
4d449d3
Update example
timothyschoen Mar 8, 2025
8502dee
Clean up hashing
timothyschoen Mar 8, 2025
f363065
Fix blunder
timothyschoen Mar 8, 2025
96d3cee
Fix warnings, fix potential freeze when rendering very large svg image
timothyschoen Mar 11, 2025
515875b
add function `_properties_add`, `_properties_newframe`, `_properties_…
charlesneimog Apr 2, 2025
532b699
add methods for pd
charlesneimog Apr 2, 2025
7cdbd9f
add method for create `frame`, `checkbox`, `textinput`, `colorpicker`
charlesneimog Apr 2, 2025
d9ca11c
add simple example
charlesneimog Apr 2, 2025
f19c63e
fix colorpick args, following default for args in pdlua
charlesneimog Apr 2, 2025
8badd68
replace sys_trytoopenone() with public open_via_path()
ben-wes Jun 20, 2025
a1828ce
Compress documentation pdf file for plugdata shipping
timothyschoen Jul 25, 2025
c6be2ad
build on windows-latest
ben-wes Jul 27, 2025
bc5a711
use clock_getlogicaltime to avoid deprecation warning
ben-wes Aug 2, 2025
567d618
Fix (and simplify) installation tutorials & examples
umlaeute Aug 18, 2025
998baa0
Fix multi-instance crash when pure-data instances clean up symbols
timothyschoen Aug 29, 2025
a71223f
Fix potential startup crash
timothyschoen Sep 4, 2025
473bce9
Fix another multi-instance fix
timothyschoen Sep 8, 2025
2bd1efb
Multi-instance pd fix
timothyschoen Sep 12, 2025
fa4803e
Fix missing return.
KottV Sep 15, 2025
dc74542
Helpfile fix, fix potential threading issue in plugin
timothyschoen Feb 10, 2026
4fbe18f
Fix broken multi-out in plugin
timothyschoen Feb 22, 2026
dcb89c1
Fix pd 0.56 compat
timothyschoen Feb 15, 2026
ee6760c
Merge pull request #7 from KottV/render_svg
timothyschoen Feb 22, 2026
3fa7889
Fix for plugdata API change
timothyschoen Mar 11, 2026
4b1d109
Merge remote-tracking branch 'umlaeute/fix/install' into render_svg
timothyschoen Mar 16, 2026
d4ef78b
Properly document path:close function
timothyschoen Mar 16, 2026
020bab6
Merge remote-tracking branch 'ben-wes/fix/windowsbuild' into render_svg
timothyschoen Mar 16, 2026
0e5ac6f
Merge remote-tracking branch 'ben-wes/fix-deprecation' into render_svg
timothyschoen Mar 16, 2026
9646303
Merge remote-tracking branch 'ben-wes/fix/open-via-path' into render_svg
timothyschoen Mar 16, 2026
8f2d122
Merge remote-tracking branch 'ben-wes/feature/someoptionalargs' into …
timothyschoen Mar 16, 2026
984bd00
Merge remote-tracking branch 'ben-wes/feature/mouse-interaction' into…
timothyschoen Mar 16, 2026
37f0466
Fix init and text align for plugdata
timothyschoen Mar 16, 2026
f9979f1
Store properties in separate struct
timothyschoen Mar 16, 2026
e9a38a9
Store properties in separate struct
timothyschoen Mar 16, 2026
70d4aba
Move properties to own file, clean up implementation, implement prope…
timothyschoen Mar 16, 2026
dc4fea0
Merge branch 'pdlua-combined-prs' of https://github.com/timothyschoen…
timothyschoen Mar 16, 2026
961d8ec
Github actions: update Pd version
timothyschoen Mar 16, 2026
1b2f145
Make sure properties function can only be called from properties call…
timothyschoen Mar 16, 2026
76a3fe0
Add number and combo properties, clean up properties system
timothyschoen Mar 16, 2026
50472be
Fix duplicate message, update textbox on return/focusout, remove button
timothyschoen Mar 16, 2026
61ab9e7
Add error checking, replace add_number with add_int/add_float for cla…
timothyschoen Mar 16, 2026
f1c7c3d
Fix properties dialog title
timothyschoen Mar 16, 2026
d9e7763
Fix int/float property default args for plugdata
timothyschoen Mar 16, 2026
2d6c3d0
Only assign propertiesfn if a properties callback exists
timothyschoen Mar 16, 2026
1e464f6
Add image rendering support
timothyschoen Mar 17, 2026
d29504e
Add image rendering example
timothyschoen Mar 17, 2026
3dc1fb8
Simplify textbox call, improve documentation of properties, svg and i…
timothyschoen Mar 17, 2026
0477d10
Document draw_text options, document optional arguments
timothyschoen Mar 17, 2026
f6854c7
Add number property min/max defaults to documentation, leave space fo…
timothyschoen Mar 17, 2026
30fa67b
Improve properties: colour show visual feedback, limit combo width, s…
timothyschoen Mar 17, 2026
616107d
Fix deprecation warnings
timothyschoen Mar 17, 2026
e784b52
Colour property fixes
timothyschoen Mar 17, 2026
87bb82d
Fix int/float properties for plugdata
timothyschoen Mar 17, 2026
b14de04
Clean up: remove unncessary indirection, better way to get title, sta…
timothyschoen Mar 17, 2026
65d4e15
Simplify plugdata argument forwarding, simplify lua type checking, fi…
timothyschoen Mar 17, 2026
5d0906a
Fix compilation
timothyschoen Mar 17, 2026
80a4612
Wait for OK/Apply button to send properties to lua
timothyschoen Mar 17, 2026
936c3de
Follow pd's UX guidelines for properties panels more closely: differe…
timothyschoen Mar 17, 2026
519e55b
Fix properties layout on Windows, fix compilation
timothyschoen Mar 17, 2026
5a9fb5f
Fix missing property_count increment
timothyschoen Mar 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fetch-depth: 0

- name: install dependencies
run: git clone --branch=0.55-0 --depth=1 https://github.com/pure-data/pure-data.git
run: git clone --branch=0.56-2 --depth=1 https://github.com/pure-data/pure-data.git

- name: make
run: make install PDDIR=./pure-data objectsdir=./build floatsize=${{ matrix.floatsize }} extension=linux-amd64-${{ matrix.floatsize }}.so
Expand All @@ -46,11 +46,11 @@ jobs:

- name: install dependencies
run: |
wget https://github.com/pure-data/pure-data/archive/refs/tags/0.55-0.zip
unzip 0.55-0.zip
wget https://github.com/pure-data/pure-data/archive/refs/tags/0.56-2.zip
unzip 0.56-2.zip

- name: make
run: make install objectsdir=./build PDDIR=./pure-data-0.55-0 arch="arm64 x86_64" floatsize=${{ matrix.floatsize }} extension=darwin-fat-${{ matrix.floatsize }}.so
run: make install objectsdir=./build PDDIR=./pure-data-0.56-2 arch="arm64 x86_64" floatsize=${{ matrix.floatsize }} extension=darwin-fat-${{ matrix.floatsize }}.so

- name: upload
uses: actions/upload-artifact@v4
Expand All @@ -59,7 +59,7 @@ jobs:
path: build

windows-build:
runs-on: windows-2019
runs-on: windows-latest
strategy:
matrix:
floatsize: [32, 64]
Expand All @@ -75,18 +75,18 @@ jobs:
- name: install dependencies for 32-bit
if: matrix.floatsize == 32
run: |
C:\msys64\usr\bin\wget.exe http://msp.ucsd.edu/Software/pd-0.55-0.msw.zip
unzip pd-0.55-0.msw.zip
C:\msys64\usr\bin\wget.exe http://msp.ucsd.edu/Software/pd-0.56-2.msw.zip
unzip pd-0.56-2.msw.zip

- name: install dependencies for 64-bit
if: matrix.floatsize == 64
run: | # unfortunately, the folder name convention is slightly different here
C:\msys64\usr\bin\wget.exe https://puredata.info/downloads/pure-data/releases/0.55-0-pd64/Pd64-0.55-0.msw.zip
unzip Pd64-0.55-0.msw.zip
ren Pd-0.55.0 pd-0.55-0
C:\msys64\usr\bin\wget.exe https://puredata.info/downloads/pure-data/releases/0.56-2-pd64/Pd64-0.56-2.msw.zip
unzip Pd64-0.56-2.msw.zip
ren Pd-0.56.2 pd-0.56-2

- name: make 32-bit
run: make install objectsdir=./build PDDIR=./pd-0.55-0 PDINCLUDEDIR=./pd-0.55-0/src PDBINDIR=./pd-0.55-0/bin floatsize=${{ matrix.floatsize }} extension=windows-amd64-${{ matrix.floatsize }}.dll
run: make install objectsdir=./build PDDIR=./pd-0.56-2 PDINCLUDEDIR=./pd-0.56-2/src PDBINDIR=./pd-0.56-2/bin floatsize=${{ matrix.floatsize }} extension=windows-amd64-${{ matrix.floatsize }}.dll

- name: upload
uses: actions/upload-artifact@v4
Expand Down
20 changes: 9 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,15 @@ endif
pdlua.class.sources := pdlua.c $(luasrc)
pdlua.class.ldlibs := $(lualibs)

datafiles = pd.lua $(wildcard pdlua*-help.pd)
datafiles = \
pd.lua $(wildcard pdlua*-help.pd) \
$(addprefix pdlua/tutorial/examples/, pdx.lua pd-remote.el pd-remote.pd) \
pdlua-meta.pd

PDLIBBUILDER_DIR=.
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder

install: installplus
# the 'pdlua' directory contains subdirectories (with subdirs),
# so we need to list all of them
datadirs = $(shell find pdlua -type d)

pdx_files = $(addprefix ./pdlua/tutorial/examples/, pdx.lua pd-remote.el pd-remote.pd)

installplus:
$(INSTALL_DIR) -v "$(installpath)"
cp -r ./pdlua/ "${installpath}"/pdlua
cp pdlua-meta.pd "${installpath}"
cp $(pdx_files) "${installpath}"
PDLIBBUILDER_DIR=.
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
8 changes: 8 additions & 0 deletions onelua_multi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <pthread.h>

pthread_mutex_t lua_global_lock = PTHREAD_MUTEX_INITIALIZER;

#define lua_lock(L) pthread_mutex_lock(&lua_global_lock)
#define lua_unlock(L) pthread_mutex_unlock(&lua_global_lock)

#include "lua/onelua.c"
42 changes: 42 additions & 0 deletions pd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,28 @@ pd._perform_dsp = function (object, ...)
end
end

-- draw properties
pd._properties = function (object, p)
local obj = pd._objects[object]
if nil ~= obj and type(obj.properties) == "function" then
obj:properties(p)
return true
else
return false
end
end

-- set properties
pd._set_properties = function (object, method, args)
local obj = pd._objects[object]
if obj ~= nil and type(obj[method]) == "function" then
local propertiesmethod = obj[method]
propertiesmethod(obj, args) -- Passa `obj` explicitamente como `self`
else
pd._error(obj._object, "method ".. method .. " does not exist")
end
end

-- repaint method dispatcher
pd._repaint = function (object)
local obj = pd._objects[object]
Expand All @@ -115,6 +137,12 @@ pd._mouseevent = function (object, x, y, event_type)
if event_type == 3 and type(obj.mouse_drag) == "function" then
obj:mouse_drag(x, y)
end
if event_type == 4 and type(obj.mouse_enter) == "function" then
obj:mouse_enter(x, y)
end
if event_type == 5 and type(obj.mouse_exit) == "function" then
obj:mouse_exit(x, y)
end
end
end

Expand Down Expand Up @@ -363,6 +391,9 @@ function pd.Class:construct(sel, atoms)
if type(self.paint) == "function" then
pd._creategui(self._object)
end
if(type(self.properties) == "function") then
pd._set_propertiesfn(self._object)
end
self:postinitialize()
return self
else
Expand Down Expand Up @@ -628,6 +659,17 @@ DATA = 0
SIGNAL = 1
Colors = {background = 0, foreground = 1, outline = 2}

-- Text alignment constants
TOP_LEFT = 0
TOP_CENTER = 1
TOP_RIGHT = 2
CENTER_LEFT = 3
CENTER = 4
CENTER_RIGHT = 5
BOTTOM_LEFT = 6
BOTTOM_CENTER = 7
BOTTOM_RIGHT = 8

-- pre-load pdx.lua (advanced live coding support); if you don't want this,
-- just comment out the line below
pdx = require 'pdx'
Expand Down
8 changes: 4 additions & 4 deletions pdlua-help.pd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#N canvas 466 36 561 610 10;
#N canvas 466 44 561 610 10;
#X declare -lib pdlua -path pdlua;
#X declare -path pdlua/examples;
#X text 16 358 See also:;
Expand Down Expand Up @@ -171,7 +171,7 @@
#X connect 117 0 112 0;
#X connect 118 0 110 0;
#X restore 446 359 pd quickstart;
#N canvas 264 71 851 700 graphics 0;
#N canvas 264 71 1254 926 graphics 1;
#X obj 8 77 hello-gui;
#X text 8 376 function yourclass:initialize(sel \, atoms);
#X text 24 409 return true;
Expand All @@ -193,8 +193,8 @@
#X text 8 323 Graphics mode is enabled automatically by defining the paint method \, see below. You can also set the size in the constructor (or in any other function) \, like this:;
#X text 23 394 self:set_size(100 \, 100);
#X text 814 1537  ;
#X text 8 816 -- Callback functions you can define \; pd:Class:mouse_down(x \, y) \; pd:Class:mouse_up(x \, y) \; pd:Class:mouse_move(x \, y) \; pd:Class:mouse_drag(x \, y) \; \; \; -- Functions you can call \; pd:Class:repaint(layer) \; \; \; pd:Class:paint(g) / pd:Class:paint_layer_n(g) \; \; \; g:set_size(w \, h) \; width \, height = g:get_size(w \, h) \; \; g:set_color(r \, g \, b \, a=1.0) \; \; g:fill_ellipse(x \, y \, w \, h) \; g:stroke_ellipse(x \, y \, w \, h \, line_width) \; \; g:fill_rect(x \, y \, w \, h) \; g:stroke_rect(x \, y \, w \, h \, line_width) \; \; g:fill_rounded_rect(x \, y \, w \, h \, corner_radius) \; g:stroke_rounded_rect(x \, y \, w \, h \, corner_radius \, line_width) \; \; g:draw_line(x1 \, y1 \, x2 \, y2) \; g:draw_text(text \, x \, y \, w \, fontsize) \; \; g:fill_all() \; \; g:translate(tx \, ty) \; g:scale(sx \, sy) \; \; g:reset_transform() \; \; p = Path(x \, y) \; p:line_to(x \, y) \; p:quad_to(x1 \, y1 \, x2 \, y2) \; p:cubic_to(x1 \, y1 \, x2 \, y2 \, x3 \, y) \; p:close_path() \; \; g:stroke_path(p \, line_width) \; g:fill_path(p) \; \; \; -- Audio callbacks \; pd:Class:dsp(samplerate \, blocksize \, channel_counts) \; pd:Class:perform(in1 \, in2 \, ... \, in_n) \; \; pd:Class:signal_setmultiout(outlet \, channel_count) \; \; \; -- Additional functions \; expandedsymbol = pd:Class:canvas_realizedollar(s) \; pd:Class:set_args(args) \; args = pd:Class:get_args() \;, f 53;
#X text 326 816 \; -- Mouse down callback \, called when the mouse is clicked \; -- Mouse up callback \, called when the mouse button is released \; -- Mouse move callback \, called when the mouse is moved while not being down \; -- Mouse drag callback \, called when the mouse is moved while also being down \; \; \; \; -- Request a repaint for specified layer (or all layers if no parameter is set or if layer is 0). after this \, the "paint" or "paint_layer_n" callback will occur \; \; -- Paint callback \, passes a graphics context object (commonly called g) for main layer or layer n (n > 1) that you can call these drawing functions on: \; \; -- Sets the size of the object \; -- Gets the size of the object \; \; -- Sets the color for the next drawing operation \; \; -- Draws a filled ellipse at the specified position and size \; -- Draws the outline of an ellipse at the specified position and size \; \; -- Draws a filled rectangle at the specified position and size \; -- Draws the outline of a rectangle at the specified position and size \; \; -- Draws a filled rounded rectangle at the specified position and size \; -- Draws the outline of a rounded rectangle at the specified position and size \; \; \; -- Draws a line between two points \; -- Draws text at the specified position and size \; \; -- Fills the entire drawing area with the current color. Also will draw an object outline in the style of the host (ie. pure-data or plugdata) \; -- Translates the coordinate system by the specified amounts \; -- Scales the coordinate system by the specified factors. This will always happen after the translation \; -- Resets current scale and translation \; \; -- Initiates a new path at the specified point \; -- Adds a line segment to the path \; -- Adds a quadratic Bezier curve to the path \; -- Adds a cubic Bezier curve to the path \; -- Closes the path \; \; -- Draws the outline of the path with the specified line width \; -- Fills the current path \; \; \; \; -- Called when DSP is activated and whenever the DSP graph is updated \; -- Called for every audio block \, passing tables of samples per inlet and expecting tables of samples per outlet \; -- Used in dsp function to achieve multichannel output for specific outlets \; \; \; \; -- Expand dollar symbols in patch canvas context \; -- Set the object arguments to be saved in the patch file \; -- Get the object arguments \;, f 82;
#X text 416 804 \; -- Mouse down callback \, called when the mouse is clicked \; -- Mouse up callback \, called when the mouse button is released \; -- Mouse move callback \, called when the mouse is moved while not being down \; -- Mouse drag callback \, called when the mouse is moved while also being down \; \; \; \; -- Request a repaint for specified layer (or all layers if no parameter is set or if layer is 0). after this \, the "paint" or "paint_layer_n" callback will occur \; \; -- Paint callback \, passes a graphics context object (commonly called g) for main layer or layer n (n > 1) that you can call these drawing functions on: \; \; -- Sets the size of the object \; -- Gets the size of the object \; \; -- Sets the color for the next drawing operation \; \; -- Draws a filled ellipse at the specified position and size \; -- Draws the outline of an ellipse at the specified position and size \; \; -- Draws a filled rectangle at the specified position and size \; -- Draws the outline of a rectangle at the specified position and size \; \; -- Draws a filled rounded rectangle at the specified position and size \; -- Draws the outline of a rounded rectangle at the specified position and size \; \; \; -- Draws a line between two points \; -- Draws text at the specified position and size. fontsize defaults to pd's default font size. Alignment must be one of: TOP_LEFT/TOP_CENTER/TOP_RIGHT/CENTER_LEFT/CENTER/CENTER_RIGHT/BOTTOM_LEFT/BOTTOM_CENTER/BOTTOM_RIGHT \; -- Fills the entire drawing area with the current color. Also will draw an object outline in the style of the host (ie. pure-data or plugdata) \; -- Translates the coordinate system by the specified amounts \; -- Scales the coordinate system by the specified factors. This will always happen after the translation \; -- Resets current scale and translation \; \; -- Initiates a new path at the specified point \; -- Adds a line segment to the path \; -- Adds a quadratic Bezier curve to the path \; -- Adds a cubic Bezier curve to the path \; -- Closes the path \; \; -- Draws the outline of the path with the specified line width \; -- Fills the current path \; \; -- Draws an svg vector image from a svg text \; -- Draws an image found inside search paths (supports JPEG \, PNG \, BMP \, GIF \, PSD \, HDR \, PIC) \; \; \; -- Called when DSP is activated and whenever the DSP graph is updated \; -- Called for every audio block \, passing tables of samples per inlet and expecting tables of samples per outlet \; \; -- Used in dsp function to achieve multichannel output for specific outlets \; \; \; \; -- Expand dollar symbols in patch canvas context \; -- Set the object arguments to be saved in the patch file \; -- Get the object arguments \;, f 113;
#X text 8 816 -- Callback functions you can define \; pd:Class:mouse_down(x \, y) \; pd:Class:mouse_up(x \, y) \; pd:Class:mouse_move(x \, y) \; pd:Class:mouse_drag(x \, y) \; \; \; -- Functions you can call \; pd:Class:repaint(layer) \; \; \; pd:Class:paint(g) / pd:Class:paint_layer_n(g) \; \; \; g:set_size(w \, h) \; width \, height = g:get_size(w \, h) \; \; g:set_color(r \, g \, b \, a=1.0) \; \; g:fill_ellipse(x \, y \, w \, h) \; g:stroke_ellipse(x \, y \, w \, h \, line_width=1) \; \; g:fill_rect(x \, y \, w \, h) \; g:stroke_rect(x \, y \, w \, h \, line_width=1) \; \; g:fill_rounded_rect(x \, y \, w \, h \, corner_radius) \; g:stroke_rounded_rect(x \, y \, w \, h \, corner_radius \, line_width=1) \; \; g:draw_line(x1 \, y1 \, x2 \, y2\\\, line_width=1) \; g:draw_text(text \, x \, y \, w \, fontsize=default \, alignment=TOP_LEFT) \; \; g:fill_all() \; \; g:translate(tx \, ty) \; g:scale(sx \, sy) \; g:reset_transform() \; \; p = Path(x \, y) \; p:line_to(x \, y) \; p:quad_to(x1 \, y1 \, x2 \, y2) \; p:cubic_to(x1 \, y1 \, x2 \, y2 \, x3 \, y) \; p:close() \; \; g:stroke_path(p \, line_width=1) \; g:fill_path(p) \; \; g:draw_svg(svg_text \, x \, y) \; g:draw_image(image_path \, x \, y) \; \; -- Audio callbacks \; pd:Class:dsp(samplerate \, blocksize \, channel_counts) \; pd:Class:perform(in1 \, in2 \, ... \, in_n) \; \; pd:Class:signal_setmultiout(outlet \, channel_count) \; \; \; -- Additional functions \; expandedsymbol = pd:Class:canvas_realizedollar(s) \; pd:Class:set_args(args) \; args = pd:Class:get_args() \;, f 66;
#X restore 446 409 pd graphics;
#X text 324 384 Details on how to create GUI objects ------->, f 18;
#X obj 342 247 hello;
Expand Down
Loading
Loading