- Timestamp:
- Nov 9, 2010, 10:56:41 PM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/include/util/visual_util.h
r151 r152 239 239 * @param moduleName : Module name to search for. 240 240 * @param doc : xmlDoc to use. Must be created outside that the caller can clean it up. 241 * @param disabled : Contains after return if the module was disabled. Only true if valid configuration and definitely disabled. 241 242 * @return : NULL on error, otherwise pointer to the xmlNode of the queried module. 242 243 */ 243 static xmlNode* getModuleXMLConfig(std::string configFilename, std::string moduleName, xmlDoc*& doc );244 static xmlNode* getModuleXMLConfig(std::string configFilename, std::string moduleName, xmlDoc*& doc, bool& disabled); 244 245 245 246 /** … … 260 261 * @param node : Node to search in 261 262 * @param moduleName :Module name to search for. 263 * @param disabled : Contains after return if the module was disabled. Only true if valid configuration and definitely disabled. 262 264 * @return : NULL if the module configuration was not found, otherwise pointer to the XML Node with the configuration for the specified module. 263 265 */ 264 static xmlNode* checkXMLNodeChildrenForModule(xmlNode* node, std::string moduleName );266 static xmlNode* checkXMLNodeChildrenForModule(xmlNode* node, std::string moduleName, bool& disabled); 265 267 266 268 /** -
osgVisual/src/distortion/visual_distortion.cpp
r151 r152 44 44 // Init XML 45 45 xmlDoc* tmpDoc; 46 xmlNode* config = util::getModuleXMLConfig( configFileName, "distortion", tmpDoc ); 46 bool disabled; 47 xmlNode* config = util::getModuleXMLConfig( configFileName, "distortion", tmpDoc, disabled ); 48 49 if( disabled) 50 { 51 OSG_NOTIFY( osg::ALWAYS ) << "..disabled by XML configuration file." << std::endl; 52 return false; 53 } 47 54 48 55 // extract configuration values 49 56 if(config) 50 57 { 51 OSG_NOTIFY( osg::ALWAYS ) << " Using distortion." << std::endl;58 OSG_NOTIFY( osg::ALWAYS ) << "..using distortion." << std::endl; 52 59 53 60 xmlNode* a_node = config->children; … … 164 171 else 165 172 { 166 OSG_WARN << " WARNING: visual_distortion::processXMLConfiguration() - Module configuration not found or module disabled!" << std::endl;173 OSG_WARN << "ERROR: visual_distortion::processXMLConfiguration() - Module configuration not found" << std::endl; 167 174 return false; 168 175 } … … 175 182 osg::Group* visual_distortion::initialize(osg::Group* subgraph, const osg::Vec4& clearColor ) 176 183 { 177 OSG_NOTIFY (osg::ALWAYS ) << "visual_distortion initialize.. ." << std::endl;184 OSG_NOTIFY (osg::ALWAYS ) << "visual_distortion initialize.."; // The sentence is finished by the init result... 178 185 179 186 // Initialize variables: -
osgVisual/src/util/visual_util.cpp
r151 r152 89 89 } 90 90 91 xmlNode* util::getModuleXMLConfig(std::string configFilename, std::string moduleName, xmlDoc*& doc )91 xmlNode* util::getModuleXMLConfig(std::string configFilename, std::string moduleName, xmlDoc*& doc, bool& disabled) 92 92 { 93 93 doc = NULL; 94 disabled = false; 94 95 xmlNode *root_element = NULL; 95 96 … … 126 127 127 128 // 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 : clenaup. 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. 131 132 { 132 133 xmlFreeDoc(doc); // free the document … … 139 140 } 140 141 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 elements142 xmlNode* 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 144 145 { 145 146 // Is the node the one we are searching for? … … 170 171 if( attr_name == "enabled" && attr_value == "yes" ) 171 172 { 172 OSG_ ALWAYS<< "Found XML module configuration for " << moduleName << std::endl;173 OSG_DEBUG << "Found XML module configuration for " << moduleName << std::endl; 173 174 return cur_node; 174 175 } 175 176 if( attr_name == "enabled" && attr_value == "no" ) 176 177 { 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; 178 180 return NULL; 179 181 } … … 183 185 else // Otherwise: check its children.. 184 186 { 185 xmlNode* tmp_XmlNode = checkXMLNodeChildrenForModule(cur_node->children, moduleName );187 xmlNode* tmp_XmlNode = checkXMLNodeChildrenForModule(cur_node->children, moduleName, disabled); 186 188 if(tmp_XmlNode) 187 189 return tmp_XmlNode;
Note: See TracChangeset
for help on using the changeset viewer.