PDA

View Full Version : Proper use of reqopen();



foxco
08-28-2007, 11:11 AM
Hey all,

to start, I'm no programmer, and I read the User manual explanation of how to use reqopen, but no lies, I just don't understand the instructions on how to use it.

I am a much better study if I have a working code to backwards engineer while reading the Manual.

So my question is, could someone please post for me a working barebones script that utilizes reqopen();

cheers and thanks

Chad Fox
Rainmaker Entertainment

dballesg
08-28-2007, 11:27 AM
If you use the LScript Editor that cames with Lightwave, on your programs directory LSED.

It can generate a template code for many of the types of LScripts you can create. Choose for example a Master from the Tools -> Templates option and it will create a bare bone script for you.

David

Dodgy
08-28-2007, 11:34 AM
There's lots of examples on my website of lscripts. Here's a snippet.


reqbegin("MGMuscleBone Ver: "+myversion);
c0 = ctlcheckbox("Scale X",myxon);
c1 = ctlpercent("X Scale",myxscale);
c2 = ctlcheckbox("Scale Y",myyon);
c3 = ctlpercent("Y Scale",myyscale);
c4 = ctlcheckbox("Scale Z",myzon);
c5 = ctlpercent("Z Scale",myzscale);

ctlrefresh(c1,"xscaleUDF");
ctlrefresh(c3,"yscaleUDF");
ctlrefresh(c5,"zscaleUDF");

reqopen();


Since you're using reqopen, you have to have ctlrefresh call backs to do things for the interactive controls. Buttons and such like have callbacks built in, so you don't need to set them up for those types of control.

evenflcw
08-28-2007, 11:50 AM
If you add the little snippet at the top here you won't get an error if you try to open the plugins panel while it's already open. With reqend() there, as in the example it'll close the panel. With reqend() removed nothing happends (panel remains open).


options {

if( reqisopen() ) {
reqend();
return;
}

reqbegin("MGMuscleBone Ver: "+myversion);
c0 = ctlcheckbox("Scale X",myxon);
c1 = ctlpercent("X Scale",myxscale);
...

reqopen();

}

foxco
08-28-2007, 12:02 PM
I use LSed and LSid often, but thanks for the tip, the templates will help me alot. I have only worked with Generic scripts and a limited number of UDFs in them, This masterscript layout is something have not seen yet, I guess it will take some time to fully understand it, but I'll take a moment to read up on it.

well, that does explain why I could not understand the Manual description :)

Thanks

Chad Fox
Rainmaker Entertainment

evenflcw
08-28-2007, 12:12 PM
Reqopen() works for all persistent scripts, so not only Master Scripts but Motion modifiers, Custom objects etc aswell (ie everything except Generic). You probably figured that by yourself, I'm just pointing out the obvious in case anyone missed it. :)

foxco
08-28-2007, 12:33 PM
thanks for the extra info. Because infact, I did not know that :)