#N struct template1 float x float y float z float q; #N canvas 363 11 579 461 12; #N canvas 13 22 297 180 data 1; #X scalar template1 50 100 30 9 \;; #X scalar template1 150 100 -20 900 \;; #X restore 60 347 pd data; #N canvas 10 274 550 324 template1 1; #X obj 60 46 filledpolygon 244 q 5 0 0 20 z 40 0; #X text 4 164 The filledpolygon's arguments are interior color \, border color \, border width \, and then the points of the polygon. Arguments which are symbols ("q" and "z" in this case) mean to take the values from the data structure. Other values are constant. The position of the object is automatically controlled by fields named "x" and "y". ; #X obj 60 21 struct template1 float x float y float z float q; #X text 3 67 This subpatch acts as a template which describes the data structure. The "struct" specifies four floating point values named x \, y \, z \, and q. The "filledpolygon" is a drawing instruction. Templates should have only one template object but may have any number of drawing instructions.; #X restore 60 371 pd template1; #N canvas 0 0 440 292 stuff 0; #X obj 235 185 pointer; #X obj 28 187 append template1 x y z q; #X msg 235 127 \; pd-data clear; #X msg 235 163 traverse pd-data \, bang; #X obj 125 128 t b b b; #X msg 125 87 bang; #X obj 125 56 loadbang; #X text 159 87 click here to re-initialize; #X text 25 243 This subpatch sets up the "data" window with two objects. How this works will get explained later.; #X msg 28 164 50 100 30 9 \, 150 100 -20 900; #X connect 0 0 1 4; #X connect 3 0 0 0; #X connect 4 0 9 0; #X connect 4 1 3 0; #X connect 4 2 2 0; #X connect 5 0 4 0; #X connect 6 0 5 0; #X connect 9 0 1 0; #X restore 59 397 pd stuff; #X text 37 72 The positions \, border color \, and altitude of each triangle are numeric values which can control \, or be controlled by \, other elements of the patch.; #X text 37 124 When the data window is locked (not in edit mode) you can drag the apex of either triangle up or down to change the altitude (you should see the cursor change with dragging is meaningful.) In edit (unlocked) mode \, you can move teh entire triangles around \, or cut \, copy \, and paste them.; #X text 47 325 subpatches:; #X text 37 281 Data is not persistent. If you save a Pd patch and reopen it \, the "data" isn't preserved.; #X text 37 5 This patch shows a simple data window with two objects in it. The objects' data structures and appearances are defined by the "template1" subpatch. This kind of object is called a "scalar." ; #X text 37 207 Scalars are described by "templates" \, which are subwindows. The subwindows are found by their name \, in this case "template1." The template describes what form the data take and how it is shown. It's possible to mix data of many different templates in the same collection. ; #X text 294 398 updated for Pd version 0.35.;