<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>code.twobrained.com</title>
	<atom:link href="http://code.twobrained.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.twobrained.com</link>
	<description>Free Code Assets Just for You From Two Brained</description>
	<lastBuildDate>Sun, 04 Apr 2010 21:04:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Free Adobe Flash Platform Technologies</title>
		<link>http://code.twobrained.com/26/free-adobe-flash-platform-technologies/</link>
		<comments>http://code.twobrained.com/26/free-adobe-flash-platform-technologies/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 21:02:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flash technology]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://code.twobrained.com/?p=26</guid>
		<description><![CDATA[Adobe has a new program where they make free copies of Adobe Flash Builder 4 available to:1 Students, faculty and staff of eligible educational institutions Software developers who are affected by the current economic condition and are currently unemployed Event attendees who receive a special promotional code at their event If you find yourself in [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe has a new program where they make free copies of Adobe Flash Builder 4 available to:<sup><a href="#26_ref1">1</a></sup></p>
<blockquote>
<ul>
<li>Students, faculty and staff of eligible educational institutions</li>
<li>Software developers who are affected by the current economic condition and are currently unemployed</li>
<li>Event attendees who receive a special promotional code at their event</li>
</ul>
</blockquote>
<p>If you find yourself in this situation, this is a great chance to start learning ActionScript and the Flex component framework.   Here at <a href="http://twobrained.com">Two Brained Consultants</a>, our experience has generally been that Flash Builder 4 is much nicer to use than Flex Builder 3.</p>
<h4>References</h4>
<ol>
<li>Free Adobe Flash Platform Technologies <a name="26_ref1" href="http://www.adobe.com/devnet/flex/free/index.html">http://www.adobe.com/devnet/flex/free/index.html</a> Accessed April 4, 2010.</li>
</ol>
<h3 class='related_post_title'>Possibly Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://code.twobrained.com/11/papervision3d-development-note-1-accessing-materials-on-collada-meshes/' title='Papervision3D Development Note 1: Accessing Materials on Collada Meshes'>Papervision3D Development Note 1: Accessing Materials on Collada Meshes</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://code.twobrained.com/26/free-adobe-flash-platform-technologies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Papervision3D Development Note 1: Accessing Materials on Collada Meshes</title>
		<link>http://code.twobrained.com/11/papervision3d-development-note-1-accessing-materials-on-collada-meshes/</link>
		<comments>http://code.twobrained.com/11/papervision3d-development-note-1-accessing-materials-on-collada-meshes/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 21:33:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Collada]]></category>
		<category><![CDATA[Maya]]></category>
		<category><![CDATA[mesh object]]></category>
		<category><![CDATA[Papervision3D]]></category>

		<guid isPermaLink="false">http://code.twobrained.com/?p=11</guid>
		<description><![CDATA[Two days lost, but not entirely wasted. I have been trying to figure out how to change the material of a mesh object imported into a Papervision3D scene graph as part of a Collada 4.1.1 scene that I had exported from Maya. No matter what I tried, I could not change the material for an [...]]]></description>
			<content:encoded><![CDATA[<p>Two days lost, but not entirely wasted.   I have been trying to figure out how to change the material of a mesh object imported into a <a href="http://blog.papervision3d.org/" target="blank_">Papervision3D</a><a> scene graph as part of a </a><a href="https://collada.org/mediawiki/index.php/COLLADA_-_Digital_Asset_and_FX_Exchange_Schema" target="blank_">Collada</a> 4.1.1 scene that I had exported from <a href="http://usa.autodesk.com/adsk/servlet/pc/index?siteID=123112&amp;id=13577897" target="blank_">Maya</a>.  No matter what I tried, I could not change the material for an individual mesh object at run time.  I was using all the provided methods with no luck.  For example, the one that should do the the trick is:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dae.getChildByName(&quot;COLLADA_Scene&quot;).getChildByName(meshName).replaceMaterialByName(new ColorMaterial, materialName);</div></td></tr></tbody></table></div>
<p>(dae is a DAE object; meshName is the string name of the mesh in the collada scene whose material you want to change, and materialName is the string name of the material you want to replace)</p>
<p>But no go.  The strange thing was that I could print the list of materials that I had imported from the Collada file by using:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">for (var name:String in dae.materials.materialsByName){<br />
trace(dae.materials.getMaterialByName(name).toString());<br />
}</div></td></tr></tbody></table></div>
<p>Whats more, the materials (BitmapFileMaterials in my case) loaded fine onto the meshes and were visible when the program ran (e.g., see previous post).  But there seemed no way to access those materials once the program was running.  There seemed to be no accessible references between the material list for the scene and the individual meshes in the scene.</p>
<p>So, I dug into the most recent version of <a href="http://code.google.com/p/papervision3d/source/browse/trunk/as3/trunk/src/org/papervision3d/objects/parsers/DAE.as?r=911" target="blank_">DAE.as class</a> from Papervision3D.  And what did I find: The materials are applied to each of the individual triangles in your mesh (I am assuming that your mesh was triangulated during Collada file creation, so lines 1442-1461 in the <a href="http://code.google.com/p/papervision3d/source/browse/trunk/as3/trunk/src/org/papervision3d/objects/parsers/DAE.as?r=911" target="blank_">DAE.as file</a><a></a> holds the relevant code) but not to the object as a whole.  So, while the mesh object has no record of its material, each of the individual triangles of the mesh do.  Still, there seems to be no reference from the main materials list for the DAE object to these triangles; because changing the material in the main materials list has no effect on the rendered scene.  So: What to do?</p>
<p>The first solution I thought of was to write a function for swapping the material of a mesh object on a triangle per triangle basis.  What follows is a functional but very simple version, without the desirable checks for nulls:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">public static function swapObjectMaterials(dae:DAE, objectName:String, material:MaterialObject3D):void{<br />
var length:int = dae.getChildByName(&quot;COLLADA_Scene&quot;).getChildByName(objectName).geometry.faces.length;<br />
for (var i:int = 0; i &amp;lt; length; i++){<br />
Triangle3D(dae.getChildByName(&quot;COLLADA_Scene&quot;).getChildByName(objectName).geometry.faces[i]).material = material;<br />
}<br />
}</div></td></tr></tbody></table></div>
<p>That is all you need to fix this problem (well, it fixed it for me).</p>
<p>The better solution would be to fix the load of the DAE object so that there remains a reference between the main materials list and the individual triangle meshes, such that changing a member of the materials list changes that material on each of the individual triangles.  Time permitting, that should be done within the next couple of weeks.</p>
<p>From a design perspective, it makes perfect sense to apply the materials on a per-triangle-face basis in order to conserve any uv mapping that was done in your modelling program; still, the reference issue needs fixing.</p>
<p>As an endnote: Having fixed the above problem, I ran into another problem.  I had been interested in swapping a BitmapFileMaterial with a texture for a MovieMaterial.  While the above function swapped them,  the uv mapping was conserved such that the new MovieMaterial was applied with the old uv coordinates.  I fixed that problem too&#8230;stay tuned for when I have some more writing time.<br />
<h3 class='related_post_title'>Possibly Related Posts:</h3>
<ul class='related_post'>
<li><a href='http://code.twobrained.com/26/free-adobe-flash-platform-technologies/' title='Free Adobe Flash Platform Technologies'>Free Adobe Flash Platform Technologies</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://code.twobrained.com/11/papervision3d-development-note-1-accessing-materials-on-collada-meshes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Welcome to CODE.TWOBRAINED.COM &#8212; Your Source for Free Code Assets</title>
		<link>http://code.twobrained.com/1/welcome-to-code_twobrained_com/</link>
		<comments>http://code.twobrained.com/1/welcome-to-code_twobrained_com/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 17:24:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[first post]]></category>
		<category><![CDATA[Two Brained]]></category>
		<category><![CDATA[welcome]]></category>

		<guid isPermaLink="false">http://code.twobrained.com/?p=1</guid>
		<description><![CDATA[Welcome to CODE.TWOBRAINED.COM! On this site you&#8217;ll find code assets that you can use absolutely free (no-strings attached) in your personal or commercial software projects, courtesy of Two Brained. The code assets will be from a wide variety of programming languages, frameworks, libraries, and APIs, including but not limited to ActionScript, Flex, JavaScript, PHP, MySQL, [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to CODE.TWOBRAINED.COM!  On this site you&#8217;ll find code assets that you can use absolutely free (no-strings attached) in your personal or commercial software projects, courtesy of <a href="http://www.twobrained.com/" title="Two Brained Consultants">Two Brained</a>.  The code assets will be from a wide variety of programming languages, frameworks, libraries, and APIs, including but not limited to ActionScript, Flex, JavaScript, PHP, MySQL, HTML, CSS, Google Maps API, Java, C++, and AppleScript.  Be sure to leave your comments on ways we can improve the code assets presented on this site.  We hope you&#8217;ll find this site a valuable resource in your programming work and play.<br />
<h3 class='related_post_title'>Possibly Related Posts:</h3>
<ul class='related_post'>
<li>Sorry, no possibly related posts found.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://code.twobrained.com/1/welcome-to-code_twobrained_com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
