Optimizing Collada files for Papervision with Ant
Recently I have been developing a very large flex/papervision3d project. The guy who´s making the 3d models is an external resource, frequently committing new collada files to our repository. One of the problems with these files are that his exporter is generating so much junk, and it has become necessary to do something about the sizes of the files.
For this reason I have added a subscript to my main build.xml, using the XmlTask from OopsConsultancy.
My script works like this:
<project basedir="." default="optimize"> <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"/> <property name="XML.DIR" value="../MainApp/assets/3d"/> <property name="MODEL.A320" value="a320"/> <target name="optmize"> <property name="file" value="${XML.DIR}/${MODEL.A320}/${MODEL.A320}.DAE"/> <xmltask source="${file}" dest="${file}"> <remove path="/:COLLADA/:asset"/> <remove path="/:COLLADA/:library_cameras/:camera/:optics"/> <remove path="/:COLLADA/:library_cameras/:camera/:extra"/> <remove path="/:COLLADA/:library_materials/:material/:extra"/> <remove path="/:COLLADA/:library_effects/:effect/:profile_COMMON"/> <remove path="/:COLLADA/:library_effects/:effect/:extra"/> <remove path="/:COLLADA/:library_visual_scenes/:visual_scene/:node/:instance_geometry/:bind_material"/> <remove path="/:COLLADA/:library_visual_scenes/:visual_scene/:extra"/> </xmltask> </target> </project>
Most probably there are more things to clean up than the content above, but with this I managed to get rid of about 30% of the overhead from the files.

1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]