Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
SPDL editing (JavaScript)

SPDL editing (JavaScript)

2004-02-12       - By Rafe Sacks

 Back
Reply:     1     2     3     4  

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.0 transitional//en">
<html>
<font color="#000099">Hi Jose,</font>
<br><font color="#000099"></font>&nbsp;<font color="#000099"></font>
<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><font color="
#000099"></font>
<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>
<blockquote><font color="#000099"></font>&nbsp;
<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><font color="#000099"></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><font color="
#000099"></font>
<p><font color="#000099">3) save the edited file as a new name and <b><i>quit<
/i></b>
XSI</font><font color="#000099"></font>
<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><font color=
"#000099"></font>
<p><i><font color="#000099">--- edit the spdl you saved as needed. You
can check for errors by typing "spdlcheck &lt;file name>" in the xsi command
prompt you have open.---</font></i><font color="#000099"></font>
<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 &lt;name>.spdl" where
&lt;name> is the name you used n step 3</font><font color="#000099"></font>
<p><font color="#000099">6) open xsi and apply the&nbsp; to your object
with this code (JScript):</font><font color="#000099"></font>
<p><tt><font color="#000099">AddProp( "&lt;name of spdl without .spdl>",</font>
</tt>
<br><tt><font color="#000099">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"&lt;object name to apply it to>",</font></tt>
<br><tt><font color="#000099">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
siDefaultPropagation,</font></tt>
<br><tt><font color="#000099">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"CustomPSet");</font></tt><tt><font color="#000099"></font></tt>
<p><font color="#000099"><i>example</i>:</font>
<br><tt><font color="#000099">AddProp( "mySpdl", "null", siDefaultPropagation,
"CustomPSet");</font></tt></blockquote>

<br>&nbsp;
<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>&nbsp;
<br>&nbsp;
<p>&nbsp;
<center><b><font color="#000066">R <font size=-1>A F E&nbsp;&nbsp; </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&nbsp;&nbsp; C h
a r a c t e r&nbsp;&nbsp; T e c h n i c a l&nbsp;&nbsp; D i r e c t o r</font><
/font></i>
<br><b><font color="#CCCCCC"><font size=-1>&nbsp;-- ---- ---- ---- ---- --<
/font></font></b>
<br><b><i><font color="#000066"><font size=-1>A n i m a l&nbsp;&nbsp; L
o g i c</font></font></i></b>
<p><font color="#CCCCCC">==================================================<
/font></center>

<p><br>
<p>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
-- ---- ---
<br>Loic Le Page wrote:
<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>&nbsp;&nbsp;&nbsp; Sub Slider_OnChanged()
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ....your script.....
<br>&nbsp;&nbsp;&nbsp; End Sub
<br>}
<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>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>Hope this helps.
<p>Loic Le Page
<br>BiboFilms - Pumpkin 3D
<br>France
<p>-- -- Original Message -- --
<br>From: "Jose Luis Gomez" &lt;development@(protected)>
<br>To: &lt;XSI@(protected)>
<br>Sent: Wednesday, February 11, 2004 11:28 AM
<br>Subject: SPDL editing (JavaScript)
<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 Majordomo@(protected) with the following text
in body:
<br>> unsubscribe xsi
<br>>
<br>>
<p>---
<br>Unsubscribe? Mail Majordomo@(protected) with the following text in
body:
<br>unsubscribe xsi</blockquote>
</html>