Ignore:
Timestamp:
Jan 8, 2011, 8:13:43 PM (13 years ago)
Author:
Torben Dannhauer
Message:

XML configuration now works also with dataIO extLink

File:
1 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/trunk/src/extLink/dataIO_extLinkVCL.cpp

    r121 r186  
    3131}
    3232
    33 void dataIO_extLinkVCL::init()
    34 {
     33bool dataIO_extLinkVCL::init(xmlNode* configurationNode)
     34{
     35        if (!configurationNode || !processXMLConfiguration(configurationNode))
     36                return false;
     37
    3538        OSG_NOTIFY( osg::ALWAYS ) << "extLinkVCL init()" << std::endl;
    3639
    37         VCLConfigFilename = "osgVisual.xml";
    38        
    3940        if ( osgDB::fileExists( VCLConfigFilename ) )
    4041        {
     
    4748        else
    4849        {
    49                 OSG_NOTIFY( osg::FATAL ) << "ERROR: Could not find VCL Configuration file " << VCLConfigFilename << std::endl;
    50                 exit(-1);
    51         }
    52 
     50                OSG_NOTIFY( osg::FATAL ) << "ERROR: Could not find VCL Configuration file '" << VCLConfigFilename << "', falling back to extLinkDummy" << std::endl;
     51                return false;
     52        }
     53        return true;
     54}
     55
     56bool dataIO_extLinkVCL::processXMLConfiguration(xmlNode* extLinkConfig_)
     57{
     58        // Extract VCL config file
     59        xmlAttr  *attr = extLinkConfig_->properties;
     60        while ( attr )
     61        {
     62                std::string attr_name=reinterpret_cast<const char*>(attr->name);
     63                std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     64                if( attr_name == "implementation" )
     65                {
     66                        if(attr_value != "vcl")
     67                        {
     68                                OSG_NOTIFY( osg::ALWAYS ) << "WARNING: extLink configuration does not match the currently used 'vcl' implementation, falling back to extLinkDummy" << std::endl;
     69                                return false;
     70                        }
     71                }
     72                if( attr_name == "filename" )
     73                {
     74                        VCLConfigFilename = attr_value;
     75                }
     76                attr = attr->next;
     77        }       // WHILE attrib END
     78
     79        return true;
    5380}
    5481
Note: See TracChangeset for help on using the changeset viewer.