Hi,
I have a problem (maybe a bug?) in loading a .dae file made with Blender 
collada exporter.
I'm writing a robot simulation software that uses collada to load both 3d and 
physics.
The error I get is an exception :
"Unhandled exception at 0x0049fb10 (msvcr80d.dll) in RobotSimulator.exe: 
0xC0000005: Access violation reading location 0x00000000."

This occours when I try to load the collada file. Here is the code I wrote:

Code:
bool VisualModel::CreateFromColladaFileAndFillDAE(std::string & filename,DAE 
*dae)
{
   osg::ref_ptr<osgDB::ReaderWriter::Options> rwoptions(new 
osgDB::ReaderWriter::Options());
   rwoptions->setPluginData("DAE",dae);
   modelnode = osgDB::readNodeFile(filename,rwoptions);
   if(!modelnode) return false;
   return true;
}



Here is the stack trace:

Code:
>       msvcr80d.dll!strlen(unsigned char * buf=0x0012e760)  Line 81    Asm
        msvcp80d.dll!std::char_traits<char>::length(const char * 
_First=0x00000000)  Line 559 + 0x9 bytes       C++
        
msvcp80d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> 
>::assign(const char * _Ptr=0x00000000)  Line 1042 + 0x9 bytes  C++
        
msvcp80d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> 
>::operator=(const char * _Ptr=0x00000000)  Line 893    C++
        osg55-osgd.dll!osg::Object::setName(const char * name=0x00000000)  Line 
102 + 0x21 bytes        C++
        
osgdb_daed.dll!osgdae::daeReader::processSinglePPrimitive<domTriangles>(osg::Geode
 * geode=0x05c08620, domTriangles * group=0x05c1cbe8, std::map<daeElement 
*,osgdae::domSourceReader,std::less<daeElement 
*>,std::allocator<std::pair<daeElement * const,osgdae::domSourceReader> > > & 
sources=[2](...,...), unsigned int mode=4)  Line 243 + 0x14 bytes      C++
        osgdb_daed.dll!osgdae::daeReader::processGeometry(domGeometry * 
geo=0x05c1a3e8)  Line 219       C++
        
osgdb_daed.dll!osgdae::daeReader::processInstanceGeometry(domInstance_geometry 
* ig=0x05c1ee98)  Line 47 + 0xc bytes    C++
        osgdb_daed.dll!osgdae::daeReader::processNode(domNode * 
node=0x05c1e310)  Line 366 + 0x22 bytes C++
        osgdb_daed.dll!osgdae::daeReader::processVisualScene(domVisual_scene * 
scene=0x05c1dd58)  Line 156 + 0x23 bytes C++
        osgdb_daed.dll!osgdae::daeReader::convert(const 
std::basic_string<char,std::char_traits<char>,std::allocator<char> > & 
fileURI="./simpleworld.dae")  Line 123 + 0xc bytes       C++
        osgdb_daed.dll!ReaderWriterDAE::readNode(const 
std::basic_string<char,std::char_traits<char>,std::allocator<char> > & 
fname=".\simpleworld.dae", const osgDB::ReaderWriter::Options * 
options=0x05c07100)  Line 65 + 0x12 bytes C++
        
osg55-osgDBd.dll!osgDB::Registry::ReadNodeFunctor::doRead(osgDB::ReaderWriter & 
rw={...})  Line 1399 + 0x40 bytes       C++
        osg55-osgDBd.dll!osgDB::Registry::read(const 
osgDB::Registry::ReadFunctor & readFunctor={...})  Line 1537 + 0x22 bytes  C++
        osg55-osgDBd.dll!osgDB::Registry::readImplementation(const 
osgDB::Registry::ReadFunctor & readFunctor={...}, bool useObjectCache=false)  
Line 1645 + 0x13 bytes C++
        osg55-osgDBd.dll!osgDB::Registry::readNodeImplementation(const 
std::basic_string<char,std::char_traits<char>,std::allocator<char> > & 
fileName=".\simpleworld.dae", const osgDB::ReaderWriter::Options * 
options=0x05c07100)  Line 1850 + 0x57 bytes    C++
        osg55-osgDBd.dll!osgDB::Registry::readNode(const 
std::basic_string<char,std::char_traits<char>,std::allocator<char> > & 
fileName=".\simpleworld.dae", const osgDB::ReaderWriter::Options * 
options=0x05c07100, bool buildKdTreeIfRequired=true)  Line 237 + 0x98 bytes  C++
        osg55-osgDBd.dll!osgDB::readNodeFile(const 
std::basic_string<char,std::char_traits<char>,std::allocator<char> > & 
filename=".\simpleworld.dae", const osgDB::ReaderWriter::Options * 
options=0x05c07100)  Line 69 + 0x1f bytes  C++
        
RobotSimulator.exe!RobotSimulator::VisualModel::CreateFromColladaFileAndFillDAE(std::basic_string<char,std::char_traits<char>,std::allocator<char>
 > & filename=".\simpleworld.dae", DAE * dae=0x0012f958)  Line 10 + 0x15 bytes  
      C++
        
RobotSimulator.exe!RobotSimulator::Simulable::LoadModel(RobotSimulator::Model 
model={...})  Line 21 + 0x16 bytes        C++
        RobotSimulator.exe!RobotSimulator::Simulator::LoadSimulation(const char 
* pfilename=0x05b4d9c1)  Line 93 + 0x28 bytes   C++
        RobotSimulator.exe!main(int argc=2, char * * argv=0x05b4d968)  Line 54 
+ 0x20 bytes     C++
        RobotSimulator.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes   C
        RobotSimulator.exe!mainCRTStartup()  Line 403   C
        kernel32.dll!7c817077()         




The collada model is made by Blender 2.48a using the default startup scene with 
the cube with assigned a green material and esported with Triangles option and 
DisablePhisics option (for testing). You can find it in attachments.
Note that with collada-dom viewer the model is loaded adn displayed correctly 
and with osgviewer the model is loaded witout exceptions but nothing is 
displayed into the scene.

I think the problem is related to the call (you can see in the stack trace)
osg55-osgd.dll!osg::Object::setName(const char * name=0x00000000)� Line 102 + 
0x21 bytes

Can you tell me why this appens and how to correct ?

Thank you!!
Bye :D

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=13834#13834



<?xml version="1.0" encoding="utf-8"?>
<COLLADA version="1.4.0" xmlns="http://www.collada.org/2005/11/COLLADASchema";>
        <asset>
                <contributor>
                        <author>Illusoft Collada 1.4.0 plugin for Blender - 
http://colladablender.illusoft.com</author>
                        <authoring_tool>Blender v:248 - Illusoft Collada 
Exporter v:0.3.160</authoring_tool>
                        <comments></comments>
                        <copyright></copyright>
                        
<source_data>file://C:/000TESI/ROBOTSIMULATOR/Models/simpleworld.blend</source_data>
                </contributor>
                <created>2009-06-10T16:00:03.375000</created>
                <modified>2009-06-10T16:00:03.375000</modified>
                <unit meter="0.01" name="centimeter"/>
                <up_axis>Z_UP</up_axis>
        </asset>
        <library_cameras>
                <camera id="Camera-Camera" name="Camera-Camera">
                        <optics>
                                <technique_common>
                                        <perspective>
                                                <yfov>49.13434</yfov>
                                                <znear>0.1</znear>
                                                <zfar>100.0</zfar>
                                        </perspective>
                                </technique_common>
                        </optics>
                </camera>
        </library_cameras>
        <library_lights>
                <light id="Spot" name="Spot">
                        <technique_common>
                                <point>
                                        <color>1.00000 1.00000 1.00000</color>
                                        
<constant_attenuation>1.0</constant_attenuation>
                                        
<linear_attenuation>0.0</linear_attenuation>
                                        
<quadratic_attenuation>0.0</quadratic_attenuation>
                                </point>
                        </technique_common>
                </light>
        </library_lights>
        <library_geometries>
                <geometry id="Cube_001" name="Cube_001">
                        <mesh>
                                <source id="Cube_001-Position">
                                        <float_array count="24" 
id="Cube_001-Position-array">1.00000 1.00000 -1.00000 1.00000 -1.00000 -1.00000 
-1.00000 -1.00000 -1.00000 -1.00000 1.00000 -1.00000 1.00000 1.00000 1.00000 
1.00000 -1.00000 1.00000 -1.00000 -1.00000 1.00000 -1.00000 1.00000 
1.00000</float_array>
                                        <technique_common>
                                                <accessor count="8" 
source="#Cube_001-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>
                                <source id="Cube_001-Normals">
                                        <float_array count="18" 
id="Cube_001-Normals-array">0.00000 0.00000 -1.00000 0.00000 -0.00000 1.00000 
1.00000 -0.00000 0.00000 -0.00000 -1.00000 -0.00000 -1.00000 0.00000 -0.00000 
0.00000 1.00000 0.00000</float_array>
                                        <technique_common>
                                                <accessor count="6" 
source="#Cube_001-Normals-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="Cube_001-Vertex">
                                        <input semantic="POSITION" 
source="#Cube_001-Position"/>
                                </vertices>
                                <triangles count="12">
                                        <input offset="0" semantic="VERTEX" 
source="#Cube_001-Vertex"/>
                                        <input offset="1" semantic="NORMAL" 
source="#Cube_001-Normals"/>
                                        <p>0 0 1 0 2 0 2 0 3 0 0 0 4 1 7 1 6 1 
6 1 5 1 4 1 0 2 4 2 5 2 5 2 1 2 0 2 1 3 5 3 6 3 6 3 2 3 1 3 2 4 6 4 7 4 7 4 3 4 
2 4 4 5 0 5 3 5 3 5 7 5 4 5</p>
                                </triangles>
                        </mesh>
                </geometry>
        </library_geometries>
        <library_visual_scenes>
                <visual_scene id="Scene" name="Scene">
                        <node layer="L1" id="Cube" name="Cube">
                                <translate sid="translate">0.00000 0.00000 
0.00000</translate>
                                <rotate sid="rotateZ">0 0 1 0.00000</rotate>
                                <rotate sid="rotateY">0 1 0 -0.00000</rotate>
                                <rotate sid="rotateX">1 0 0 0.00000</rotate>
                                <scale sid="scale">1.00000 1.00000 
1.00000</scale>
                                <instance_geometry url="#Cube_001"/>
                        </node>
                        <node layer="L1" id="Lamp" name="Lamp">
                                <translate sid="translate">4.07625 1.00545 
5.90386</translate>
                                <rotate sid="rotateZ">0 0 1 106.93632</rotate>
                                <rotate sid="rotateY">0 1 0 3.16371</rotate>
                                <rotate sid="rotateX">1 0 0 37.26105</rotate>
                                <scale sid="scale">1.00000 1.00000 
1.00000</scale>
                                <instance_light url="#Spot"/>
                        </node>
                        <node layer="L1" id="Camera" name="Camera">
                                <translate sid="translate">7.48113 -6.50764 
5.34367</translate>
                                <rotate sid="rotateZ">0 0 1 46.69194</rotate>
                                <rotate sid="rotateY">0 1 0 0.61977</rotate>
                                <rotate sid="rotateX">1 0 0 63.55930</rotate>
                                <scale sid="scale">1.00000 1.00000 
1.00000</scale>
                                <instance_camera url="#Camera-Camera"/>
                        </node>
                </visual_scene>
        </library_visual_scenes>
        <scene>
                <instance_visual_scene url="#Scene"/>
        </scene>
</COLLADA>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to