Importing Collada Files question

Hello,



I am currently trying to import a collada file into a JME scene and have had no success.



The file I am trying to import is this.

<?xml version="1.0" encoding="utf-8"?>
<COLLADA version="1.4.0" xmlns="http://www.collada.org/2005/11/COLLADASchema">
   <asset>
      <contributor>
         <author>MCell v3.1 Viz Data Exporter</author>
         <authoring_tool>MCell v3.1</authoring_tool>
         <comments></comments>
         <copyright></copyright>
         <source_data>box_test.mdl</source_data>
      </contributor>
      <created>
         2009-9-17T11:28:43
      </created>
      <modified>
         2009-9-17T11:28:43
      </modified>
      <unit meter="0.000001" name="micron"/>
      <up_axis>Z_UP</up_axis>
   </asset>
   <library_geometries>
      <geometry id="world.outer_box" name="world.outer_box">
         <mesh>
            <source id="world.outer_box-Position">
               <float_array count="24" id="world.outer_box-Position-array">-1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 </float_array>
               <technique_common>
                  <accessor count="8" source="#world.outer_box-Position-array" stride="3">
                     <param type="float" name="X"></param>
                     <param type="float" name="Y"></param>
                     <param type="float" name="Z"></param>
                  </accessor>
               </technique_common>
            </source>
            <vertices id="world.outer_box-Vertex">
               <input semantic="POSITION" source="#world.outer_box-Position"/>
            </vertices>
            <triangles count="12">
               <input offset="0" semantic="VERTEX" source="#world.outer_box-Vertex"/>
               <p>0 2 1 3 1 2 4 5 6 7 6 5 0 4 2 6 2 4 1 3 5 7 5 3 0 1 4 5 4 1 2 6 3 7 3 6 </p>
            </triangles>
         </mesh>
      </geometry>
      <geometry id="world.inner_box" name="world.inner_box">
         <mesh>
            <source id="world.inner_box-Position">
               <float_array count="24" id="world.inner_box-Position-array">-0.1 -0.1 0.1 -0.1 0.1 0.1 -0.1 -0.1 0.2 -0.1 0.1 0.2 0.1 -0.1 0.1 0.1 0.1 0.1 0.1 -0.1 0.2 0.1 0.1 0.2 </float_array>
               <technique_common>
                  <accessor count="8" source="#world.inner_box-Position-array" stride="3">
                     <param type="float" name="X"></param>
                     <param type="float" name="Y"></param>
                     <param type="float" name="Z"></param>
                  </accessor>
               </technique_common>
            </source>
            <vertices id="world.inner_box-Vertex">
               <input semantic="POSITION" source="#world.inner_box-Position"/>
            </vertices>
            <triangles count="12">
               <input offset="0" semantic="VERTEX" source="#world.inner_box-Vertex"/>
               <p>0 2 1 3 1 2 4 5 6 7 6 5 0 4 2 6 2 4 1 3 5 7 5 3 0 1 4 5 4 1 2 6 3 7 3 6 </p>
            </triangles>
         </mesh>
      </geometry>
   </library_geometries>
   <library_visual_scenes>
      <visual_scene id="Scene" name="Scene">
         <node layer="L1" id="world.outer_box" name="world.outer_box">
            <instance_geometry url="#world.outer_box"/>
         </node>
         <node layer="L1" id="world.inner_box" name="world.inner_box">
            <instance_geometry url="#world.inner_box"/>
         </node>
      </visual_scene>
   </library_visual_scenes>
   <scene>
      <instance_visual_scene url="#Scene"/>
   </scene>
</COLLADA>



and I am trying to import it like this.


               InputStream source;

      try {
         source  = new FileInputStream(pathToFiles + "box_test.meshes.0000.dae");
      } catch (FileNotFoundException e) {
         throw new RuntimeException(e);
      }

      ColladaImporter.load(source, pathToFiles + "box_test.meshes.0000.dae");

      return ColladaImporter.getModel();


where FileInputOutStreamPath takes the path of the file.

After importing the file, I attach it to the rootNode of the scene "rootNode.attachChild(sChild);", but I can't see anything.  Not completely sure what's going in here since I can import this file in blender and see the boxes, but when I try to do it in JME through collada I get a Node whih is pretty much empty and has no boxes.

Any suggestions or comments on the subject?

Thanks

did you try to scale the node after loading (bigger or  smaller)?

I just tried re-scaling to see if it would help but no luck . Thanks for the response though.

i imported your scene into scene worker but found that while the node hierarchy was created correctly the shared nodes for the geometry were empty…

here’s a screenshot of the imported scene tree…







when i looked at the output in the console i did notice a warning message during the import



WARNING: Key: world.inner_box already in use. Overriding previous data. This is probably not desired.

WARNING: Key: world.outer_box already in use. Overriding previous data. This is probably not desired.



in the collada file the geometry library meshes have the same id as the node’s in the hierarchy…

i changed the id of the nodes in the visual_scene node to the following;



<visual_scene id="Scene" name="Scene">
         <node layer="L1" id="world.outer_box_NODE" name="world.outer_box">
            <instance_geometry url="#world.outer_box"/>
         </node>
         <node layer="L1" id="world.inner_box_NODE" name="world.inner_box">
            <instance_geometry url="#world.inner_box"/>
         </node>
      </visual_scene>



and now when i import the scene it appears correct....
so it seems the naming of your objects is the issue here...

Awesome! Thanks a lot for you help ncomp. They are showing in my scene now.  :smiley: