PDA

View Full Version : help: how to select/value-edit endomorph channels?



bjhchong
02-25-2003, 02:39 AM
Hi all,

I am trying to alter some values of a endomorph channel but could not seem to access the endomorph channel of a object (is there even such thing as a endomorph channel???)...

What I am trying to achieve is to develope a lscript with functionalities similiar to the JointMorph.p plugin...

Help please???

Thanks!
Bryan

faulknermano
02-26-2003, 10:25 PM
Originally posted by bjhchong
Hi all,

I am trying to alter some values of a endomorph channel but could not seem to access the endomorph channel of a object (is there even such thing as a endomorph channel???)...

What I am trying to achieve is to develope a lscript with functionalities similiar to the JointMorph.p plugin...

Help please???

Thanks!
Bryan


okay, first: there is an endomoprh channel. but it's only available when you access the morphmixer plug. you see, what the morphmixer is actually doing is creating a channel for you. morphmixer, also, is creating a link between that and the endomorphs of your actual object. MM displaces your object based on the channel that it has created.

now, depending on what you want you can two things:

1.) create a displacment plug like joint morph or morphmixer and create your custom endomorph channel. your displacment lscript will be the one that will displace your object based on your own custom channel.

2.) create a channel filter script that coordinates with morphmixer. joint morph, btw, does not create a channel. everything is done within the low / high ranges.

to know more about creating your own channels, look it up on the lscript reference docs (near the last part). however, if you havent had any experience with Channel Object Agents before, you will find the contents of the docs to be sorely lacking. feel free to ask more questions here or in the lscript mailing list. there are a lot of "behaviors" that arent really documented.

one beginning tip though: whenever you create a custom channel (they're called envelopes), be sure to declare the host variable as a global or else you will lose it after the moment you create it.

bjhchong
02-27-2003, 08:54 PM
Faulknermano,

Thanks for the enlightenment, man... you have fully verified my suspicions.

I have decided that in order to have a "cleaner approach", its best to create my own endomorph channel.

However, after reviewing the reference 3 times over but I am still clueless about how I can create a custom channel... the reference guide is yet to be comprehensive...

I would like to ask for you kind assistance again for any reference material(s) I can go through... tutorials, sample script, or if you can spare the time, a little writeup posted on this forum...

Thank you very much

Bryan

faulknermano
02-27-2003, 09:40 PM
// begin sample displacement script snippet
@warnings
@script displace

env; // global variable

create: obj // obj here is the object agent of the mesh you applied this script to
{
selfName = obj.name;
env = Envelope(selfName,CHAN_PERCENT,"ChannelGroup");
env.persist(false);
}
// end snippet


here you have the create function that creates the envelope. that docs describe the the meaning of the arguments that i have put in. again, the env is global so that in the process function, it exists. in all call-back type scripts (e.g. all script architectures except modeler and generic), you must declare your host variable for the Envelope Object Agent as a global: the script jumps back and forth functions, thus must retain the the envelope variable.

from here, you can access the methods of env just like you would any channel object agent. (look up the methods in the docs).

// begin newtime and process function
gTime; //global var
newtime: object, frame, time
{
gTime = time;
}

process: da // da is the agent of the point that is being currently processed
{
v = env.value(gTime); // gets value at the current time
kc = env.keyCount; // gets number of keys in envelope
for(i=1;i<=kc;i++)
keyTime[i] = env.keys[i];

for(i=1;i<=keyTime.size();i++)
{
if(keyTime[i] == 0)
continue;
if(thisKey = env.keyExists(keyTime[i])
env.deleteKey(thisKey);
}

}
// end

in the process func i access the value() method to get the value of the curve in the envelope at a specific time index. i also access the data member keyCount to get the number of keys. then, as a sampler, i go through a loop twice, first to get the key times, and second, to delete all keys except the at time index 0.0.

anyway, hope this helps..