  | | | SPDL editing (JavaScript) | SPDL editing (JavaScript) 2004-02-13 - By Jose Luis Gomez
Back Thanks Loic Le Page and Rafe Sacks, I've been able to do it just with some vbs at the logic section, but thanks for the workarounds to do it in JScript, I'll use them whenever i have to do something more complicated as i feel more confortable with JScript.
Thanks again for your help
/Jose Gomez
Rafe Sacks wrote:
> Hi Jose, > > > you could also make a SCOP that reads the slider value and executes a > function. SCOPs should update on change (slider or time if I remember > right). If this doesn't work in your case then you do indeed need to > go the spdl route. I warn you though, spdls aren't easy to get into if > you don't have someone around to ask questions of. There are a lot of > little things you need to know or else they seem to have a mind of > their own at times. For instance, a preset is saved with the scene, so > if you are editing your spdl and it doesn't seem to update in the > scene, you need to get a new scene and import your stuff as models. I > believe spdls are a thing of the past as of version 4 as well. > > If all you want to do is take a UI created CustPset and add a logic > section, I suggest following these steps (there are many ways to do > this, but I can guarantee this will work): > > > 1) shift + ctrl + click the title bar (not the window title, the > PSet title) and go to "install" and name it "TEMP.spdl" > > 2) shift + ctrl + click the title bar (not the window title, the > PSet title) and go to "edit" > > 3) save the edited file as a new name and quit XSI > > 4) open an XSI command prompt and type "xsi -u temp.spdl" and hit > enter - you have to do this because the instal through the UI in > step 1 is buggy and doesn't do it properly > > --- edit the spdl you saved as needed. You can check for errors by > typing "spdlcheck <file name>" in the xsi command prompt you have > open.--- > > 5) in the command prompt still, go to the folder with the file you > saved in step 3 and type "xsi -i <name>.spdl" where <name> is the > name you used n step 3 > > 6) open xsi and apply the to your object with this code (JScript): > > AddProp( "<name of spdl without .spdl>", > "<object name to apply it to>", > siDefaultPropagation, > "CustomPSet"); > > example: > AddProp( "mySpdl", "null", siDefaultPropagation, "CustomPSet"); > > > > > Note: Loic Le Page wrote a good description of what to do in the logic > section. I, also, highly recommend you run an external (of the spdl) > command rather then putting your code directly in the logic section. > It is MUCH easier to edit and you can use any language in the script > making the amount time spent in VBS minimal (yay!) > > > > > > R A F E S A C K S > S e n i o r C h a r a c t e r T e c h n i c a l D i r e c t o r > -- ---- ---- ---- ---- -- > A n i m a l L o g i c > > ================================================== > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- ---- -- > > Loic Le Page wrote: > >> Hi, >> >> To have your script called each time the slider's value is changing, the >> best way is to edit the SPDL file (as you said) and to add your scripted >> behaviour in the "Logic" section. If your slider is called "Slider" >> in your >> SPDL description, the corresponding function will be: >> Logic >> { >> Sub Slider_OnChanged() >> ....your script..... >> End Sub >> } >> >> Unfortunately, the "Logic" section only accept VBScript. But you can >> also >> write your script in JScript in XSI, then you save it as a custom >> command >> and you call this command from the "Logic" section of your slider's SPDL >> file. >> >> To answer your second question, you can write all your JScript >> functions in >> the same document and then register them as custom commands in XSI. Each >> time you create a custom command, you can specify the same file as >> source >> and then associate the command with a specific function in this file. >> Then >> you just have to call your own custom commands from your operators. >> >> Hope this helps. >> >> Loic Le Page >> BiboFilms - Pumpkin 3D >> France >> >> -- -- Original Message -- -- >> From: "Jose Luis Gomez" <development@(protected)> >> To: <XSI@(protected)> >> Sent: Wednesday, February 11, 2004 11:28 AM >> Subject: SPDL editing (JavaScript) >> >> > Hi all, >> > I have a custom parameter set with a slider on it, and I want a script >> > to be executed everytime the value of the slider changes. I know I can >> > do this by saving it as a SPDL and editing it, but I don't know how to >> > do it in JavaScript. Can anybody help me with this?? >> > >> > Another question I have is if it is possible to have a "library" of my >> > own JavaScript functions/procedures and call them from my >> > scripts/scripted operators. If so, how do I have to do it?? >> > >> > Thaks in Advance (examples would be really welcome :-) ) >> > >> > /Jose L. Gomez >> > >> > --- >> > Unsubscribe? Mail Majordomo@(protected) with the following text >> in body: >> > unsubscribe xsi >> > >> > >> >> --- >> Unsubscribe? Mail Majordomo@(protected) with the following text in >> body: >> unsubscribe xsi >>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1"> <title></title> </head> <body text="#000000" bgcolor="#ffffff"> Thanks Loic Le Page and Rafe Sacks,<br> I've been able to do it just with some vbs at the logic section, but thanks for the workarounds to do it in JScript, I'll use them whenever i have to do something more complicated as i feel more confortable with JScript.<br> <br> Thanks again for your help<br> <br> /Jose Gomez<br> <br> <br> Rafe Sacks wrote:<br> <blockquote type="cite" cite="mid402C00B8.B5E0B82@(protected)"><font color="#000099">Hi Jose,</font> <br> <p><font color="#000099">you could also make a SCOP that reads the slider value and executes a function. SCOPs should update on change (slider or time if I remember right). If this doesn't work in your case then you do indeed need to go the spdl route. I warn you though, spdls aren't easy to get into if you don't have someone around to ask questions of. There are a lot of little things you need to know or else they seem to have a mind of their own at times. For instance, a preset is saved with the scene, so if you are editing your spdl and it doesn't seem to update in the scene, you need to get a new scene and import your stuff as models. I believe spdls are a thing of the past as of version 4 as well.</font> </p> <p><font color="#000099">If all you want to do is take a UI created CustPset and add a logic section, I suggest following these steps (there are many ways to do this, but I can guarantee this will work):</font> </p> <blockquote> <br> <font color="#000099">1) shift + ctrl + click the title bar (not the window title, the PSet title) and go to "<b>install</b>" and name it "TEMP.spdl"</font> <p><font color="#000099">2) shift + ctrl + click the title bar (not the window title, the PSet title) and go to "<b>edit</b>"</font> </p> <p><font color="#000099">3) save the edited file as a new name and <b><i >quit</i></b> XSI</font> </p> <p><font color="#000099">4) open an <b>XSI</b> command prompt and type "xsi -u temp.spdl" and hit enter - you have to do this because the instal through the UI in step 1 is buggy and doesn't do it properly</font> </p> <p><i><font color="#000099">--- edit the spdl you saved as needed. You can check for errors by typing "spdlcheck <file name>" in the xsi command prompt you have open.---</font></i> </p> <p><font color="#000099">5) in the command prompt still, go to the folder with the file you saved in step 3 and type "xsi -i <name>.spdl" where <name> is the name you used n step 3</font> </p> <p><font color="#000099">6) open xsi and apply the to your object with this code (JScript):</font> </p> <p><tt><font color="#000099">AddProp( "<name of spdl without .spdl>",</font></tt> <br> <tt><font color="#000099"> "<object name to apply it to>",</font></tt> <br> <tt><font color="#000099"> siDefaultPropagation,</font></tt> <br> <tt><font color="#000099"> "CustomPSet");</font></tt> </p> <p><font color="#000099"><i>example</i>:</font> <br> <tt><font color="#000099">AddProp( "mySpdl", "null", siDefaultPropagation, "CustomPSet");</font></tt></p> </blockquote> <br> <p><font color="#000099">Note: Loic Le Page wrote a good description of what to do in the logic section. I, also, highly recommend you run an external (of the spdl) command rather then putting your code directly in the logic section. It is MUCH easier to edit and you can use any language in the script making the amount time spent in VBS minimal (yay!)</font> <br> <br> </p> <p> </p> <center><b><font color="#000066">R <font size="-1">A F E </font>S <font size="-1"> A C K S</font></font></b> <br> <i><font color="#999999"><font size="-1">S e n i o r C h a r a c t e r T e c h n i c a l D i r e c t o r</font>< /font></i> <br> <b><font color="#cccccc"><font size="-1"> -- ---- ---- ---- ---- --< /font></font></b> <br> <b><i><font color="#000066"><font size="-1">A n i m a l L o g i c</font></font></i></b> <p><font color="#cccccc">==================================================< /font></p> </center> <p><br> </p> <p>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ -- ---- ----- <br> Loic Le Page wrote: </p> <blockquote type="CITE">Hi, <p>To have your script called each time the slider's value is changing, the <br> best way is to edit the SPDL file (as you said) and to add your scripted <br> behaviour in the "Logic" section. If your slider is called "Slider" in your <br> SPDL description, the corresponding function will be: <br> Logic <br> { <br> Sub Slider_OnChanged() <br> ....your script..... <br> End Sub <br> } </p> <p>Unfortunately, the "Logic" section only accept VBScript. But you can also <br> write your script in JScript in XSI, then you save it as a custom command <br> and you call this command from the "Logic" section of your slider's SPDL <br> file. </p> <p>To answer your second question, you can write all your JScript functions in <br> the same document and then register them as custom commands in XSI. Each <br> time you create a custom command, you can specify the same file as source <br> and then associate the command with a specific function in this file. Then <br> you just have to call your own custom commands from your operators. </p> <p>Hope this helps. </p> <p>Loic Le Page <br> BiboFilms - Pumpkin 3D <br> France </p> <p>-- -- Original Message -- -- <br> From: "Jose Luis Gomez" <a class="moz-txt-link-rfc2396E" href="mailto :development@(protected)"><development@(protected)></a> <br> To: <a class="moz-txt-link-rfc2396E" href="mailto:XSI@(protected)"><XSI @(protected)></a> <br> Sent: Wednesday, February 11, 2004 11:28 AM <br> Subject: SPDL editing (JavaScript) </p> <p>> Hi all, <br> > I have a custom parameter set with a slider on it, and I want a script <br> > to be executed everytime the value of the slider changes. I know I can <br> > do this by saving it as a SPDL and editing it, but I don't know how to <br> > do it in JavaScript. Can anybody help me with this?? <br> > <br> > Another question I have is if it is possible to have a "library" of my <br> > own JavaScript functions/procedures and call them from my <br> > scripts/scripted operators. If so, how do I have to do it?? <br> > <br> > Thaks in Advance (examples would be really welcome :-) ) <br> > <br> > /Jose L. Gomez <br> > <br> > --- <br> > Unsubscribe? Mail <a class="moz-txt-link-abbreviated" href="mailto :Majordomo@(protected)">Majordomo@(protected)</a> with the following text in body: <br> > unsubscribe xsi <br> > <br> > </p> <p>--- <br> Unsubscribe? Mail <a class="moz-txt-link-abbreviated" href="mailto:Majordomo @(protected)">Majordomo@(protected)</a> with the following text in body: <br> unsubscribe xsi</p> </blockquote> </blockquote> </body> </html>
|
|
 |