03.setting.data.pd 5.65 KB
Newer Older
Miller Puckette's avatar
Miller Puckette committed
1
#N struct template3 float x float y float w float h float q;
2
#N canvas 434 148 448 481 10;
3 4 5 6 7 8 9 10 11 12 13
#X floatatom 22 351 0 0 0 0 - - -;
#X floatatom 22 303 0 0 0 0 - - -;
#X floatatom 22 255 0 0 0 0 - - -;
#X floatatom 22 207 0 0 0 0 - - -;
#X floatatom 286 302 0 0 0 0 - - -;
#X floatatom 245 302 0 0 0 0 - - -;
#X floatatom 202 302 0 0 0 0 - - -;
#X obj 159 254 pointer;
#X msg 167 229 next;
#X floatatom 159 302 0 0 0 0 - - -;
#N canvas 429 68 389 382 data3 1;
Miller Puckette's avatar
Miller Puckette committed
14 15 16 17 18 19 20 21
#X scalar template3 18 25 43 18 741 \;;
#X scalar template3 111 109 75 25 72 \;;
#X scalar template3 111 32 4 15 163 \;;
#X scalar template3 59 1 13 34 563 \;;
#X scalar template3 148 26 37 20 566 \;;
#X scalar template3 173 221 76 48 763 \;;
#X scalar template3 250 127 18 36 543 \;;
#X scalar template3 124 210 78 21 107 \;;
22
#X scalar template3 264 183 1 33 178 \;;
Miller Puckette's avatar
Miller Puckette committed
23 24
#X scalar template3 26 28 56 60 132 \;;
#X scalar template3 2 202 66 2 808 \;;
25
#X scalar template3 270 46 74 51 881 \;;
Miller Puckette's avatar
Miller Puckette committed
26 27 28 29 30 31
#X scalar template3 214 226 8 43 180 \;;
#X scalar template3 57 145 51 58 939 \;;
#X scalar template3 216 102 36 43 505 \;;
#X scalar template3 166 86 68 9 614 \;;
#X scalar template3 144 191 56 28 886 \;;
#X scalar template3 228 2 62 1 758 \;;
32
#X scalar template3 168 169 28 23 654 \;;
Miller Puckette's avatar
Miller Puckette committed
33
#X scalar template3 223 248 73 50 727 \;;
34 35 36 37 38 39
#X restore 159 400 pd data3;
#N canvas 145 268 428 247 template3 0;
#X obj 25 88 filledpolygon q 0 1 0 0 w 0 w h 0 h;
#X obj 26 183 drawnumber q 0 0 0;
#X text 22 59 five numeric ("float") fields;
#X text 25 108 drawing a rectangle \, interior color q \, border black
Miller Puckette's avatar
Miller Puckette committed
40 41 42
and one unit thick \, through the points (0 \, 0) \, (w \, 0) \, (w
\, h) \, and (0 \, h). Note that the three points containing variables
become hot spots for mouse dragging.;
Stefan Huber's avatar
Stefan Huber committed
43
#X text 26 204 Draw the value of q as an Arabic numeral \, at (0 \,
Miller Puckette's avatar
Miller Puckette committed
44
0) \, in black.;
45
#X obj 24 39 struct template3 float x float y float w float h float
Miller Puckette's avatar
Miller Puckette committed
46
q;
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -261139 -33289 0;
#X text 7 2 setting scalar data- Related Help Documents;
#X restore 159 421 pd template3;
#X msg 159 354 remake;
#X obj 159 278 get template3 x y w h q;
#X floatatom 318 302 0 0 0 0 - - -;
#X obj 22 231 set template3 x;
#X obj 22 279 set template3 y;
#X obj 22 327 set template3 w;
#X obj 22 374 set template3 h;
#X floatatom 22 398 0 0 0 0 - - -;
#X obj 22 421 set template3 q;
#X msg 159 206 traverse pd-data3;
#X text 213 353 <- click to randomize;
#X text 19 113 Getting parameter values is as in the previous patch
\; however \, as you traverse the list with "next" messages the new
pointers are also sent to the five "set" objects. These have as arguments
the template name and the name of the field they will set. You can
drag on the five number boxes (after selecting an object with "traverse"
and "next" messages) to change its location \, shape \, and color.
;
#X obj 1 1 cnv 15 445 20 empty \$0-pddp.cnv.header setting_data 20
10 1 18 -261139 -33289 0;
#X obj 407 2 pddp/pddplink http://puredata.info/dev/pddp -text pddp
;
#X text 19 38 The [set] object allows you to change numeric values.
In this example \, the template specifies five fields describing the
(x \, y) location \, width \, height \, and color. A new feature is
that the color is also getting printed out under the rectangles. This
is done using the "drawnumber" object in the template.;
#X obj 1 459 cnv 15 445 20 empty \$0-pddp.cnv.footer empty 20 12 0
14 -233017 -33289 0;
80 81 82 83 84 85
#N canvas 45 271 494 284 META 0;
#X text 12 105 WEBSITE http://crca.ucsd.edu/~msp/;
#X text 12 85 AUTHOR Miller Puckette;
#X text 12 65 LIBRARY PDDP;
#X text 12 25 LICENSE SIBSD;
#X text 12 125 HELP_PATCH_AUTHORS Jonathan Wilkes revised the patch
86
to conform to the PDDP template for Pd version 0.42.;
87 88
#X text 12 45 DESCRIPTION setting data;
#X text 12 5 KEYWORDS data_structure tutorial;
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
#X restore 392 461 pd META;
#N canvas 13 202 428 190 References 0;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -261139 -33289 0;
#X text 7 2 setting scalar data- Related Help Documents;
#X restore 103 461 pd References;
#X obj 6 461 pddp/pddplink ../5.reference/pddp/help.pd -text help;
#N canvas 313 68 428 426 init 0;
#X obj 304 205 pointer;
#X obj 304 229 t b b p;
#X obj 190 388 append template3 x y w h q;
#X obj 171 32 loadbang;
#X obj 171 66 t b b b;
#X msg 304 183 traverse pd-data3;
#X msg 270 91 \; pd-data3 clear;
#X msg 212 117 0;
#X obj 171 139 f;
#X obj 204 139 + 1;
#X obj 171 117 until;
#X obj 171 161 sel 20;
#X obj 221 161 t b;
#X obj 7 291 random 300;
#X obj 81 291 random 300;
#X obj 291 291 random 1000;
#X obj 155 291 random 80;
#X obj 223 291 random 80;
#X obj 81 313 - 30;
#X obj 235 32 inlet;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -261139 -33289 0;
#X text 7 2 Data Structure Initialization;
Miller Puckette's avatar
Miller Puckette committed
120
#X connect 0 0 1 0;
121 122
#X connect 1 0 13 0;
#X connect 1 1 14 0;
Miller Puckette's avatar
Miller Puckette committed
123 124 125 126
#X connect 1 1 15 0;
#X connect 1 1 16 0;
#X connect 1 1 17 0;
#X connect 1 2 2 5;
127
#X connect 3 0 4 0;
Miller Puckette's avatar
Miller Puckette committed
128 129 130 131 132 133 134 135 136 137 138 139 140
#X connect 4 0 10 0;
#X connect 4 1 5 0;
#X connect 4 1 7 0;
#X connect 4 2 6 0;
#X connect 5 0 0 0;
#X connect 7 0 8 1;
#X connect 8 0 11 0;
#X connect 8 0 9 0;
#X connect 9 0 8 1;
#X connect 10 0 8 0;
#X connect 11 0 10 1;
#X connect 11 1 12 0;
#X connect 12 0 0 0;
141 142 143 144 145 146 147 148 149 150 151 152 153 154
#X connect 13 0 2 0;
#X connect 14 0 18 0;
#X connect 15 0 2 4;
#X connect 16 0 2 2;
#X connect 17 0 2 3;
#X connect 18 0 2 1;
#X connect 19 0 4 0;
#X restore 159 379 pd init;
#X connect 0 0 18 0;
#X connect 1 0 17 0;
#X connect 2 0 16 0;
#X connect 3 0 15 0;
#X connect 7 0 13 0;
#X connect 7 0 15 1;
Miller Puckette's avatar
Miller Puckette committed
155 156 157
#X connect 7 0 16 1;
#X connect 7 0 17 1;
#X connect 7 0 18 1;
158
#X connect 7 0 20 1;
Miller Puckette's avatar
Miller Puckette committed
159
#X connect 8 0 7 0;
160 161 162 163 164 165 166 167
#X connect 12 0 31 0;
#X connect 13 0 9 0;
#X connect 13 1 6 0;
#X connect 13 2 5 0;
#X connect 13 3 4 0;
#X connect 13 4 14 0;
#X connect 19 0 20 0;
#X connect 21 0 7 0;