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?
 
Scripting help - PathCns - Dan 's attempt in Jscript....

Scripting help - PathCns - Dan 's attempt in Jscript....

2005-06-03       - By Dan Yargici

 Back
Reply:     1     2     3     4     5     6     7     8     9  

Thanks Bernard, Brad, Matt.

The important thing for me is you didn't point at me and laugh, which
means I must be making progress! :)

I'm actually enjoying learning all this, and hopefully while things are
quiet this summer I can advance a whole lot more.

Thanks once again, I'm sure you'll be hearing from me a lot more in the
coming months!

DAN
P.S. I've just realised I forgot to ask something else, occasionally in
my script I would get errors where I had a true or false -
".....addparameter3( "Value", siInt2, 1, 0, 4, true, false )" for
instance.  If I swapped them, for 1s or 0s things would work.  Anyone
experienced that before?  Is there a logical reason?


Bradley R. Gabe wrote:

> On the linux side, there was no try/catch in jscript. So since XSI 3.5
> the InspectObj command has a switch to turn off throwing errors. It
> turns out the linux syntax also works on windows. It may not be as
> versitile as using try/catch, but it gets the job done with fewer
> lines of code:
>
> function askUser()
> {
>         // Define the GUI
>         var oProp = activesceneroot.addproperty( "CustomProperty",
> false, "TellMe" );
>         var oParam = oProp.addparameter3( "Value", siInt2, 1, 0, 4,
> true, false );
>
>         // Test for cancel
>         var isCanceled = inspectobj( oProp, "", "TellMe", siModal,
> false);
>
>         // If canceled, exit function and delete GUI
>         if(isCanceled){
>                 deleteobj( oProp );
>                 return( null );
>         }
>
>         // Complete rest of script
>         nValue = oParam.value;
>         deleteobj( oProp );
>         return( nValue );
>    }
>
>
>
>> This is also what I do, and am very happy that way. I use the
>> technique shown by Michael Isner in Experience XSI 4, that is, a
>> try/catch statement, that I put in a function. Then if the function
>> returned nothing, the script stops and print a message telling why
>> ("cancelled by user").
>>
>>
>> // Call function
>> var nValue = askUser();
>>
>> // Test return value
>> if( nValue == null ) {
>>    logmessage( "cancelled by user.", siError );
>> } else {
>>    logmessage( nValue );
>>    // do something...
>> }
>>
>>
>> function askUser()
>> {
>>    var oProp = activesceneroot.addproperty( "CustomProperty", false,
>> "TellMe" );
>>    var oParam = oProp.addparameter3( "Value", siInt2, 1, 0, 4, true,
>> false );
>>
>>    try {
>>        // Here's the important thing: the raise error being true,
>>        // if the user cancels, the script will go to the catch statement
>>        inspectobj( oProp, "", "TellMe", siModal, true );
>>        nValue = oParam.value;
>>        deleteobj( oProp );
>>        return( nValue );
>>    }
>>    catch(a) {
>>        deleteobj( oProp );
>>        return( null );
>>    }
>> }
>>
>>
>> The try/catch statement definitely is not the most elegant way to do
>> things, but since a ppg in siModal mode is an operation that rarely
>> is necessay more than a few times during script execution, I think
>> its cost is reasonnable.
>>
>> ---
>> Unsubscribe? Mail Majordomo@(protected) with the following text in
>> body:
>> unsubscribe xsi
>
>
> ---
> Unsubscribe? Mail Majordomo@(protected) with the following text in
> body:
> unsubscribe xsi
>
---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi