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-02       - By Dan Yargici

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

No takers?


Dan Yargici wrote:

> OK, here's my *unfinished* attempt at converting it (no more time
> unfortunately, it was a very good exercise though).  I have to say, I
> didn't really understand what you were trying to achieve in parts so I
> just used your expressions unchanged.  Also I didn't understand some
> of your (swedish?) variable names so that why I also have some bizarre
> names... I was really just experimenting with how some things would be
> done using the OM.  I couldn't figure out to use ApplyPath with OM
> though so I used AddConstraint instead, which would then need keys
> setting after (with ApplyPath this can be done on creation it seems).
> I didn't get around to the animation but that looked straightforward.
>
> Anyway, if some of the more seasoned scripting types could cast a
> beady eye over this I'd really appreciate it.  I did some things I'm
> just not sure about.  First off, I iterate through the collection
> retuned by the duplicate command instead of enumerating it.  Now I
> remember reading here many times that enumerating is faster, but it
> just seemed unecessary in this instance, am I right?
>
> Also, I'm checking for whether the user pressed OK or Cancel by just
> checking if a return value exists.  Is this a no no?  It's seems
> fairly fool-proof to me.
>
> Many thanks scripty heads,
>
> DAN
>
>
>
> Dan Yargici wrote:
>
>> Demian,
>>
>> I would also recommend Helge's scripting series availble from
>> 3dTutorial.com - it's really pushed me along and I've only finished 2
>> chapters.  Really clear explanations and totally OM oriented.
>>
>> Now I finally understand why everyone suggests using Jscript over
>> VBscript, I'm finding it waaaaay nicer.
>>
>> I decided to try and convert your script to jscript OM code, I'll
>> polish it up and post it tomorrow (I'd like to get some crits from
>> the brains here too as I'm sure I'm doing some things a bit
>> shabbily.... but I did manange to make it %99.9 OM)
>>
>> DAN
>>
>> Juan Brockhaus wrote:
>>
>>> Hi Demian,
>>>
>>> I've added a modified version of your script. it opens up the PPG of
>>> all pathcns in one multi-PPG.
>>> as a tip, I would suggest you to learn about the object mode, which
>>> is much faster in scripting.
>>> you could speed up your script by feeding arrays with your loop and
>>> do a 'multi' path constrain and then set the different values with
>>> the object mode.
>>>
>>> cheers,
>>>
>>> Juan
>>>
>>>
>>>
>>>
>>>
>>>     -- --Original Message-- --
>>>     *From:* Demian Zarins [mailto:demian.zarins@(protected)]
>>>     *Sent:* 01 June 2005 13:39
>>>     *To:* xsi@(protected)
>>>     *Subject:* Scripting help - PathCns
>>>
>>>
>>>     I�m in need of some scripting help here :) I�m not very good at
>>> it so
>>>     step by step help would be appreciated.
>>>
>>>     In my script (se attached script). I�m trying to make a more
>>>     versatile duplicate/animation to path
>>>     setup. What I would like to have is the possibility to have the
>>>     PathCns PPG come up at the
>>>     end of the script so that I can set these properties without
>>>     hardcoding it as I do now.
>>>
>>>
>>>                             SetValue oSelection(i).Name +
>>>     ".kine.pathcns.affbyori1", True
>>>                             SetValue oSelection(i).Name +
>>>     ".kine.pathcns.tangent", True
>>>                             SetValue oSelection(i).Name +
>>>     ".kine.pathcns.dirx", -1
>>>                             SetValue oSelection(i).Name +
>>>     ".kine.pathcns.diry", 0
>>>                             SetValue oSelection(i).Name +
>>>     ".kine.pathcns.dirz", 0
>>>                             SetValue oSelection(i).Name +
>>>     ".kine.pathcns.upvct_active", True
>>>                             SetValue oSelection(i).Name +
>>>     ".kine.pathcns.roll", 45
>>>
>>>
>>>     Maybe there is a built in way of doing this, in that case please
>>>     share it with me :)
>>>     If anyone can set me in the right direction I would be thankfull.
>>>
>>>     TIA
>>>
>>>     Demian
>>>
>>>
>>>
>>>
>>>
>>> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
>>>
>>>     D E M I A N    Z A R I N S
>>>     Projektledare
>>>     S V T -> V�xthuset - The Green House
>>>     Sveriges Television
>>>     Oxenstiernsg 26
>>>     105 10 STOCKHOLM
>>>     Phone: +46 8 784 3312 ->mobile:+46 709-951984
>>>
>>>
>>>     --
>>>     No virus found in this incoming message.
>>>     Checked by AVG Anti-Virus.
>>>     Version: 7.0.322 / Virus Database: 267.3.3 - Release Date:
>>> 31/05/2005
>>>
>>>
>>> --
>>> No virus found in this outgoing message.
>>> Checked by AVG Anti-Virus.
>>> Version: 7.0.322 / Virus Database: 267.3.3 - Release Date: 31/05/2005
>>>
>>
>> ---
>> Unsubscribe? Mail Majordomo@(protected) with the following text in
>> body:
>> unsubscribe xsi
>>
>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
>
>function CreateCPset()
>{
>     try
>     {
>       var myParams = ActiveSceneRoot.AddProperty("CustomProperty", false, "Init"
);
>       var myNoOfObj = myParams.AddParameter2 ("Set Number of Objects", siInt2 ,
10, 0, 100, 0, 100, siClassifUnknown, 5);
>       var myLengthOfAnim = myParams.AddParameter2 ("Set Length of Anim", siInt2 ,
0, 0, 100, 0, 100, siClassifUnknown, 5);
>       var myNumOfRev = myParams.AddParameter2 ("Set Number of Rev", siInt2 , 0, 0
, 100, 0, 100, siClassifUnknown, 5);
>       if (myParams)
>         {InspectObj (myParams, "", null, 4);
>
>         myArray = new Array(3);
>
>         myArray[0] = myNoOfObj.value;
>         myArray[1] = myLengthOfAnim.value;
>         myArray[2] = myNumOfRev.value;
>
>         DeleteObj(myParams);
>         return myArray;
>       }
>     }
>     catch (err)
>     {
>       DeleteObj(myParams);
>       return "ERR";
>     }
>}
>
>DeselectAll() ;
>
>var myErrStr = "Cancelled!";
>
>var myVals = CreateCPset();
>
>if (myVals != "ERR")
>{
>   var myPath;
>   var myButton;
>   var myModifier;
>
>   var myRtnPath = PickObject("Pick Path","", myPath, myButton, myModifier);
>   var myPathObj = myRtnPath.Item("PickedElement");
>   if (myPathObj)
>   {
>     if (myPathObj.Type == "crvlist")
>     {
>       var myObj;
>       var myButton;
>       var myModifier;
>
>       var myRtnObj = PickObject ("Select Object", "", myObj, myButton, myModifier
);
>       var myObjObj = myRtnObj.Item("PickedElement");
>       if (myObjObj)
>       {
>         var myObjCount = myVals[0];
>         var myAnimLength = myVals[1];
>         var myThree = 100 * myVals[2];
>         myFour = myAnimLength/myObjCount;
>        
>         var myDupSet = Duplicate (myObjObj.Name, myObjCount, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null,
null, 0, null);
>        
>         for (var i = 0; i < myDupSet.Count; i++)
>         {
>           var myStart = 0 + ((i*myFour)/(myThree/100));
>           var myEnd = myAnimLength + ((i*myFour)/(myThree/100));
>          
>           var myEndObj = myDupSet(i);
>           var myConstr = myEndObj.kinematics.AddConstraint( "Path", myPathObj, 0);
>          
>           myConstr.perc = myStart;
>           myConstr.affbyori1 = 1;
>           myConstr.tangent = 1;
>           myConstr.dirx = -1;
>           myConstr.diry = 0;
>           myConstr.dirz = 0;
>           myConstr.upvct_active = 1;
>           myConstr.roll = 45;
>
>         }
>       }
>       else
>       {
>         logmessage (myErrStr);
>       }
>     }
>     else
>     {
>       logmessage ("Selection is not a Curve!");
>     }
>   }
>   else
>   {
>     logmessage (myErrStr);
>   }
>}
>else
>{
>logmessage (myErrStr)
>}
>
>
>

---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi