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?
 
FX tree : Select file input node only

FX tree : Select file input node only

2005-06-15       - By Guillaume Laforge

 Back
Reply:     1     2     3     4     5  

When I write some scripts to learn I often use "XSI collection" but in a
deadline I forget my new knowledge :-)
Thanks kim !


2005/6/15, kim aldis <kim@(protected)>:
>
> you're looping through a list of items but changing that list as you loop
> through it so it's count and item order is changing as you go. There's a few
> ways to deal with this, either push the items you want to delete onto an
> array in the main loop then delete the items in that array after the loop,
> or make a copy of the selection first and loop through that.
>  Try this:-
>  var oColl = new ActiveXObject( "XSI.Collection" );
> oColl.items = selection; // selected items into collection
>  // loop through the collection. No reason not to use a traditional
> integer loop for this but this is faster.
> //
> for ( var f=new Enumerator( oColl ); !f.atEnd(); f.moveNext() ) {
>  var oItem = f.item();
>  if ( oItem.type != "FileInputOp" ) {
>  removefromselection( oItem );
>  }
> }
>
>  -- ---- ---- ---- ---- ---- --
> *From:* owner-xsi@(protected) [mailto:owner-xsi@(protected)] *On
> Behalf Of *guillaume laforge
> *Sent:* 15 June 2005 10:05
> *To:* XSI@(protected)
> *Subject:* FX tree : Select file input node only
>
>   Hi List,
>  
> I need to select all the file input nodes from a fxtree.
> The script I write below seems to remove randomly some nodes ???
> I don't understand why ?
>
> //All the Fx tree nodes are selected.
> var oSel = Selection;
> for(i=0;i<oSel.count;i++)
> if(oSel(i).type != "FileInputOp")
> {
> RemoveFromSelection(oSel(i))
> }
> logmessage("only file input nodes are selected !")
>
> Any idea ?
>
> Cheers,
>
> Guillaume Laforge
> CG artist
> www.vol2nuit.fr <http://www.vol2nuit.fr/>
>
>

<div>When I write some&nbsp;scripts to learn&nbsp;I often use &quot;XSI
collection&quot; but in a deadline I forget my new knowledge :-)</div>
<div>Thanks kim !</div>
<div><br><br>&nbsp;</div>
<div><span class="gmail_quote">2005/6/15, kim aldis &lt;<a href="mailto:kim
@(protected)">kim@(protected)</a>&gt;:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0
.8ex; BORDER-LEFT: #ccc 1px solid">
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"
>you're looping through a list of items but changing that list as you loop
through it so it's count and item order&nbsp;is changing as you go. There's a
few ways to deal with this, either push the items you want to delete onto an
array in the main loop then delete the items in that array after the loop, or
make a copy of the selection first and loop through that.
</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"><
/font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"
>Try this:-</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"><
/font></span>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"
>var oColl = new ActiveXObject( &quot;XSI.Collection&quot; );<br>oColl.items =
selection;&nbsp;&nbsp;&nbsp; // selected items into collection</font></span><
/div>

<div><font face="Arial" color="#0000ff" size="2"></font>&nbsp;</div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">/
/ loop through the collection. No reason not to use a traditional integer loop
for this but this is faster.</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">/
/<br>for ( var f=new Enumerator( oColl ); !f.atEnd(); f.moveNext() ) {</font><
/span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">
&nbsp;&nbsp;&nbsp; var oItem = f.item();</font></span></div>
<div dir="ltr" align="left"><span>&nbsp;&nbsp;&nbsp; <font face="Arial" color="
#0000ff" size="2">if ( oItem.type != &quot;FileInputOp&quot; ) {</font></span><
/div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; removefromselection( oItem );</font><
/span></div>
<div dir="ltr" align="left"><span>&nbsp;&nbsp;&nbsp; <font face="Arial" color="
#0000ff" size="2">}</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">}
</font></span></div><br>
<blockquote dir="ltr" style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT:
#0000ff 2px solid; MARGIN-RIGHT: 0px">
<div lang="en-us" dir="ltr" align="left">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a onclick="return top.js.OpenExtLink
(window,event,this)" href="mailto:owner-xsi@(protected)" target="_blank">owner
-xsi@(protected)</a> [mailto:<a onclick="return top.js.OpenExtLink(window
,event,this)" href="mailto:owner-xsi@(protected)" target="_blank">
owner-xsi@(protected)</a>] <b>On Behalf Of </b>guillaume laforge<br><b>Sent:<
/b> 15 June 2005 10:05<br><b>To:</b> <a onclick="return top.js.OpenExtLink
(window,event,this)" href="mailto:XSI@(protected)" target="_blank">
XSI@(protected)</a><br><b>Subject:</b> FX tree : Select file input node only
<br></font><br>&nbsp;</div>
<div><span class="e" id="q_1047f547a1207bdc_1">
<div></div>
<div>Hi List,</div>
<div><font size="2">
<p>I need to select all the file input nodes from a fxtree. <br>The script I
write below&nbsp;seems to&nbsp;remove randomly some nodes ???<br>I don't
understand why ?</p>
<p>//All the Fx tree nodes are selected.<br>var oSel = Selection;<br>for(i=0;i
&lt;oSel.count;i++)<br>if(oSel(i).type != &quot;FileInputOp&quot;)<br>{<br
>RemoveFromSelection(oSel(i))<br>}<br>logmessage(&quot;only file input nodes are
selected !&quot;)
</p>
<p>Any idea ?</p>
<p>Cheers,</p>
<p>Guillaume Laforge<br>CG&nbsp;artist<br><a onclick="return top.js.OpenExtLink
(window,event,this)" href="http://www.vol2nuit.fr/" target="_blank">www.vol2nuit
.fr</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p></font></div></span></div></blockquote></blockquote></div><br>