Importing COLLADA (*.dae) from Blender 2.63 to Alternativa3d 8


When you export from Blender 2.63 to Alternativa3d 8 you wont be able to load the model at first try, you will need to add a “name” attribute in the DAE file in order to Alternativa3d to find the objects.

You must open the DAE with a text editor (it will be an XML file) then add a “name” attribute with the same value as the “id” attribute of each NODE element in this root:

%XMLROOT% -> library_visual_scenes -> visual_scene -> node

There you will see something like:

<node id=”level” type=”NODE”>

and you must change it to:

<node id=”level” type=”NODE” name=”level”>

To do this automatically, pre-parse the XML before passing it to the ParserCollada to add this attributes:

			var colladaXML:XML = XML(new LevelModel());
			var ns:Namespace = colladaXML.namespace();

			var xmlCount:Number = colladaXML.ns::library_visual_scenes.ns::visual_scene.ns::node.length();

			for(var i=0; i<xmlCount; i++)
			{
				var nodeName:String = colladaXML.ns::library_visual_scenes.ns::visual_scene.ns::node[i].attribute("name");
				var nodeID:String = colladaXML.ns::library_visual_scenes.ns::visual_scene.ns::node[i].attribute("id");

				if(nodeName == "")
				{
					colladaXML.ns::library_visual_scenes.ns::visual_scene.ns::node[i].@name = nodeID;
				}
			}

Solution provided by user matsuse at http://forum.alternativaplatform.com/posts/list/3452.page (4th post)

Advertisements