Ignore:
Timestamp:
Nov 9, 2010, 10:37:40 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

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

    r146 r151  
    146146                if (cur_node->type == XML_ELEMENT_NODE)
    147147                {
    148                         std::string node_name=reinterpret_cast<const char*>(cur_node->name);
    149                         if (node_name == "module")
     148                        // Extract Node Name and the first attribute: "module name"
     149                        std::string node_name = reinterpret_cast<const char*>(cur_node->name);
     150                        std::string modName = "";
     151                        xmlAttr  *attr = cur_node->properties;
     152                        while ( attr )
     153                        {
     154                                std::string attr_name=reinterpret_cast<const char*>(attr->name);
     155                                std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     156                                if( attr_name == "name" )
     157                                        modName = attr_value;
     158                                attr = attr->next;
     159                        }
     160                       
     161                        // Check each node for the searched module
     162                        if (node_name == "module" && modName == moduleName)
    150163                        {
    151                                 OSG_DEBUG << "XML node module found" << std::endl;
    152                                 return cur_node;
     164                                // Check if the module is active
     165                                xmlAttr  *attr = cur_node->properties;
     166                                while ( attr )
     167                                {
     168                                        std::string attr_name=reinterpret_cast<const char*>(attr->name);
     169                                        std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     170                                        if( attr_name == "enabled" && attr_value == "yes" )
     171                                        {
     172                                                OSG_ALWAYS << "Found XML module configuration for " << moduleName << std::endl;
     173                                                return cur_node;
     174                                        }
     175                                        if( attr_name == "enabled" && attr_value == "no" )
     176                                        {
     177                                                OSG_ALWAYS << "Found XML module configuration for " << moduleName << ", but it is DISABLED." << std::endl;
     178                                                return NULL;
     179                                        }
     180                                        attr = attr->next;
     181                                }
    153182                        }
    154183                        else    // Otherwise: check its children..
Note: See TracChangeset for help on using the changeset viewer.