<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: rd: Kinda Sorta</title>
	<atom:link href="http://www.redefinery.com/blog/20070818_rd-kinda-sorta/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redefinery.com/blog/20070818_rd-kinda-sorta/</link>
	<description>refine+definition+factory = where ideas go to be refined</description>
	<lastBuildDate>Tue, 31 Jan 2012 01:16:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: nab</title>
		<link>http://www.redefinery.com/blog/20070818_rd-kinda-sorta/comment-page-1/#comment-229</link>
		<dc:creator>nab</dc:creator>
		<pubDate>Tue, 21 Aug 2007 22:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.redefinery.com/blog/20070818_rd-kinda-sorta/#comment-229</guid>
		<description>Today I sent you a gift at Adobe Seattle to excuse my irreverent attitude :-)</description>
		<content:encoded><![CDATA[<p>Today I sent you a gift at Adobe Seattle to excuse my irreverent attitude <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: redefinery</title>
		<link>http://www.redefinery.com/blog/20070818_rd-kinda-sorta/comment-page-1/#comment-222</link>
		<dc:creator>redefinery</dc:creator>
		<pubDate>Tue, 21 Aug 2007 05:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.redefinery.com/blog/20070818_rd-kinda-sorta/#comment-222</guid>
		<description>yeah, Selected Layers mode should be treated separately (and sort/randomize w/o changing indices), but i&#039;ll leave that work for another day. Selected Layers mode was more a &#039;freebie&#039;. whether it&#039;s useful is another issue. :-)

it&#039;s definitely cool that you&#039;re providing feedback in my comments. i appreciate it. keeps me honest. :-) i&#039;m trying to learn this stuff as well. and don&#039;t worry, i like to keep things light/irreverent around here. (Que Es Span Null, anyone? :-) )</description>
		<content:encoded><![CDATA[<p>yeah, Selected Layers mode should be treated separately (and sort/randomize w/o changing indices), but i&#8217;ll leave that work for another day. Selected Layers mode was more a &#8216;freebie&#8217;. whether it&#8217;s useful is another issue. <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>it&#8217;s definitely cool that you&#8217;re providing feedback in my comments. i appreciate it. keeps me honest. <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  i&#8217;m trying to learn this stuff as well. and don&#8217;t worry, i like to keep things light/irreverent around here. (Que Es Span Null, anyone? <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nab</title>
		<link>http://www.redefinery.com/blog/20070818_rd-kinda-sorta/comment-page-1/#comment-221</link>
		<dc:creator>nab</dc:creator>
		<pubDate>Tue, 21 Aug 2007 04:53:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.redefinery.com/blog/20070818_rd-kinda-sorta/#comment-221</guid>
		<description>I forgot to mention that my snippet was for the &quot;All layers in Comp&quot; mode.
In the initial script the random range covers the whole set of indices, so randomizing only the selected layers makes no sense to me...since a non-selected layer can be swapped as well (when a selected layer takes its place in the stack).
If you want to randomize the selected layers only, you would have to generate random indices among the selected indices, not the whole set
(treat the two cases separately).

I don&#039;t think Math.random() can hit 1 (this snippet might convince you http://www.nabscripts.com/Forum/Scripts/rd_test.txt ) but it&#039;s always hard  to check these sort of things in practice.

You are my &quot;scripting teacher&quot; (or guru if you prefer), I wasn&#039;t blaming you :-) ! just a little suggestion with a bit of humor to participate in your blog.</description>
		<content:encoded><![CDATA[<p>I forgot to mention that my snippet was for the &#8220;All layers in Comp&#8221; mode.<br />
In the initial script the random range covers the whole set of indices, so randomizing only the selected layers makes no sense to me&#8230;since a non-selected layer can be swapped as well (when a selected layer takes its place in the stack).<br />
If you want to randomize the selected layers only, you would have to generate random indices among the selected indices, not the whole set<br />
(treat the two cases separately).</p>
<p>I don&#8217;t think Math.random() can hit 1 (this snippet might convince you <a href="http://www.nabscripts.com/Forum/Scripts/rd_test.txt" rel="nofollow">http://www.nabscripts.com/Forum/Scripts/rd_test.txt</a> ) but it&#8217;s always hard  to check these sort of things in practice.</p>
<p>You are my &#8220;scripting teacher&#8221; (or guru if you prefer), I wasn&#8217;t blaming you <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ! just a little suggestion with a bit of humor to participate in your blog.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: redefinery</title>
		<link>http://www.redefinery.com/blog/20070818_rd-kinda-sorta/comment-page-1/#comment-220</link>
		<dc:creator>redefinery</dc:creator>
		<pubDate>Tue, 21 Aug 2007 03:05:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.redefinery.com/blog/20070818_rd-kinda-sorta/#comment-220</guid>
		<description>&lt;p&gt;hey nab... ya gotta cut me some slack for posting a script late on a friday night. besides, haven&#039;t you read the disclaimer that i put in each script: &quot;In other words, I&#039;m just trying to share knowledge with and help out my fellow AE script heads, so don&#039;t blame me if my code doesn&#039;t rate. :-)&quot;? :-), indeed.&lt;/p&gt;
&lt;p&gt;i think i was using the original code because the reference for Math.random() i had used said it wouldn&#039;t hit 1, but checking a more authoritative source, it can.&lt;/p&gt;
&lt;p&gt;i tried your snippet (thanks for that!), but couldn&#039;t get it to place layers at the top/bottom when using Selected Layers in Comp mode. here&#039;s a proposed solution that should handle situations 1 and 2 a little better...&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;blog&quot;&gt;var lIndex;&lt;br /&gt;
for (var i=0; i&lt;layers.length; i++)&lt;br /&gt;
{&lt;br /&gt;
    do&lt;br /&gt;
    {&lt;br /&gt;
        lIndex = 1 + Math.round(Math.random() * (comp.numLayers - 1));&lt;br /&gt;
    }&lt;br /&gt;
    while (lIndex == layers[i].index);&lt;br /&gt;
    if (Math.random() &gt; 0.5)&lt;br /&gt;
        layers[i].moveBefore(comp.layer(lIndex));&lt;br /&gt;
    else&lt;br /&gt;
        layers[i].moveAfter(comp.layer(lIndex));&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;what do you think?&lt;/p&gt;
&lt;p&gt;(and, yes, i am often surprised/embarrassed at where i find snippets of my code.)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>hey nab&#8230; ya gotta cut me some slack for posting a script late on a friday night. besides, haven&#8217;t you read the disclaimer that i put in each script: &#8220;In other words, I&#8217;m just trying to share knowledge with and help out my fellow AE script heads, so don&#8217;t blame me if my code doesn&#8217;t rate. <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> &#8221;? <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> , indeed.</p>
<p>i think i was using the original code because the reference for Math.random() i had used said it wouldn&#8217;t hit 1, but checking a more authoritative source, it can.</p>
<p>i tried your snippet (thanks for that!), but couldn&#8217;t get it to place layers at the top/bottom when using Selected Layers in Comp mode. here&#8217;s a proposed solution that should handle situations 1 and 2 a little better&#8230;</p>
<p><code class="blog">var lIndex;<br />
for (var i=0; i&lt;layers.length; i++)<br />
{<br />
    do<br />
    {<br />
        lIndex = 1 + Math.round(Math.random() * (comp.numLayers - 1));<br />
    }<br />
    while (lIndex == layers[i].index);<br />
    if (Math.random() > 0.5)<br />
        layers[i].moveBefore(comp.layer(lIndex));<br />
    else<br />
        layers[i].moveAfter(comp.layer(lIndex));<br />
}<br />
</code></p>
<p>what do you think?</p>
<p>(and, yes, i am often surprised/embarrassed at where i find snippets of my code.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nab</title>
		<link>http://www.redefinery.com/blog/20070818_rd-kinda-sorta/comment-page-1/#comment-217</link>
		<dc:creator>nab</dc:creator>
		<pubDate>Mon, 20 Aug 2007 23:36:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.redefinery.com/blog/20070818_rd-kinda-sorta/#comment-217</guid>
		<description>Time for brainstorming :-)
May I suggest this snippet for the &quot;random order&quot;, slight modification inside the loop (how to put a link ? http://www.nabscripts.com/Forum/Scripts/rd_order.txt )
Your code generates random indices within the range [0,numLayers] which is not convenient if you use moveBefore and moveAfter.
As you probably noticed, for a given layer there exists two situations that pop up an error: when the generated index 1) is not within the valid range, 2) is the same as the current layer index.
2) is okay as soon as we add an additional &quot;if&quot; statement, and we can avoid 1). Then the try...catch is not necessary anymore as we are sure there won&#039;t be any errors and we produce in the same time a &quot;more random&quot; stack.
Be careful Jeff, script junkies are watching you :-)</description>
		<content:encoded><![CDATA[<p>Time for brainstorming <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
May I suggest this snippet for the &#8220;random order&#8221;, slight modification inside the loop (how to put a link ? <a href="http://www.nabscripts.com/Forum/Scripts/rd_order.txt" rel="nofollow">http://www.nabscripts.com/Forum/Scripts/rd_order.txt</a> )<br />
Your code generates random indices within the range [0,numLayers] which is not convenient if you use moveBefore and moveAfter.<br />
As you probably noticed, for a given layer there exists two situations that pop up an error: when the generated index 1) is not within the valid range, 2) is the same as the current layer index.<br />
2) is okay as soon as we add an additional &#8220;if&#8221; statement, and we can avoid 1). Then the try&#8230;catch is not necessary anymore as we are sure there won&#8217;t be any errors and we produce in the same time a &#8220;more random&#8221; stack.<br />
Be careful Jeff, script junkies are watching you <img src='http://www.redefinery.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

