View Full Version : more Envelope Questions

10-07-2004, 08:49 PM
Now that I have the Envelope Button working "kinda" OK, I've hit a couple more snags.
In LScript, I can easily create Envelopes and open the Graph Editor with:

eOA = Envelope(eName, CHAN_PERCENT, cgName);

CommandInput("GE_OpenWindow 1");

// eName is the EnvelopeName & cgName is the ControlGroupName
Question-1: How do I have the Graph Editor open with the new Envelope selected?
note: I thought CommandInput("GE_SetEnvID " + env.id + " 0"); might work, but I don't know how to get the env.id

Question-2: How do I remove the Envelope after I've detected the shift-click?

10-07-2004, 10:17 PM
question 1:

you have to "backtrack": get the envelope's id by looking for it via channel object agents.

e = Envelope("DaThing",CHAN_PERCENT,"body");

cg = ChannelGroup("body"); // backtracks to the body chgroup, assumes you know what channelgroup
c = cg.firstChannel(); // assumes first channel is desired one

str = string("GE_SetEnvID ",c.id," ",0);

question 2:

assign `nil` to the envelope proxy variable:

e = nil;

10-07-2004, 10:34 PM


I guess I shouldn't assume it's the first one; that I need to loop through the Channels in the Channel Group, checking each channel name to make sure that I get the correct one and if it's "Da Thing" isn't found... well I guess there's really a problem then. ;)

Here's some quick code for others (not tested-- just writing it). I'm hoping the assigning z to c.id is permitted.

c = cg.firstChannel();
while (c)
if (c.name == eName) { z = c.id; break; }
c = cg.nextChannel();
str = string("GE_SetEnvID ",z," ",0);
if (z) CommandInput(str);

Thank you so much!

10-07-2004, 10:49 PM
yes, z = c.id should be fine. lscript's pointer mechanism at work. :) very nice, imo.

however, i forgot to add: the fact that envelopes do not share the id datamember just plain SUCKS! i sometimes wish that envelopes and channels were just combined into one. after all, they're practically the same.

10-07-2004, 10:54 PM
I had some syntax errors, so I corrected the code.
But it works GREAT!

faulknermano, thanks again. :)