--- On Mon, 3/15/10, João Pais jmmmpais@googlemail.com wrote:
From: João Pais jmmmpais@googlemail.com Subject: [PD] data structures: variable array element + variable resolution? To: "PD-List" pd-list@iem.at Date: Monday, March 15, 2010, 3:10 AM Hi,
I had a couple of questions about data structures:
- I have an array based on template X. I wanted to make
variations on the drawing of that array, by changing a variable in template X. The thing is, I can't access X when it's inside an array. Is there a way to get a pointer to the X templates inside an array?
[element]
I also tried creating an extra instance of X and change the variable of that template. Unfortunately it had no effect on the same templates inside the array.
Right, you're just changing the value for that particular scalar.
- I have a variable being plotted with a step value of 1:
[plot -y y(0:100)(-1:1)(1) ...]. I wanted to change the step value on the fly, but when I wrote (step) instead of (1), there was a "parse error". Does that mean that the step is always the same at each template? Is isn't possible to assign a variable to the step value?
As far as I can tell you are right, unfortunately. You can hack around this by taking the output from the [struct] and quantizing it yourself (i.e., [get] the y value, [div] by your desired step size, and [set] the y value, all the time keeping track of the "real" y value using the difference between the current and previous y).
Oh, but if it's an array, you won't get output from a [struct] when you move the elements. So nevermind.
If if isn't possible to do any of these operations, I might be able to circumvent the problem by deleting and creating new objects. Afaik it isn't possible to edit an object, it's necessary to cut it and create a new one. Am I correct, or is there a new possibility I don't know yet?
If you don't care about the flickering, you could do something like what's attached. Notice that you have to name the template folder something different than the struct.
-Jonathan
Thanks,
João Pais
--Friedenstr. 58 10249 Berlin (Deutschland) Tel +49 30 42020091 | Mob +49 162 6843570 Studio +49 30 69509190 jmmmpais@googlemail.com | skype: jmmmpjmmmp
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list