<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Forum - Importing Assets - ASE importer link - Messages</title>
<link>http://www.muvizu.com/Forum/topic2598-ase-importer-link.aspx</link>
<description>Forum - Importing Assets - ASE importer link - Messages</description>
<language>en-us</language>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>Jitbit AspNetForum</generator>
<pubDate>Thu, 28 Mar 2013 22:35:25 GMT</pubDate>
<lastBuildDate>Thu, 28 Mar 2013 22:35:25 GMT</lastBuildDate>
<item>
<link>http://www.muvizu.com/Forum/topic2598-ase-importer-link.aspx</link>
<title>Message from LULU153</title>
<description><![CDATA[many thanks again! <img src="images/smilies/smile.gif" border=0 />]]></description>
<pubDate>Thu, 28 Mar 2013 22:35:25 GMT</pubDate>
</item>
<item>
<link>http://www.muvizu.com/Forum/topic2598-ase-importer-link.aspx</link>
<title>Message from ziggy72</title>
<description><![CDATA[Actually Lulu, all my .rb files show up with white icons too.  You only get an icon on a file if Windows knows what kind of file it is, and Windows doesn't usually 'get' .rb files.  Regardless, copy it into your plugins folder, it will work all the same because Sketchup knows what kind of file it is (icon or not).]]></description>
<pubDate>Thu, 28 Mar 2013 21:41:06 GMT</pubDate>
</item>
<item>
<link>http://www.muvizu.com/Forum/topic2598-ase-importer-link.aspx</link>
<title>Message from urbanlamb</title>
<description><![CDATA[I just opened it the file is not blank.   <br/>  <br/> right click "save link as" <br/>  <br/> and then if you want to see it open it up in notepad but it does work <img src="images/smilies/smile.gif" border=0 /> <br/>  <br/> here is the code I dont know how successful you will be copying and pasting and resaving it but its there if you want to try. <br/>  <br/>  <br/>  <br/> # <br/> # Muvizu-ASE-Exporter.rb <br/> # 2010/09/18 - RUBY <br/> # <br/> #------------------------------------------------------------------------------------------- <br/> # <br/> # This program (plugin) is based on original work by Raphael Couturier (HardPCM). It has been <br/> # modified, under the terms of the GNU Lesser General Public License, all changes made have <br/> # been with a goal in mind; optimising the original ASE export feature from HardPCM for use <br/> # with Muvizu (http://www.muvizu.com). <br/> # <br/> #------------------------------------------------------------------------------------------- <br/> # <br/> # This program is free software; you can redistribute it and/or modify it under <br/> # the terms of the GNU Lesser General Public License as published by the Free Software <br/> # Foundation; either version 2 of the License, or (at your option) any later <br/> # version. <br/> # <br/> # This program is distributed in the hope that it will be useful, but WITHOUT <br/> # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS <br/> # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. <br/> # <br/> # You should have received a copy of the GNU Lesser General Public License along with <br/> # this program; if not, write to the Free Software Foundation, Inc., 59 Temple <br/> # Place - Suite 330, Boston, MA 02111-1307, USA, or go to <br/> # <a href="http://www.gnu.org/copyleft/lesser.txt." target="_blank" rel="nofollow">http://www.gnu.org/copyleft/lesser.txt.</a> <br/> # <br/> #------------------------------------------------------------------------------------------- <br/> # <br/> # Original Auther - Raphael Couturier (HardPCM) - hardpcm666@hotmail.com, hardpcm666@gmail.com <br/> # Updated by - Jamie Hill (CerebralDump) - jamie@muvizu.com <br/> # <br/> # File: MuvizuASEExporter.rb <br/> # Version: 0.0.8 <br/> # Started: 01/09/10 <br/> # Released: - <br/> # Langage: English <br/> # <br/> # Description: Main Source for a Google Sketchup Plugin that allows you to export <br/> #                   ASE files specifically for Muvizu, which uses the Unreal 3 games engine. <br/> # <br/> #------------------------------------------------------------------------------------------- <br/> # <br/> # Special thanks to: <br/> # <br/> #   - Raphael Couturier (HardPCM) for the original work. <br/> # <br/> #   - Jim Skivington for testing the early attempts and the changes.  <br/> # <br/> #------------------------------------------------------------------------------------------- <br/> # Change List / History <br/> # <br/> # 0.0.1 - Write out texture filename and path for ASE submaterial tag *BITMAP "..." <br/> # 0.0.2 - Generate collision mesh automatically. Copy geometry into another GEOMODEL object prefixing object name with UCX. Collision was too complex. <br/> # 0.0.3 - Removed non-essential parts for Muvizu input (import, and all export except ASE functions). <br/> # 0.0.4 - Limited output to components only. Remove all handling of groups. <br/> # 0.0.5 - UI to allow selection of one component as geometry and one component as collision. <br/> # 0.0.6 - Renamed classes and methods to avoid dependency or interfearance with the original plugin. <br/> # 0.0.7 - Refined UI to reduce and report errors. <br/> # 0.0.8 - Updated about text and source comments for completeness. <br/> # <br/> #------------------------------------------------------------------------------------------- <br/>  <br/> require 'sketchup.rb' <br/>  <br/> class WalkerWaitT3D_UTX <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def initialize <br/> 		@m_nIndex = 0 <br/> 		@m_sTable =  <br/> 	end <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def Tick(nLevel = 1) <br/>     # Show step <br/> 		a_sText = "Processing at level No = #{"%0.f" %(nLevel)}       \"O.{#{@m_sTable}}.O\" \n" <br/> 		code = Sketchup.set_status_text a_sText <br/>      <br/> 		# Next step <br/> 		@m_nIndex += 1 <br/> 		if @m_nIndex &gt;= 8 <br/> 			@m_nIndex = 0; <br/> 		end <br/> 	end <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def Say(sMessage) <br/> 		code = Sketchup.set_status_text sMessage <br/> 	end <br/> end <br/>  <br/>  <br/> class IteratorerDataT3D_UTX <br/>  <br/> # Updated: 24-September-2010 <br/> 	def initialize(pFirstNode = nil, pProcessorNode = nil, bFirstNode = nil, bProcessorNode = nil, thePath = "") <br/>     # Populate the instance variables to process the sketchup model into ASE format. <br/> 		@m_pProcessorNodeCol = pProcessorNode <br/> 		@m_pFirstNode = pFirstNode <br/>      <br/>     # Expect to have collision by default. <br/>     @m_hasCollision = true <br/>      <br/>     # Get the names of the components exported for later reporting. <br/>     @m_theModelName = pFirstNode.definition.name <br/>     @m_theSavePath = thePath <br/>      <br/>     # Check if there is collision geometry to be generated as well. <br/>     if bFirstNode != nil <br/>       @m_bProcessorNodeCol = bProcessorNode <br/>       @m_bFirstNode = bFirstNode <br/>       @m_theCollisionName = bFirstNode.definition.name <br/>     else <br/>       # No collision. <br/>       @m_hasCollision = false <br/>     end <br/>      <br/>     # Prepare the material lists. <br/> 		@m_pMaterials =  <br/> 		@m_pMaterials.push(nil) <br/> 		@m_bMaterialsChanged = false <br/>      <br/>     # Prepare transforms - not sure why anything needs to be transformed... <br/> 		@m_Transformations =  <br/> 		@m_Transformations.push(Geom::Transformation.new) <br/>      <br/>     # Set level to begin processing at. <br/> 		@m_nLevel = 1 <br/>      <br/>     # Start the wait walker to update the status bar text. <br/> 		@m_pWalker = WalkerWaitT3D_UTX.new <br/> 	end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def Start() <br/>     # Process the geometry model. <br/> 		self.Process(@m_pFirstNode, @m_pFirstNode, @m_pProcessorNodeCol) <br/>      <br/>     if @m_hasCollision == true <br/>       # If selected process the collision model. <br/>       self.Process(@m_bFirstNode, @m_bFirstNode, @m_bProcessorNodeCol) <br/>     end <br/>      <br/>     # Write to file. <br/> 		@m_pProcessorNodeCol.WriteHeader <br/>     @m_pProcessorNodeCol.WriteMaterials <br/>     @m_pProcessorNodeCol.WriteGeometry <br/>     if @m_hasCollision == true <br/>       @m_bProcessorNodeCol.WriteCollision <br/>     end <br/>      <br/>     # Finished! <br/> 		@m_pWalker.Say("Job Done - Model exported!") <br/>     theEndMessage = "" <br/>     if @m_hasCollision == true <br/>       theEndMessage = "Collision geometry exported from component #{"%s" %(@m_theCollisionName)}\n\n" <br/>     else <br/>       theEndMessage = "No collision geometry exported. Muvizu will create this on import.\n\n" <br/>     end <br/>     UI.messagebox "#{"%s" %(theEndMessage)} Geometry model exported from component #{"%s" %(@m_theModelName)}\n\nFile saved to #{"%s" %(@m_theSavePath)}" <br/> 	end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def Process(pCurrentNode, pParent, theProcessor) <br/>  <br/>     # Explode components or groups so we can process each face within it. <br/> 		if(pCurrentNode.class == Sketchup::Group) <br/> 			pCurrentNode = pCurrentNode.entities  <br/> 		elsif(pCurrentNode.class == Sketchup::ComponentInstance) <br/> 			pCurrentNode = pCurrentNode.definition.entities <br/>     end <br/>      <br/>     for a_Entity in pCurrentNode <br/>       if(a_Entity.class == Sketchup::Face and a_Entity.layer.visible?) <br/>         # Identify the material on the face being examined. <br/>         a_pMaterial = a_Entity.material <br/>         @m_bMaterialsChanged = false <br/>         if a_pMaterial != nil <br/>           @m_pMaterials.push(a_pMaterial) <br/>           @m_bMaterialsChanged = true <br/>         end <br/>          <br/>         # Process the mesh co-ordinates for the face being examined. <br/>         theProcessor.ProcessFace(a_Entity, @m_pMaterials.last, @m_Transformations.last) <br/>            <br/>         # Finish processing the material on the face being examined. <br/>         if @m_bMaterialsChanged == true <br/> 					@m_pMaterials.pop <br/>           @m_bMaterialsChanged = false <br/>         end <br/>            <br/>         # Reporting only. <br/>         @m_pWalker.Tick(@m_nLevel) <br/>       end <br/>     end <br/>        <br/>     for a_Entity in pCurrentNode <br/>      # If there is a component within the current component or group then recursively process that component as well. <br/>      if((a_Entity.class == Sketchup::ComponentInstance or a_Entity.class == Sketchup::Group) and a_Entity.layer.visible?) <br/>         @m_nLevel += 1 <br/>         @m_Transformations.push(@m_Transformations.last * a_Entity.transformation) <br/>         self.Process(a_Entity, pCurrentNode, theProcessor) <br/>         @m_Transformations.pop <br/>         @m_nLevel -= 1 <br/>       end <br/>     end <br/>   end <br/> end <br/>  <br/> class FileWritter <br/>  <br/> # Updated: 24-September-2010 <br/>   def initialize(asePath) <br/>     @m_pFile = nil <br/> 		@m_sAsePath = asePath <br/>     self.OpenFile <br/>   end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def OpenFile <br/> 		@m_pFile = File.new(@m_sAsePath,"wb") <br/> 	end <br/>    <br/> # Updated: 24-September-2010 <br/>   def WriteToFile(aLine) <br/>     @m_pFile.write(aLine) <br/>     @m_pFile.flush <br/>   end <br/>  <br/> # Updated: 24-September-2010 <br/>   def CloseFile <br/>     @m_pFile.flush <br/> 		@m_pFile.close <br/>   end <br/> end <br/>    <br/> class ExporterDataASE_UTX <br/>  <br/> # Updated: 24-September-2010 <br/> 	def initialize(theFileWritter, theModelName) <br/>     @m_FileWritter = theFileWritter <br/>      <br/>     @m_vVertex =  <br/> 		@m_vVertex.fill(,0,15000) <br/> 		@m_nNextVertex = 0 <br/>      <br/>     @m_vVertexUV =  <br/> 		@m_vVertexUV.fill(,0,15000) <br/> 		@m_nNextVertexUV = 0 <br/>  <br/> 		@m_vNormal =  <br/> 		@m_vNormal.fill(,0,15000) <br/> 		@m_nNextNormal = 0 <br/>  <br/> 		@m_pTriangle =  <br/> 		@m_pTriangle.fill(,0,15000) <br/> 		@m_nNextTriangle = 0 <br/>  <br/> 		@m_pMaterial =  <br/> 		@m_pMaterial.fill(,0,1000) <br/> 		@m_nNextMaterial = 0 <br/>      <br/>     @m_nModelName = theModelName <br/> 	end <br/>    <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def NextVertexXYZ(pPacket) <br/> 		# Search an existing XYZ. <br/> 		a_nIndex = @m_nNextVertex - 1 <br/> 		a_nCount = 256 <br/>      <br/> 		if a_nCount &gt; a_nIndex + 1 <br/> 			a_nCount = a_nIndex + 1 <br/> 		end <br/>      <br/> 		while a_nCount &gt; -1 <br/>       a_pTemp = @m_vVertex <br/> 			if (a_pTemp == pPacket) && (a_pTemp == pPacket) && (a_pTemp == pPacket) <br/>         if (a_pTemp == pPacket) && (a_pTemp == pPacket) && (a_pTemp == pPacket) <br/> 					return a_nIndex <br/> 				end <br/> 			end <br/> 			a_nIndex = a_nIndex - 1 <br/> 			a_nCount = a_nCount - 1 <br/> 		end <br/>      <br/> 		# Create a new XYZ <br/> 		@m_vVertex = pPacket <br/> 		@m_nNextVertex = @m_nNextVertex + 1 <br/> 		return @m_nNextVertex - 1 <br/> 	end <br/> # Updated: by HardPCM date unknown. <br/> 	def NextVertexUV(pPacket) <br/> 		# Search an existing UV <br/> 		a_nIndex = @m_nNextVertexUV - 1 <br/> 		a_nCount = 256 <br/>      <br/> 		if a_nCount &gt; a_nIndex + 1 <br/> 			a_nCount = a_nIndex + 1 <br/> 		end <br/>      <br/> 		while a_nCount &gt; -1 <br/> 			a_pTemp = @m_vVertexUV <br/> 			if (a_pTemp == pPacket) && (a_pTemp == pPacket) && (a_pTemp == pPacket) <br/> 				return a_nIndex <br/> 			end <br/> 			a_nIndex = a_nIndex - 1 <br/> 			a_nCount = a_nCount - 1 <br/> 		end <br/>      <br/> 		# Create a new UV <br/> 		@m_vVertexUV = pPacket <br/> 		@m_nNextVertexUV = @m_nNextVertexUV + 1 <br/> 		return @m_nNextVertexUV - 1 <br/> 	end <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def NextNormalXYZ(pPacket) <br/>     @m_vNormal = pPacket <br/> 		@m_nNextNormal = @m_nNextNormal + 1 <br/> 		return @m_nNextNormal - 1 <br/> 	end <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def NextFaceABC(pPacket) <br/> 		@m_pTriangle = pPacket <br/> 		@m_nNextTriangle = @m_nNextTriangle + 1 <br/> 		return @m_nNextTriangle - 1 <br/> 	end <br/>  <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def NextMaterial(pPacket) <br/> 		# Search an existing material <br/> 		a_nIndex = @m_nNextMaterial - 1 <br/> 		while a_nIndex &gt; -1 <br/> 			a_pTempPacket = @m_pMaterial <br/> 			if a_pTempPacket == pPacket <br/> 				return a_nIndex <br/> 			end <br/> 			a_nIndex = a_nIndex - 1 <br/> 		end <br/>      <br/> 		# Create a new material <br/> 		@m_pMaterial = pPacket <br/> 		@m_nNextMaterial = @m_nNextMaterial + 1 <br/> 		return @m_nNextMaterial - 1 <br/> 	end <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def VectorFromSketchup(pVector) <br/> 		return  <br/> 	end <br/>  <br/> # Updated: by HardPCM date unknown. <br/> 	def VectorUvFromSketchup(pVector) <br/> 		return  <br/> 	end <br/> # Updated: 24-September-2010 <br/> 	def WriteHeader <br/> 		@m_FileWritter.WriteToFile("*3DSMAX_ASCIIEXPORT\r\n") <br/> 		@m_FileWritter.WriteToFile("*COMMENT Muvizu ASE Exporter.\r\n") <br/>     @m_FileWritter.WriteToFile("*COMMENT Based on HardPCM'S ASE output plugin for Sketchup (HSKP2UNR.rb)\r\n") <br/> 	end <br/>  <br/> #Updated: 24-September-2010 <br/> 	def WriteMaterials <br/>      <br/>     # Write the material header. <br/> 		@m_FileWritter.WriteToFile("*MATERIAL_LIST {\r\n") <br/> 		@m_FileWritter.WriteToFile("*MATERIAL_COUNT 1\r\n") <br/> 		@m_FileWritter.WriteToFile("	*MATERIAL 0 {\r\n") <br/> 		@m_FileWritter.WriteToFile("		*MATERIAL_NAME \"MUVIZU_ASE_TEXTURE\"\r\n") <br/> 		@m_FileWritter.WriteToFile("		*MATERIAL_CLASS \"Multi/Sub-Object\"\r\n") <br/>      <br/>     # Write the number of sub-materials to expect. <br/> 		@m_FileWritter.WriteToFile("		*NUMSUBMTLS #{"%i" %(@m_nNextMaterial)}\r\n") <br/>      <br/>     # Output sub-material list. <br/> 		a_nIndex = 0 <br/> 		a_nCount = @m_nNextMaterial <br/>     while (a_nIndex &lt; a_nCount) <br/>        <br/> 			a_pPacket = @m_pMaterial <br/>        <br/> 			@m_FileWritter.WriteToFile("		*SUBMATERIAL #{"%i" %(a_nIndex)} {\r\n"); <br/> 			@m_FileWritter.WriteToFile("			*MATERIAL_NAME \"#{"%s" %(a_pPacket)}\"\r\n"); <br/> 			@m_FileWritter.WriteToFile("			*MATERIAL_CLASS \"Standard\"\r\n"); <br/> 			@m_FileWritter.WriteToFile("			*MAP_DIFFUSE {\r\n"); <br/> 			@m_FileWritter.WriteToFile("				*MAP_CLASS \"Bitmap\"\r\n"); <br/> 			@m_FileWritter.WriteToFile("				*BITMAP \"#{"%s" %(a_pPacket)}\"\r\n"); <br/> 			@m_FileWritter.WriteToFile("				*UVW_U_OFFSET 0.0\r\n"); <br/> 			@m_FileWritter.WriteToFile("				*UVW_V_OFFSET 0.0\r\n"); <br/> 			@m_FileWritter.WriteToFile("				*UVW_U_TILING 1.0\r\n"); <br/> 			@m_FileWritter.WriteToFile("				*UVW_V_TILING 1.0\r\n"); <br/> 			@m_FileWritter.WriteToFile("			}\r\n"); <br/> 			a_nIndex = a_nIndex + 1 <br/> 		end <br/>      <br/> 		@m_FileWritter.WriteToFile("	}\r\n") <br/> 		@m_FileWritter.WriteToFile("}\r\n") <br/> 	end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def WriteGeometryBegin <br/> 		@m_FileWritter.WriteToFile("*GEOMOBJECT {\r\n") <br/> 		@m_FileWritter.WriteToFile("	*NODE_NAME \"#{"%s" %(@m_nModelName)}\"\r\n") <br/> 		@m_FileWritter.WriteToFile("	*NODE_TM {\r\n") <br/> 		@m_FileWritter.WriteToFile("	*NODE_NAME \"#{"%s" %(@m_nModelName)}\"\r\n") <br/> 		@m_FileWritter.WriteToFile("	}\r\n") <br/> 		@m_FileWritter.WriteToFile("	*MESH {\r\n") <br/> 		@m_FileWritter.WriteToFile("		*TIMEVALUE 0\r\n") <br/> 	end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def WriteGeometryColBegin <br/> 		@m_FileWritter.WriteToFile("*GEOMOBJECT {\r\n") <br/> 		@m_FileWritter.WriteToFile("	*NODE_NAME \"UCX_#{"%s" %(@m_nModelName)}\"\r\n") <br/> 		@m_FileWritter.WriteToFile("	*NODE_TM {\r\n") <br/> 		@m_FileWritter.WriteToFile("	*NODE_NAME \"UCX_#{"%s" %(@m_nModelName)}\"\r\n") <br/> 		@m_FileWritter.WriteToFile("	}\r\n") <br/> 		@m_FileWritter.WriteToFile("	*MESH {\r\n") <br/> 		@m_FileWritter.WriteToFile("		*TIMEVALUE 0\r\n") <br/> 	end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def WriteVertexXYZ <br/> 		@m_FileWritter.WriteToFile("		*MESH_NUMVERTEX #{"%i" %(@m_nNextVertex)}\r\n") <br/> 		@m_FileWritter.WriteToFile("			*MESH_NUMFACES #{"%i" %(@m_nNextTriangle)}\r\n") <br/> 		@m_FileWritter.WriteToFile("		*MESH_VERTEX_LIST {\r\n") <br/>      <br/> 		a_nIndex = 0 <br/> 		a_nCount = @m_nNextVertex <br/> 		while (a_nIndex &lt; a_nCount) <br/> 			a_pPacket = @m_vVertex <br/> 			@m_FileWritter.WriteToFile("			*MESH_VERTEX    #{"%i" %(a_nIndex)}	#{"%+013.6f" %(a_pPacket)}	#{"%+013.6f" %(a_pPacket)}	#{"%+013.6f" %(a_pPacket)}\r\n"); <br/> 			a_nIndex = a_nIndex + 1 <br/> 		end <br/>      <br/> 		@m_FileWritter.WriteToFile("		}\r\n") <br/>      <br/> 	end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def WriteFaceVertexXYZ <br/> 		@m_FileWritter.WriteToFile("		*MESH_FACE_LIST {\r\n") <br/>      <br/> 		a_nIndex = 0 <br/> 		a_nCount = @m_nNextTriangle <br/> 		while (a_nIndex &lt; a_nCount) <br/> 			a_pPacket = @m_pTriangle <br/> 			@m_FileWritter.WriteToFile("			*MESH_FACE    #{"%i" %(a_nIndex)}: A:    #{"%i" %(a_pPacket)} B:    #{"%i" %(a_pPacket)} C:    #{"%i" %(a_pPacket)}	 AB:	1	BC:	1	CA:	1	*MESH_SMOOTHING 0 	*MESH_MTLID #{"%i" %(a_pPacket)}\r\n"); <br/> 			a_nIndex = a_nIndex + 1 <br/> 		end <br/>      <br/> 		@m_FileWritter.WriteToFile("		}\r\n") <br/> 	end <br/>    <br/> # Updated: 24-September-2010 <br/> 	def WriteVertexUV <br/>     @m_FileWritter.WriteToFile("		*MESH_NUMTVERTEX #{"%i" %(@m_nNextVertexUV)}\r\n") <br/> 		@m_FileWritter.WriteToFile("		*MESH_TVERTLIST {\r\n") <br/>      <br/>     a_nIndex = 0 <br/> 		a_nCount = @m_nNextVertexUV <br/> 		while (a_nIndex &lt; a_nCount) <br/>       a_pPacket = @m_vVertexUV <br/> 			@m_FileWritter.WriteToFile("			*MESH_TVERT #{"%i" %(a_nIndex)}	#{"%+013.6f" %(a_pPacket)}	#{"%+013.6f" %(a_pPacket)}	0.000000\r\n"); <br/> 			a_nIndex = a_nIndex + 1 <br/> 		end <br/>      <br/> 		@m_FileWritter.WriteToFile("		}\r\n") <br/>   end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def WriteFaceVertexUV <br/> 		@m_FileWritter.WriteToFile("		*MESH_NUMTVFACES #{"%i" %(@m_nNextTriangle)}\r\n") <br/> 		@m_FileWritter.WriteToFile("		*MESH_TFACELIST {\r\n") <br/>      <br/> 		a_nIndex = 0 <br/> 		a_nCount = @m_nNextTriangle <br/> 		while (a_nIndex &lt; a_nCount) <br/> 			a_pPacket = @m_pTriangle <br/> 			@m_FileWritter.WriteToFile("			*MESH_TFACE #{"%i" %(a_nIndex)}	#{"%i" %(a_pPacket)}	#{"%i" %(a_pPacket)}	#{"%i" %(a_pPacket)}\r\n"); <br/> 			a_nIndex = a_nIndex + 1 <br/> 		end <br/>      <br/> 		@m_FileWritter.WriteToFile("		}\r\n") <br/>   end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def WriteFaceNormals <br/> 		@m_FileWritter.WriteToFile("		*MESH_NORMALS {\r\n") <br/>      <br/> 		a_nIndex = 0 <br/> 		a_nCount = @m_nNextTriangle <br/> 		while (a_nIndex &lt; a_nCount) <br/> 			a_pPacket = @m_pTriangle <br/> 			@m_FileWritter.WriteToFile("			*MESH_FACENORMAL #{"%i" %(a_nIndex)}    #{"%+013.6f" %(a_pPacket)}    #{"%+013.6f" %(a_pPacket)}    #{"%+013.6f" %(a_pPacket)}\r\n"); <br/> 			a_nID = a_pPacket <br/> 			a_pTP = @m_vVertex <br/> 			@m_FileWritter.WriteToFile("				*MESH_VERTEXNORMAL #{"%i" %(a_nID)}	#{"%+013.6f" %(a_pTP)}	#{"%+013.6f" %(a_pTP)}	#{"%+013.6f" %(a_pTP)}\r\n"); <br/> 			a_nID = a_pPacket <br/> 			a_pTP = @m_vVertex <br/> 			@m_FileWritter.WriteToFile("				*MESH_VERTEXNORMAL #{"%i" %(a_nID)}	#{"%+013.6f" %(a_pTP)}	#{"%+013.6f" %(a_pTP)}	#{"%+013.6f" %(a_pTP)}\r\n"); <br/> 			a_nID = a_pPacket <br/> 			a_pTP = @m_vVertex <br/> 			@m_FileWritter.WriteToFile("				*MESH_VERTEXNORMAL #{"%i" %(a_nID)}	#{"%+013.6f" %(a_pTP)}	#{"%+013.6f" %(a_pTP)}	#{"%+013.6f" %(a_pTP)}\r\n"); <br/> 			a_nIndex = a_nIndex + 1 <br/> 		end <br/>      <br/> 		@m_FileWritter.WriteToFile("		}\r\n") <br/> 	end <br/>  <br/> # Updated: 24-September-2010 <br/> 	def WriteGeometryFinish <br/> 		@m_FileWritter.WriteToFile("	}\r\n") <br/> 		@m_FileWritter.WriteToFile("	*MATERIAL_REF 0\r\n") <br/> 		@m_FileWritter.WriteToFile("}\r\n") <br/> 	end <br/>  <br/> #Updated 24-September-2010 <br/> 	def ProcessFace(pFace, pMaterial, pTransformations) <br/>  <br/> 		# Extract the mesh. <br/> 		a_pMesh = pFace.mesh 7 <br/>      <br/> 		# Transform the mesh. <br/> 		a_pMesh.transform! pTransformations <br/>      <br/> 		# Eextract material info. <br/> 		a_nMaterialU = 1.0 <br/> 		a_nMaterialV = 1.0 <br/>     # Load default material name and bmp file path. Note the file toto.bmp <br/>     # does not exist unless you create it. For Muvizu it is recommended to <br/>     # create this file for the best results. <br/>     a_sTexture = "Engine.DefaultTexture" <br/>     a_pTexturePath = "C:\\ut3\\toto.bmp" <br/>      <br/>     # Make sure that the material reference exists before processing anything else. <br/> 		if pMaterial != nil <br/>        <br/>       # If the material has a name in Sketchup use that instead of the default. <br/> 			if pMaterial.name != "" <br/>         a_sTexture = pMaterial.name <br/>       end if <br/>        <br/>       # Check that the material has a texture (and is not just a colour) before ensuring that <br/>       # the texture filename reference exists and has content. Use the actual path and filename <br/>       # for that texture / material instead of the default toto.bmp <br/>       if pMaterial.texture != nil <br/>         if pMaterial.texture.filename != nil <br/>           if pMaterial.texture.filename != "" <br/>             a_pTexturePath = pMaterial.texture.filename <br/>           end <br/>         end <br/>       end <br/>        <br/>       # Take a reference to the texture object as well. <br/>       a_pTexture = pMaterial.texture <br/>     end <br/>  <br/>     # Pack the material for later writting to file. <br/>     a_pMatPack =  <br/>     a_nMaterialID = self.NextMaterial(a_pMatPack) <br/>        <br/>     # Extract the triangle normal. <br/>     a_vNormal = pFace.normal  <br/>     a_nNx = a_vNormal.x <br/>     a_nNy = a_vNormal.y <br/>     a_nNz = a_vNormal.z <br/>        <br/>     # Loop for each triangle in the face. <br/>     a_nIndex = 1 <br/>     while (a_nIndex &lt;= a_pMesh.count_polygons) <br/>          <br/>       # Extract the triangle indexes. <br/>       a_pPolygon = a_pMesh.polygon_at a_nIndex <br/>        <br/>       # Extract the triangle vertex. <br/>       a_pVa = self.VectorFromSketchup(a_pMesh.point_at a_pPolygon) <br/>       a_pVb = self.VectorFromSketchup(a_pMesh.point_at a_pPolygon) <br/>       a_pVc = self.VectorFromSketchup(a_pMesh.point_at a_pPolygon) <br/>          <br/>       a_pVa = a_nNx <br/>       a_pVa = a_nNy <br/>       a_pVa = a_nNz <br/>         <br/>       a_pVb = a_nNx <br/>       a_pVb = a_nNy <br/>       a_pVb = a_nNz <br/>          <br/>       a_pVc = a_nNx <br/>       a_pVc = a_nNy <br/>       a_pVc = a_nNz <br/>          <br/>       a_nVa = self.NextVertexXYZ(a_pVa) <br/>       a_nVb = self.NextVertexXYZ(a_pVb) <br/>       a_nVc = self.NextVertexXYZ(a_pVc) <br/>          <br/>       # Extract the texture coordinates. <br/>       a_pTa = self.VectorUvFromSketchup(a_pMesh.uv_at a_pPolygon,a_pPolygon) <br/>       a_pTb = self.VectorUvFromSketchup(a_pMesh.uv_at a_pPolygon,a_pPolygon) <br/>       a_pTc = self.VectorUvFromSketchup(a_pMesh.uv_at a_pPolygon,a_pPolygon) <br/>       a_nTa = self.NextVertexUV(a_pTa) <br/>       a_nTb = self.NextVertexUV(a_pTb) <br/>       a_nTc = self.NextVertexUV(a_pTc)			 <br/>          <br/>       # Convert to face, <br/>       a_pFace =  <br/>       a_nFace = NextFaceABC(a_pFace) <br/>       # --- next triangle ------------------------------------------------ <br/>       a_nIndex += 1 <br/>     end <br/> 	end <br/>  <br/> # Updated 24-September-2010 <br/>   def WriteGeometry <br/>     # Write out all parts for the geometry model. <br/>     self.WriteGeometryBegin <br/> 		self.WriteVertexXYZ <br/> 		self.WriteFaceVertexXYZ <br/> 		self.WriteVertexUV <br/> 		self.WriteFaceVertexUV <br/> 		self.WriteFaceNormals <br/> 		self.WriteGeometryFinish <br/>   end <br/>  <br/> # Updated 24-September-2010 <br/>   def WriteCollision <br/>     # The only difference between WriteCollision and WriteGeometry is that the method <br/>     # WriteGeometryColBegin is called, which does the same as WriteGeometryBegin but <br/>     # prefixes the name of the object with UCX for a collision object. <br/>     self.WriteGeometryColBegin <br/> 		self.WriteVertexXYZ <br/> 		self.WriteFaceVertexXYZ <br/> 		self.WriteVertexUV <br/> 		self.WriteFaceVertexUV <br/> 		self.WriteFaceNormals <br/> 		self.WriteGeometryFinish     <br/>   end <br/>  <br/> end <br/>  <br/> class MuvizuASEExporter <br/>     <br/>    #Updated: 24-September-2010 <br/> 	def About <br/>      <br/>     UI.messagebox("Muvizu ASE Exporter <br/>  <br/> Original work by Raphael Couturier (HardPCM) with HSKP2UNR <br/> HardPCM's Google Sketchup Exporter to T3D/PSK/ASE/OBJ format <br/> for UT3/UT2K4/UT2K3/UT99 game engines. Version 0.9.8 May 26nd 2009 <br/> was used as the foundation. The aim of this update is to provide <br/> a more optomised exporter for use with Muvizu (http://www.muvizu.com) <br/>  <br/> Change List / History <br/>  <br/> # 0.0.1 - Write out texture filename and path for ASE submaterial tag *BITMAP "..." <br/> # 0.0.2 - Generate collision mesh automatically. Copy geometry into another GEOMODEL object prefixing object name with UCX. Collision was too complex. <br/> # 0.0.3 - Removed non-essential parts for Muvizu input (import, and all export except ASE functions). <br/> # 0.0.4 - Limited output to components only. Remove all handling of groups. <br/> # 0.0.5 - UI to allow selection of one component as geometry and one component as collision. <br/> # 0.0.6 - Renamed classes and methods to avoid dependency or interfearance with the original plugin. <br/> # 0.0.7 - Refined UI to reduce and report errors. <br/> # 0.0.8 - Updated about text and source comments for completeness. <br/>  <br/> Freeware under the GNU Lesser General Public License version 2 or later. <br/>  <br/>  Special thanks to: <br/>  <br/>    - Raphael Couturier (HardPCM) for the original work. <br/>  <br/>    - Jim Skivington for testing the early attempts at the changes.  <br/>  <br/>  How to install: <br/>  <br/>    filename is: \"MuvizuASEExporter.rb\" <br/>    and put it in the directory like <br/>    \"C:\Program Files\Google\Google SketchUp X\Plugins\" <br/>  <br/>  How this works: <br/>  <br/>    Everything is in inch OK!!! <br/>    So 512 inch unit = 512 unreal unit. <br/>    This apply to the model size and the material size. <br/>  <br/>    Muvizu supports both single and double sided objects. This means you do not need to worry about WHITE or BLUE mode for faces, however to achieve the best results from modelling for a games engine it is recommended that use only use signle sided objects. The recommendation is for WHITE (when all faces of your object look WHITE on the outside). If you do not then some faces will only be visible inside your object. Each face needs to have a texture applied to it. <br/>  <br/>   <a href="http://www.muvizu.com/" target="_blank" rel="nofollow">http://www.muvizu.com/</a> <br/>    <br/>   " , MB_MULTILINE , "Muvizu ASE Exporter") <br/>      <br/> 	end <br/>  <br/> # Updated: 24-September-2010 <br/>   def CountComponents deffs = nil <br/>     count = 0 <br/>     if deffs != nil <br/>       deffs.each {|x| <br/>         if x.is_a? Sketchup::ComponentInstance          <br/>           count += 1 <br/>        end <br/>       } <br/>     end <br/>     # Returns the total number of available components. <br/>     return count <br/>   end <br/>    <br/> # Updated: 24-September-2010 <br/>   def GetFirstComponent deffs = nil <br/>     hasFirst = false <br/>     first = "" <br/>     if deffs != nil <br/>       deffs.each {|modelref| <br/>       if modelref.is_a? Sketchup::ComponentInstance <br/>       # Get the name of the first component for default selection on the Export Options dialog box. <br/>         if hasFirst == false <br/>           deff = modelref.definition <br/>           first = deff.name <br/>           hasFirst = true <br/>         end <br/>       end <br/>       } <br/>     end <br/>     return first <br/>   end <br/>  <br/> # Updated: 24-September-2010 <br/>   def GetDropDownList deffs = nil <br/>     listGeometry = "" <br/>     if deffs != nil <br/>       deffs.each {|x| <br/>         if x.is_a? Sketchup::ComponentInstance <br/>           # Go through all components that exist in the sketchup model and append each ones name to a string for use in a combo box. <br/>           deff = x.definition <br/>           listGeometry += "#{"%s" %(deff.name)}|" <br/>        end <br/>       } <br/>     end <br/>     return listGeometry <br/>   end <br/>  <br/> # Updated: 24-September-2010 <br/>   def GetDropDownListCollision  deffs = nil <br/>     # Always return the "None" option. <br/>     listCollision = "None - Muvizu generated collision" <br/>     if deffs != nil <br/>       # Append the None option to the list generated of existing components. <br/>       listCollision += "|#{"%s" %(self.GetDropDownList deffs)}" <br/>     end <br/>     return listCollision <br/>   end <br/>    <br/>   # Updated: 24-September-2010 <br/>   def GetEntityRefByName deffs = nil, theName = "" <br/>     # Return nil on error. <br/>     modelentity = nil <br/>     # Make sure we have valid references. <br/>     if deffs != nil <br/>       deffs.each {|modelref| <br/>       if modelref.is_a? Sketchup::ComponentInstance <br/>         deff = modelref.definition <br/>         # Go through all entities, check that it is a ComponentInstance and return reference to the one that matches the provided name, <br/>         if deff.name == theName <br/>           modelentity = modelref <br/>         end <br/>       end <br/>       }   <br/>     end <br/>     return modelentity <br/>   end <br/>    <br/> def getMaterialFileNames(theMaterials) <br/>     allTextures = "" <br/>     theMaterials.texture.each { | text | <br/>       if theMaterials.texture != nil <br/>         allTexture += "#{"%s" %(theMaterials.texture.filename)}|" <br/>       end <br/>     } <br/>     return allTextures <br/>   end <br/>    <br/>     def findDuplicate(arrayMaterials, check) <br/>       foundDup = false <br/>       arrayMaterials.each { | material |  <br/>         if material.texture.filename == check.texture.filename <br/>           foundDup = true <br/>         end <br/>       } <br/>       return foundDup <br/>     end <br/>    <br/>   	def ProcessForTextures(pCurrentNode, pParent) <br/>        <br/>       #tmpTextures = Array.new <br/>       # Explode components or groups so we can process each face within it. <br/> 		if(pCurrentNode.class == Sketchup::Group) <br/> 			pCurrentNode = pCurrentNode.entities  <br/> 		elsif(pCurrentNode.class == Sketchup::ComponentInstance) <br/> 			pCurrentNode = pCurrentNode.definition.entities <br/>     end <br/>      <br/>     for a_Entity in pCurrentNode <br/>       #UI.messagebox "Processing entities" <br/>       if(a_Entity.class == Sketchup::Face and a_Entity.layer.visible?) <br/>         # Identify the material on the face being examined. <br/>         a_pMaterial = a_Entity.material <br/>         #UI.messagebox "Checking materials" <br/>         if self.findDuplicate(@allMaterials, a_pMaterial) == false <br/>           @allMaterials.push(a_pMaterial) <br/>           #tmpTextures += "#{"%s" %(a_pMaterial.texture.filename)}|" <br/>           #UI.messagebox "#{"%s" %(a_pMaterial.texture.filename)}|" <br/>         end <br/>       end <br/>     end <br/>        <br/>     for a_Entity in pCurrentNode <br/>      # If there is a component within the current component or group then recursively process that component as well. <br/>      if((a_Entity.class == Sketchup::ComponentInstance or a_Entity.class == Sketchup::Group) and a_Entity.layer.visible?) <br/>         self.ProcessForTextures(a_Entity, pCurrentNode) <br/>       end <br/>     end <br/>   end <br/>    <br/>   # Updated: 24-September-2010 <br/>   def ExportOptionMenu(firstName, geoList, colList) <br/>     a_pMenuResult = Array.new <br/>     # Check there is at least one component to list in the export options menu. <br/>     if geoList != nil && geoList.length &gt; 0 <br/>       # Prepare the export options menu.  <br/>       a_pMenuDropdowns =  <br/>       a_pMenuPrompts =  <br/>       # Display Export Options <br/>       a_pMenuResult = UI.inputbox a_pMenuPrompts, , a_pMenuDropdowns, "Export options" <br/>        <br/>       # Only progress if the user has selected Ok (true) <br/>       if a_pMenuResult != false <br/>         if a_pMenuResult == a_pMenuResult <br/>           a_pMenuResult = Array.new <br/>           a_pMenuResult = -1 <br/>         end <br/>       end <br/>     else <br/>       a_pMenuResult = -2 <br/>     end <br/>     return a_pMenuResult <br/>   end <br/>    <br/>   # Updated: 24-September-2010 <br/> 	def ExportASE <br/>     # Get the entities available in the current model <br/>     model = Sketchup.active_model <br/> 	  deffs = model.entities <br/>      <br/>     # Initialise variables for the menu and identifying the model and collision to export. <br/>     a_pMenuA = "" <br/>     a_pMenuB = "" <br/>     first = "" <br/>     exportCollision = true <br/>  <br/>     # Get the menu options. <br/>     first = self.GetFirstComponent deffs <br/>     a_pMenuA = self.GetDropDownList deffs <br/>     a_pMenuB = self.GetDropDownListCollision deffs <br/>      <br/>     # Validation flags. <br/>     readyToExport = false  <br/>     progressExport = true <br/>     continueResult = 0 <br/>      <br/>     while readyToExport == false <br/>       a_pMenuResult = self.ExportOptionMenu(first, a_pMenuA, a_pMenuB) <br/>       if a_pMenuResult != false <br/>         if a_pMenuResult == -2 <br/>           UI.messagebox "There are no components in your sketchup model to export. Select the groups, faces or edges you wish to export then right click and do \"Make Component\"" <br/>           readyToExport = true <br/>           progressExport = false <br/>         elsif a_pMenuResult == -1 <br/>           continueResult = UI.messagebox ("You have selected the same component for the geometry mesh and the collision mesh. This is not recommended, do you wish to progress?", MB_YESNO, "Are you sure?") <br/>           if continueResult == 6 <br/>             readyToExport = true <br/>             progressExport = true <br/>           end <br/>         else <br/>           readyToExport = true <br/>         end <br/>       else <br/>         readyToExport = true <br/>         progressExport = false <br/>       end <br/>     end <br/>      <br/>     # Begin export if all options are ready. <br/>     if progressExport == true <br/>       modelname = a_pMenuResult <br/>       modelindex = a_pMenuResult <br/>       collisionindex = a_pMenuResult <br/>  <br/>       # Check if collision is to be exported or not. <br/>       if collisionindex == "None - Muvizu generated collision" <br/>         exportCollision = false <br/>       end <br/>              <br/>       # Prepare save path. <br/>       a_sExportPath = UI.savepanel("Export Model to ASE", "" , "#{"%s" %(modelname)}.ase") <br/>         <br/>       # Only progress to generating the ASE file if a save path and name have been selected. <br/>       if a_sExportPath != nil <br/>           <br/>         # Find a reference to the object that contains the model and collsion entities. <br/>         modelentity = Sketchup::Entity <br/>         collisionentity = Sketchup::Entity <br/>         modelentity = self.GetEntityRefByName(deffs, modelindex) <br/>  <br/>         # Only get the collision entity ref if collision is to be generated. <br/>         if exportCollision == true <br/>           collisionentity = self.GetEntityRefByName(deffs, collisionindex) <br/>         else <br/>           collisionentity = nil <br/>         end <br/>          <br/>         # Create the file handle. File handle is opened within initialize here. <br/>         aFileWritter = FileWritter.new a_sExportPath <br/>          <br/>         # Prepare the data processors that will convert the Sketchup model into ASE format. <br/>         a_pProcessor = ExporterDataASE_UTX.new(aFileWritter, modelname) <br/>          <br/>         # Only create a data processor if collision is to be generated. <br/>         if exportCollision == true <br/>           b_pProcessor = ExporterDataASE_UTX.new(aFileWritter, modelname) <br/>         else <br/>           b_pProcessor = nil <br/>         end <br/>                <br/>         # Finally send the processors and entity references to the iterator to generate the final output ASE file. <br/>         a_pIteratorer = IteratorerDataT3D_UTX.new(modelentity, a_pProcessor, collisionentity, b_pProcessor, a_sExportPath) <br/>         a_pIteratorer.Start <br/>          <br/>         # Close the file handle. <br/>         aFileWritter.CloseFile <br/>       else <br/>         UI.messagebox "No save to path or filename specified for export. Operation cancelled." <br/>       end <br/>     end <br/>   end <br/> end <br/>  <br/> file_loaded(".rb") <br/>  <br/> if(not file_loaded?("MuvizuASEExporter.rb")) <br/>   MZAE = MuvizuASEExporter.new <br/> 	pMenuA = UI.menu("Plugins").add_submenu("Muvizu ASE Exporter") <br/> 	pMenuA.add_item("Export ASE Format")		{ (MZAE.ExportASE) } <br/>   pMenuA.add_item("About Muvizu ASE Exporter")	{ (MZAE.About) } <br/> else <br/>   UI.messagebox "There was an error loading the Muvizu ASE Exporter." <br/> end <br/> <em>edited by urbanlamb on 28/03/2013</em>]]></description>
<pubDate>Thu, 28 Mar 2013 20:30:38 GMT</pubDate>
</item>
<item>
<link>http://www.muvizu.com/Forum/topic2598-ase-importer-link.aspx</link>
<title>Message from LULU153</title>
<description><![CDATA[Thank you but thats the link I tried I'm afraid. Gives me just a blank file (I took a screen shot but cant figure out how to upload it here)]]></description>
<pubDate>Thu, 28 Mar 2013 19:02:11 GMT</pubDate>
</item>
<item>
<link>http://www.muvizu.com/Forum/topic2598-ase-importer-link.aspx</link>
<title>Message from urbanlamb</title>
<description><![CDATA[hiya there is a link on the 3d gallery if you choose right click and download it saves it.  I have no clue if they are the same script but here is the gallery link <br/>  <br/> <a href="http://muvizu.com/Gallery/#&&m=3D" target="_blank" rel="nofollow">http://muvizu.com/Gallery/#&&m=3D</a>]]></description>
<pubDate>Thu, 28 Mar 2013 18:50:42 GMT</pubDate>
</item>
<item>
<link>http://www.muvizu.com/Forum/topic2598-ase-importer-link.aspx</link>
<title>Message from LULU153</title>
<description><![CDATA[When I click on the downloaded ASE link plug in I am unable to install it into the google sketchup plug ins folder as its empty.  The icon is just plain white and doesnt look like the one in the video tutorial.  Can anyone advise please? <br/>  <br/> thank you]]></description>
<pubDate>Thu, 28 Mar 2013 16:23:52 GMT</pubDate>
</item>
</channel>
</rss>
