Referencing objects in containers

Discuss Lemur and share techniques.
Post Reply
oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19
Referencing objects in containers

Post by oldgearguy » 05 Dec 2013 10:40

I'm struggling with syntax trying to generically access objects in a container. Here's the setup:

I have 6 containers (named OP1-OP6). Each container has the same set of objects inside it, including a Breakpoint object named Env.
I have a script that manipulates the container called makeBig(opObj). I pass in the container object and do stuff like change the rectangle coordinates and size.

This is all fine. However, I want to be able to manipulate the Breakpoint size and move other objects around in that same function. The hardcoded syntax would be something like:
tmp = findobject('OP1.Env');
tmpRect = getobjectrect(tmp);
tmpRect[2] += 30;
tmpRect[3] += 60;
setobjectrect(tmp, tmpRect);

What I really want is a generic way to call findobject() like
tmp=findobject(opObj.'env'); //which doesn't work

I tried various combinations of converting things from arrays to strings and then attempting to build up a longer string with no success. I feel like I'm missing something obvious, but I can't figure out exactly how to generically address the object inside the container. Is there a way?

(I can do other things like make a separate call to a script that manipulates Env's and passing in the container.breakpoint reference or a series of if () conditions comparing the object name against known container names and then getting the objects inside, but I feel there's a simpler solution that I'm missing).

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: Referencing objects in containers

Post by Macciza » 05 Dec 2013 13:24

Hi
Presuming that the vars have been declared first . . .
Maybe try replacing first line with these two . . .

tmp = findobject(opObj); //value passed in by function ~tmp = ObjRef
tmp = tmp.Env; // ~tmp = ObjRef.Env

All the rest is the same . .

Ofcourse you will also need someway to shrink it as well so maybe pass another arg for zoom or shrink i.e. makeBig(opObj, i) and use 0 / 1 for shrink / zoom

hth
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: Referencing objects in containers

Post by oldgearguy » 05 Dec 2013 13:53

Thanks for the suggestion. I was playing around for about an hour last night and I don't know if I tried that exact combination.
Unfortunately, where I work I cannot install and run the editor, so it will have to wait until later today.

My initial goal is to post up a front end module for interfacing with FM synthesizers (i.e. 6 op synths like the TX-802 and DX7). I want to get a basic design out for people to take a look at and provide feedback before I jump into the actual MIDI SYSEX coding and making it look nice.

oldgearguy
Regular
Posts:315
Joined:02 Nov 2013 11:19

Re: Referencing objects in containers

Post by oldgearguy » 05 Dec 2013 21:52

Macciza wrote:Hi
Presuming that the vars have been declared first . . .
Maybe try replacing first line with these two . . .

tmp = findobject(opObj); //value passed in by function ~tmp = ObjRef
tmp = tmp.Env; // ~tmp = ObjRef.Env

All the rest is the same . .

Ofcourse you will also need someway to shrink it as well so maybe pass another arg for zoom or shrink i.e. makeBig(opObj, i) and use 0 / 1 for shrink / zoom

hth
MM
Thanks for the help -- I was overthinking the issue.

The calling script was doing an object() call to get the current object, so inside my makeBig(obObj) script, I simply needed opObj.env to get the Breakpoint object.
Goes to show what a little break from the problem can do.

Post Reply