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?
 
Basic scripting question..

Basic scripting question..

2005-04-14       - By Bradley R. Gabe

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

For anyone concerned about performance, using a transform object is
significantly faster that going the match transformation route. Also, check
out the AddNull() method. It creates a new null as the child of the object
that calls it:

// Create a normalized transform
var trans = XSIMath.CreateTransform;

// Loop through the selection
for(var e = new Enumerator(selection); !e.atEnd(); e.moveNext()){

    // For each obj, add a null
    var obj = e.item();
    var node = obj.AddNull(obj.name + '_NUL');

    // Transform the null to rest pose
    node.kinematics.local.transform = trans;
}



> From the online help:
>(select a word in your script and click the ? button in the script editor,
>it ll give your the appropriate info)
>
>Scripting Syntax
>GetPrim (PresetObj, [Name], [Parent], [Primitive])
>
>
>so the  GetPrim "Null" line would become something like:
>GetPrim "Null" , nill & "_null"
>
>now there is also the MatchTransform command,
>that will allow to match the transforms of the null to the object,
>to avoid doing a constraint and then removing it
>and then the ParentObj command to do the parenting.
>Something like:
>
>-- ------
>set A=GetValue("SelectionList")
>     for each ab in A
>         GetPrim "Null", ab & "_null"
>         MatchTransform , ab, siSRT
>         ParentObj ab & "_null", ab
>     next
>-- ---- --
>
>that should do the trick.
>You didnt want any constraints in the end right?
>
>Peter
>
>
>
>
>
>
>
>
>
>
>
>-- -- Original Message -- --
>From: <mailto:lee.hallett@(protected)>Lee Hallett
>To: <mailto:XSI@(protected)>XSI@(protected)
>Sent: Thursday, April 14, 2005 2:11 PM
>Subject: Basic scripting question..
>
>I'm trying to modify matts nullifier script, but my scripting is somewhat
>below par (non existent).
>
>The two extra things I need to do are
>1) Make the null the parent of the object
>2) Rename the null to *Objectname*_Null
>
>Anyone got any quick tips!!
>
>Original script:
>
>' nullifier v1.1 by Matt Lowery
>
>Dim A
>Dim nul
>Dim B
>
>set A=GetValue("SelectionList")
>for each ab in A
>         GetPrim "Null"
>         set nul=GetValue("SelectionList")
>         for each nil in nul
>                 ApplyCns "Pose",nil,ab
>                 Duplicate nil
>                 DeleteObj nil
>         next
>         set B=GetValue("SelectionList")
>                 for each ba in B
>                         RemoveAllCns ba
>                         ApplyCns "Pose", ab, ba
>                 next
>next
>
>Lee|3d animation and design..
>Pixel pusher & 'telly colouring in' bloke
>
>There are only 10 sorts of people in the World - those that understand
>binary, and those that don't.
>  *       BBC Wales | C4 graphics area | Broadcasting House| Llandaff,
> Cardiff. CF5 2QY.
>  (       +44 (0)29 203 23370
>e-*     lee.hallett@(protected)
>
>
>
>http://www.bbc.co.uk/
>
>This e-mail (and any attachments) is confidential and may contain
>personal views which are not the views of the BBC unless specifically
>stated.
>If you have received it in error, please delete it from your system.
>Do not use, copy or disclose the information in any way nor act in
>reliance on it and notify the sender immediately. Please note that the
>BBC monitors e-mails sent or received.
>Further communication will signify your consent to this.

<html>
<body>
For anyone concerned about performance, using a transform object is
significantly faster that going the match transformation route. Also,
check out the AddNull() method. It creates a new null as the child of the
object that calls it:<br><br>
<font face="Courier New, Courier" color="#008000">// Create a normalized
transform<br>
</font><font face="Courier New, Courier">var trans =
XSIMath.CreateTransform;<br><br>
</font><font face="Courier New, Courier" color="#008000">// Loop through
the selection<br>
</font><font face="Courier New, Courier">for(var e = new
Enumerator(selection); !e.atEnd(); e.moveNext()){<br><br>
&nbsp;&nbsp;&nbsp;
</font><font face="Courier New, Courier" color="#008000">// For each obj,
add a null<br>
</font><font face="Courier New, Courier">&nbsp;&nbsp;&nbsp; var obj =
e.item();<br>
&nbsp;&nbsp;&nbsp; var node = obj.AddNull(obj.name + '_NUL');<br><br>
&nbsp;&nbsp;&nbsp;
</font><font face="Courier New, Courier" color="#008000">// Transform the
null to rest pose<br>
</font><font face="Courier New, Courier">&nbsp;&nbsp;&nbsp;
node.kinematics.local.transform = trans;<br>
}<br><br>
<br><br>
</font><blockquote type=cite class=cite cite=""><font face="arial" size=2>From
the online help: <br>
(select a word in your script and click the ? button in the script
editor, it ll give your the appropriate info)<br>
</font><font face="arial">&nbsp;<br>
</font><font face="arial" size=2>Scripting Syntax <br>
GetPrim (PresetObj, [Name], [Parent], [Primitive])<a name="wp659811"></a>
<br>
</font><font face="arial">&nbsp;<br>
&nbsp;<br>
</font><font face="arial" size=2>so the&nbsp;
</font><font face="courier" size=2>GetPrim
&quot;Null&quot;</font><font face="arial" size=2> line would become
something like:<br>
GetPrim &quot;Null&quot; , nill &amp; &quot;_null&quot;<br>
</font><font face="arial">&nbsp;<br>
</font><font face="arial" size=2>now there is also the MatchTransform
command, <br>
that will allow to match the transforms of the null to the object, <br>
to avoid doing a constraint and then removing it<br>
and then the ParentObj command to do the parenting. <br>
Something like: <br>
</font><font face="arial">&nbsp;<br>
</font><font face="arial" size=2>-- ------<br>
set A=GetValue(&quot;SelectionList&quot;) <br>
&nbsp;&nbsp;&nbsp; for each ab in A <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetPrim &quot;Null&quot;, ab
&amp; &quot;_null&quot; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MatchTransform , ab,
siSRT<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ParentObj ab &amp;
&quot;_null&quot;, ab <br>
&nbsp;&nbsp;&nbsp; next<br>
-- ---- --<br>
&nbsp;<br>
that should do the trick. <br>
You didnt want any constraints in the end right?<br>
&nbsp;<br>
Peter<br>
&nbsp;<br><br>
</font><h4><b>&nbsp;</b></h4><font size=2><br><br>
</font><font face="arial" size=2><br>
<b><br>
&nbsp;</b></font><font face="arial"><br><br>
</font>
<dl>
<dd>-- -- Original Message -- -- <br>

<dd>From:</b> <a href="mailto:lee.hallett@(protected)">Lee Hallett</a>
<br>

<dd>To:</b> <a href="mailto:XSI@(protected)">XSI@(protected)</a> <br>

<dd>Sent:</b> Thursday, April 14, 2005 2:11 PM<br>

<dd>Subject:</b> Basic scripting question..<br><br>

<dd><font face="arial" size=2>I'm trying to modify matts nullifier script, but
my scripting is somewhat below par (non existent). <br>
</font><br>

<dd><font face="arial" size=2>The two extra things I need to do are</font> <br>

<dd><font face="arial" size=2>1) Make the null the parent of the object</font>
<br>

<dd><font face="arial" size=2>2) Rename the null to *Objectname*_Null</font>
<br><br>

<dd><font face="arial" size=2>Anyone got any quick tips!!</font> <br><br>

<dd><font face="arial" size=2>Original script:</font> <br><br>

<dd><font face="courier" size=2>' nullifier v1.1 by Matt Lowery</font> <br><br>

<dd><font face="courier" size=2>Dim A</font> <br>

<dd><font face="courier" size=2>Dim nul</font> <br>

<dd><font face="courier" size=2>Dim B</font> <br><br>

<dd><font face="courier" size=2>set A=GetValue(&quot;SelectionList&quot;)</font
> <br>

<dd><font face="courier" size=2>for each ab in A</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="courier" size=2
>GetPrim &quot;Null&quot;</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="courier" size=2>set
nul=GetValue(&quot;SelectionList&quot;)</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="courier" size=2>for
each nil in nul</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <font face="courier" size=2>ApplyCns &quot;Pose&quot;,nil,ab<
/font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <font face="courier" size=2>Duplicate nil</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <font face="courier" size=2>DeleteObj nil</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="courier" size=2>next
</font><br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="courier" size=2>set
B=GetValue(&quot;SelectionList&quot;)</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <font face="courier" size=2>for each ba in B</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face=
"courier" size=2>RemoveAllCns ba</font> <br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face=
"courier" size=2>ApplyCns &quot;Pose&quot;, ab, ba&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; </font><br>

<dd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <font face="courier" size=2>next</font> <br>

<dd><font face="courier" size=2>next</font> <br><br>
<div align="center">
<dd><font face="arial" size=2>Lee|3d animation and design..</font></div>
<div align="center">
<dd><font face="arial" size=2>Pixel pusher &amp; 'telly colouring in' bloke<
/font></div>
<br>
<div align="center">
<dd><font face="arial" size=1>There are only 10 sorts of people in the World -
those that understand binary, and those that don't.<br>
</font></div>

<dd><font face="Courier New, Courier">&nbsp;</font><font face="wingdings" size
=2>*</font><font face="tahoma"> </font><font face="tahoma" size=1>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; BBC Wales | C4 graphics area | Broadcasting House| Llandaff,
Cardiff. CF5 2QY.</font> </b>
<dd><font face="Courier New, Courier">&nbsp;</font><font face="wingdings" size
=2>(</b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="tahoma" size=1> +44 (0
)29 203 23370</font>
<dd><font face="arial" size=2>e-</font><font face="wingdings" size=2>*</font>
<font face="Courier New, Courier">&nbsp;&nbsp;&nbsp; </font> <font face="arial"
size=1>lee.hallett@(protected)</font> <br>
<br><br><br>

<dd><a href="http://www.bbc.co.uk/" eudora="autourl">http://www.bbc.co.uk/</a>
<br><br>

<dd>This e-mail (and any attachments) is confidential and may contain<br>

<dd>personal views which are not the views of the BBC unless specifically<br>

<dd>stated.<br>

<dd>If you have received it in error, please delete it from your system. <br>

<dd>Do not use, copy or disclose the information in any way nor act in<br>

<dd>reliance on it and notify the sender immediately. Please note that the<br>

<dd>BBC monitors e-mails sent or received. <br>

<dd>Further communication will signify your consent to this. <br>

</dl></blockquote></body>
</html>