Ignore:
Timestamp:
Nov 9, 2010, 10:56:41 PM (13 years ago)
Author:
Torben Dannhauer
Message:

Silverlining, Distortion now uses XMl configuration file for configuration.

Todo: vista2D and the whole dataIO tree.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/src/util/visual_util.cpp

    r151 r152  
    8989}
    9090
    91 xmlNode* util::getModuleXMLConfig(std::string configFilename, std::string moduleName, xmlDoc*& doc)
     91xmlNode* util::getModuleXMLConfig(std::string configFilename, std::string moduleName, xmlDoc*& doc, bool& disabled)
    9292{
    9393        doc = NULL;
     94        disabled = false;
    9495        xmlNode *root_element = NULL;
    9596
     
    126127
    127128        // If file is a valid osgVisual config file, check all the root xml node and all of it's children of osgvisualconfiguration for the specified module
    128         xmlNode* tmpNode = checkXMLNodeChildrenForModule(root_element, moduleName);
    129 
    130         if( !tmpNode ) // if no valid node was found: clena up. Otherwise: the caller has to clean up.
     129        xmlNode* tmpNode = checkXMLNodeChildrenForModule(root_element, moduleName, disabled);
     130
     131        if( !tmpNode ) // if no valid node was found or the module is disabled: clean up. Otherwise: the caller has to clean up.
    131132        {
    132133                xmlFreeDoc(doc);        // free the document
     
    139140}
    140141
    141 xmlNode* util::checkXMLNodeChildrenForModule(xmlNode* node, std::string moduleName)
    142 {
    143         for (xmlNode *cur_node = node; cur_node; cur_node = cur_node->next)     // iterate through all elements
     142xmlNode* util::checkXMLNodeChildrenForModule(xmlNode* node, std::string moduleName, bool& disabled)
     143{
     144        for (xmlNode *cur_node = node; cur_node; cur_node = cur_node->next)     // iterate through all XML elements
    144145        {
    145146                // Is the node the one we are searching for?
     
    170171                                        if( attr_name == "enabled" && attr_value == "yes" )
    171172                                        {
    172                                                 OSG_ALWAYS << "Found XML module configuration for " << moduleName << std::endl;
     173                                                OSG_DEBUG << "Found XML module configuration for " << moduleName << std::endl;
    173174                                                return cur_node;
    174175                                        }
    175176                                        if( attr_name == "enabled" && attr_value == "no" )
    176177                                        {
    177                                                 OSG_ALWAYS << "Found XML module configuration for " << moduleName << ", but it is DISABLED." << std::endl;
     178                                                disabled = true;
     179                                                OSG_DEBUG << "Found XML module configuration for " << moduleName << ", but it is DISABLED." << std::endl;
    178180                                                return NULL;
    179181                                        }
     
    183185                        else    // Otherwise: check its children..
    184186                        {
    185                                 xmlNode* tmp_XmlNode = checkXMLNodeChildrenForModule(cur_node->children, moduleName);
     187                                xmlNode* tmp_XmlNode = checkXMLNodeChildrenForModule(cur_node->children, moduleName, disabled);
    186188                                if(tmp_XmlNode)
    187189                                        return tmp_XmlNode;
Note: See TracChangeset for help on using the changeset viewer.