Commit 233aedb5 authored by Albert Gräf's avatar Albert Gräf
Browse files

Add a description of Guillem's new subpatch and abstraction features (GSoC 2020).

parent dae79605
......@@ -118,17 +118,25 @@ Permanent link: <a href="https://agraef.github.io/purr-data-intro/" class="uri">
<p><strong>Caveat:</strong> Again, be warned that changing these options and then installing external collections with gazillions of patches into either the extra/ hierarchy or on your personal help path may have a very negative impact on first launch times, since all these patches will have to be scanned during index creation.</p>
<h2 id="pd-l2ork-and-purr-data-goodies">Pd-l2ork and Purr Data Goodies</h2>
<p>Compared to vanilla Pd, Pd-l2ork and Purr Data provide a comprehensive set of new and improved features, way too many to even just mention them all, so we refer the interested reader to the <a href="http://ico.bukvic.net/PDF/PdCon16_paper_84.pdf">PdCon 2016 paper</a> for details. The paper also covers the history and motivation of the Pd-l2ork project.</p>
<p>One of Pd-l2ork’s major advancements over vanilla Pd is its <em>infinite undo</em> capability, which makes it easy to revert accidental changes without having to worry about taking snapshots of patches while they’re under development. Many of the other new features are simply GUI and usability improvements which, if done right, quickly become second nature to the user, so that they aren’t even consciously noticed any more, such as the graphical improvements and the ability to resize the IEM GUI elements and “graph on parent” areas using the mouse. A helpful change also worth mentioning here is the improved <em>tidy up</em> option in the Edit menu, which first aligns objects and then spaces them equidistantly.</p>
<p>Another big time-saver is Pd-l2ork’s <em>intelligent patching</em> facility, which lets you select two or more objects in order to connect multiple outlets and inlets in one go. Intelligent patching offers a number of different modes:</p>
<p>One of Pd-l2ork’s major advancements, which has only recently been ported to vanilla Pd, is its <em>infinite undo</em> capability, which makes it easy to revert accidental changes without having to worry about taking snapshots of patches while they’re under development. A helpful change also worth mentioning here is the improved <em>tidy up</em> option in the Edit menu, which first aligns objects and then spaces them equidistantly. Many of the other new features are simply GUI and usability improvements which quickly become second nature to the user, such as the graphical improvements, the ability to resize the IEM GUI elements and “graph on parent” areas using the mouse, and the extended key bindings for number and number2 objects.</p>
<p>Other features will be more useful for advanced users, like the reflection capabilities (see the <code>pdinfo</code>, <code>canvasinfo</code>, <code>classinfo</code> and <code>objectinfo</code> help patches) and the new SVG elements for data structure visualizations. The latter have been considerably enhanced in Purr Data, see the “Pd-L2Ork Data Structures” section in the help browser. They also make it possible to create your own custom GUI elements in plain Pd, without having to learn a “real” programming language.</p>
<h3 id="intelligent-patching">Intelligent Patching</h3>
<p>Another big time-saver is Pd-l2ork’s <em>intelligent patching</em> facility, which lets you select two or more objects in order to connect multiple outlets and inlets in one go. A similar feature was recently added to vanilla Pd, but Pd-l2ork has had this for a long time. In Pd-l2ork and Purr Data, intelligent patching offers a number of different modes:</p>
<ul>
<li><p>If you select <em>exactly</em> two objects A and B, say, and then connect one of the outlets from A to one of the inlets of B, then starting from the initial outlet-inlet pair the remaining outlets of A will be connected to the corresponding inlets of B.</p></li>
<li><p>If you select two (or more) objects B and C, say, and then connect an outlet of a third, <em>unselected</em> object A to an inlet of B, then the corresponding connection from A to C will be done automatically. Conversely, you can also connect an outlet of B to an inlet of A to have the corresponding C-A connection completed for you.</p></li>
<li><p>If you select <em>three</em> (or more) objects A, B and C, say, where A has two outlets or more, and then connect an outlet of A to an inlet of B, then the <em>next</em> outlet of A will be connected to the corresponding inlet of C. Conversely, you can also connect an outlet of B to an inlet of A, and have the corresponding outlet of C connected to the next inlet of A. This works for an arbitrary number of source or target objects, considering the “other” objects in left-to-right, top-to-bottom order.<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p></li>
<li><p>Finally, pressing the shift key while doing connections will let you do multiple connections from the same outlet in one go.</p></li>
</ul>
<p>It is worth practicing these so that you can amaze your vanilla-running friends with the speed at which you can construct rather complicated patches using these shortcuts. As of version 2.1, Purr Data has a help patch for this incredibly useful facility, which I have also provided with this document in the <a href="intelligent-patching.pd">intelligent-patching.pd</a> patch for your amusement. In the comments, the patch also includes detailed explanations of all the different intelligent patching modes for your perusal, and you can find some subpatches with exercises in the margin of the main patch.</p>
<p>Other features will be more useful for advanced users, like the reflection capabilities (see the <code>pdinfo</code>, <code>canvasinfo</code>, <code>classinfo</code> and <code>objectinfo</code> help patches) and the new SVG elements for data structure visualizations. The latter have been considerably enhanced in Purr Data, see the “Pd-L2Ork Data Structures” section in the help browser. They also make it possible to create your own custom GUI elements in plain Pd, without having to learn a “real” programming language.</p>
<p>TODO: Add a description of Guillem’s subpatch creation, abstraction saving and private abstraction features.</p>
<p>Purr Data has a help patch for this incredibly useful facility, which I have also provided with this document in the <a href="intelligent-patching.pd">intelligent-patching.pd</a> patch for your perusal. In the comments, the patch also includes detailed explanations of all the different intelligent patching modes, and you can find some subpatches with exercises in the margin of the main patch.</p>
<h3 id="subpatch-and-abstraction-features">Subpatch and Abstraction Features</h3>
<p>A recent addition are the extended subpatch and abstraction creation and saving facilities, which were contributed by Guillem Bartrina during the Google Summer of Code 2020:</p>
<ul>
<li><p>A new “Encapsulate” option in the Edit menu lets you turn a collection of selected objects into a corresponding one-off subpatch in a fully automatic way. This finally makes creating one-offs from parts of your patches a very quick and easy operation.</p></li>
<li><p>You can also turn an existing one-off subpatch into an abstraction simply by right-clicking on the object and choosing the new “Save as” option from the context menu. This will also give you the option to replace the existing subpatch, as well as all its other instances with the newly created abstraction.</p></li>
<li><p>There’s a new [ab] object, to be invoked as [ab name args …], which lets you create <em>private abstractions</em>. These are embedded in their parent patch just like a one-off subpatch [pd name], but otherwise behave like real abstractions in that they have their own <code>$0</code> and can have arguments, too. So they work just like the plain old abstractions, but become a part of your main patch, pretty much like the subroutines of a C program. This makes shipping a patch much more convenient, as you don’t have to send a bunch of abstraction files along with it any more.</p></li>
<li><p>The [ab] object is accompanied by a number of supplemental objects (abinfo, abdefs, abclone) which let you inspect and clone private abstractions, as well as an “Abstractions” dialog which can be accessed via the Window menu.</p></li>
</ul>
<h2 id="purr-data-and-pd-lua">Purr Data and Pd-Lua</h2>
<p>As of version 2.5, Purr Data includes the latest version of Claude Heiland-Allen’s excellent <a href="https://agraef.github.io/pd-lua/">Pd-Lua</a> extension for embedding the <a href="http://www.lua.org/">Lua</a> scripting language in Pd. This provides you with an easy means (much easier than Pd’s native C interface) to write your own custom Pd objects if they require the use of a real programming language offering loops, functions and complicated data structures.</p>
<p>Lua is perfectly suited for this purpose, because it is light-weight and easily embeddable by design. It is also small and easy to learn, yet very capable, offering a complete range of imperative, object-oriented and functional programming language elements. Like Pd, Lua is an interpreted language featuring dynamic typing, which makes interfacing between Pd and Lua quite easy.</p>
......
......@@ -162,9 +162,13 @@ Once the browser has been launched for the first time and the index has been bui
Compared to vanilla Pd, Pd-l2ork and Purr Data provide a comprehensive set of new and improved features, way too many to even just mention them all, so we refer the interested reader to the [PdCon 2016 paper](http://ico.bukvic.net/PDF/PdCon16_paper_84.pdf) for details. The paper also covers the history and motivation of the Pd-l2ork project.
One of Pd-l2ork's major advancements over vanilla Pd is its *infinite undo* capability, which makes it easy to revert accidental changes without having to worry about taking snapshots of patches while they're under development. Many of the other new features are simply GUI and usability improvements which, if done right, quickly become second nature to the user, so that they aren't even consciously noticed any more, such as the graphical improvements and the ability to resize the IEM GUI elements and "graph on parent" areas using the mouse. A helpful change also worth mentioning here is the improved *tidy up* option in the Edit menu, which first aligns objects and then spaces them equidistantly.
One of Pd-l2ork's major advancements, which has only recently been ported to vanilla Pd, is its *infinite undo* capability, which makes it easy to revert accidental changes without having to worry about taking snapshots of patches while they're under development. A helpful change also worth mentioning here is the improved *tidy up* option in the Edit menu, which first aligns objects and then spaces them equidistantly. Many of the other new features are simply GUI and usability improvements which quickly become second nature to the user, such as the graphical improvements, the ability to resize the IEM GUI elements and "graph on parent" areas using the mouse, and the extended key bindings for number and number2 objects.
Another big time-saver is Pd-l2ork's *intelligent patching* facility, which lets you select two or more objects in order to connect multiple outlets and inlets in one go. Intelligent patching offers a number of different modes:
Other features will be more useful for advanced users, like the reflection capabilities (see the `pdinfo`, `canvasinfo`, `classinfo` and `objectinfo` help patches) and the new SVG elements for data structure visualizations. The latter have been considerably enhanced in Purr Data, see the "Pd-L2Ork Data Structures" section in the help browser. They also make it possible to create your own custom GUI elements in plain Pd, without having to learn a "real" programming language.
### Intelligent Patching
Another big time-saver is Pd-l2ork's *intelligent patching* facility, which lets you select two or more objects in order to connect multiple outlets and inlets in one go. A similar feature was recently added to vanilla Pd, but Pd-l2ork has had this for a long time. In Pd-l2ork and Purr Data, intelligent patching offers a number of different modes:
- If you select *exactly* two objects A and B, say, and then connect one of the outlets from A to one of the inlets of B, then starting from the initial outlet-inlet pair the remaining outlets of A will be connected to the corresponding inlets of B.
......@@ -174,11 +178,19 @@ Another big time-saver is Pd-l2ork's *intelligent patching* facility, which lets
- Finally, pressing the shift key while doing connections will let you do multiple connections from the same outlet in one go.
It is worth practicing these so that you can amaze your vanilla-running friends with the speed at which you can construct rather complicated patches using these shortcuts. As of version 2.1, Purr Data has a help patch for this incredibly useful facility, which I have also provided with this document in the [intelligent-patching.pd](intelligent-patching.pd) patch for your amusement. In the comments, the patch also includes detailed explanations of all the different intelligent patching modes for your perusal, and you can find some subpatches with exercises in the margin of the main patch.
Purr Data has a help patch for this incredibly useful facility, which I have also provided with this document in the [intelligent-patching.pd](intelligent-patching.pd) patch for your perusal. In the comments, the patch also includes detailed explanations of all the different intelligent patching modes, and you can find some subpatches with exercises in the margin of the main patch.
Other features will be more useful for advanced users, like the reflection capabilities (see the `pdinfo`, `canvasinfo`, `classinfo` and `objectinfo` help patches) and the new SVG elements for data structure visualizations. The latter have been considerably enhanced in Purr Data, see the "Pd-L2Ork Data Structures" section in the help browser. They also make it possible to create your own custom GUI elements in plain Pd, without having to learn a "real" programming language.
### Subpatch and Abstraction Features
A recent addition are the extended subpatch and abstraction creation and saving facilities, which were contributed by Guillem Bartrina during the Google Summer of Code 2020:
- A new "Encapsulate" option in the Edit menu lets you turn a collection of selected objects into a corresponding one-off subpatch in a fully automatic way. This finally makes creating one-offs from parts of your patches a very quick and easy operation.
- You can also turn an existing one-off subpatch into an abstraction simply by right-clicking on the object and choosing the new "Save as" option from the context menu. This will also give you the option to replace the existing subpatch, as well as all its other instances with the newly created abstraction.
- There's a new [ab] object, to be invoked as [ab name args ...], which lets you create *private abstractions*. These are embedded in their parent patch just like a one-off subpatch [pd name], but otherwise behave like real abstractions in that they have their own `$0` and can have arguments, too. So they work just like the plain old abstractions, but become a part of your main patch, pretty much like the subroutines of a C program. This makes shipping a patch much more convenient, as you don't have to send a bunch of abstraction files along with it any more.
TODO: Add a description of Guillem's subpatch creation, abstraction saving and private abstraction features.
- The [ab] object is accompanied by a number of supplemental objects (abinfo, abdefs, abclone) which let you inspect and clone private abstractions, as well as an "Abstractions" dialog which can be accessed via the Window menu.
## Purr Data and Pd-Lua
......
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment