View Full Version : Help: Creating a Lscript to key morph mixer

02-05-2004, 10:38 AM

I have a problem I hope someone can point me in the right direction to solve.

I figured out how to do a joystick type control for manipulating endomorphs. The problem is it does not key the morph mixer channels so I washoping someone here would know if it is possible to do the following:

1 have an lsript detect all the morph mixer channels (even if it is just looking for _mrph in the name)

2 then keying the channels it has found at the current frame.

I want it to be like the return key so I just click it and it creates the keys.

optionally make a second script that will delete the keys it has found.

Can anyone help me with this? or just point me toward what resources are available for me to learn lscript since I am a noob when it comes to this.



02-05-2004, 12:28 PM
I decided to post what I have figured out so far. This is just a plan of attack so I can kind of focus on what I need to accomplish with the script


@version 2.6
@name MM_Key
@script generic

// Setup variables

// Detect current frame send to CurrentFrame
CurFrame = integer(Scene().fps * Scene().currenttime);

// Loop - key mmChannels(#) on CurrentFrame - next until no more items.

// Function: find all items - in this case morph mixer channels with the _mrph in their name.
// add all items into an array, mmChannels().


edited Feb 5. Current script.

It seems like a simple script to figure out.


02-05-2004, 01:44 PM
I will release my unfinished source code of my KeyboardMixer if you also publish your script as open source. (GPL like) You will find all subroutines you need.

02-05-2004, 01:55 PM
I have no problem with that

wasn't planning on selling it. Just wanted to create a simple script that was going to post in this thread anyway.

Thanks that would really help if you did.

02-05-2004, 02:25 PM

02-05-2004, 03:08 PM
Thanks for posting this,

It will take me a little while to dig through this and figure out what does what. I am still new to lscript so I'll have to go through the manual and reference to understand it.


02-05-2004, 03:16 PM
I just saw the code on bottom of the script. there isn't a current frame function built in? It looks like you had to code it.


02-05-2004, 03:40 PM

Should be available since 6.x.

You need at least LW7.5c to run this script.

02-05-2004, 04:24 PM
What I mean is there is nothing that will return the current frame number. What currenttime does is return a floating point number based on the time in seconds. So I have to use your bottom code that makes an integer from currrenttime * fps.

02-05-2004, 04:29 PM
Yes, sorry.

Tha's what the function is for ;)

02-05-2004, 10:43 PM
I've been doing searches on the net, going through any scripts sources I can find and realized there is no search function.

It seems like I have to use the Channel Object agent.

use first channel
detect if _mrph is in name string
store the channel name in an array if it is then
next channel
until no more channels are found.

The problem with this is if it has to do that each time It will take forever to run.

So the other option is to make a little pop-up like the keyframe pop-up we all use normally but in this one it will use groups instead. That would cut down on the time it needs to run dramatically.

So at this point if I have a pop-up with a create key button, a drop down that must fill itself with a list of groups and box that fills itself with the current frame but can be changed the way the normal one is does this sound like I am on the right track?

Attached is the basic button design done in the LW UI software.
not sure if I used the right buttons for create and delete. Not sure if I should of used a bolean type?

Another question is can I have it accept a keypress as ok? I am guessing from looking at your script I just have to put the right keystroke value in it for to work the way I want.

Will do more tomarrow.


02-09-2004, 09:17 PM
Argh! I had just found lwg3d.org and their lscript tutorial and the site dies before I can get into it.... sigh

I'm still plugging away at this.