From 1fa48e7edb2d0f68ec32a5c5058719f9c214f609 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sun, 15 Mar 2020 14:24:02 +0100 Subject: [PATCH] File readind is not of the SG_INPUT class s change it to SG_IO and make all warinigs and alerts developer-warings and developer-alerts --- simgear/scene/model/ModelRegistry.cxx | 18 ++++++++-------- simgear/scene/model/SGMaterialAnimation.cxx | 6 +++--- simgear/scene/model/SGPickAnimation.cxx | 10 ++++----- simgear/scene/model/SGReaderWriterXML.cxx | 12 +++++------ simgear/scene/model/SGTrackToAnimation.cxx | 12 +++++------ simgear/scene/model/animation.cxx | 24 ++++++++++----------- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/simgear/scene/model/ModelRegistry.cxx b/simgear/scene/model/ModelRegistry.cxx index 37c746cb..3178d206 100644 --- a/simgear/scene/model/ModelRegistry.cxx +++ b/simgear/scene/model/ModelRegistry.cxx @@ -285,7 +285,7 @@ ModelRegistry::readImage(const string& fileName, string absFileName = SGModelLib::findDataFile(fileName, opt); string originalFileName = absFileName; if (!fileExists(absFileName)) { - SG_LOG(SG_IO, SG_ALERT, "Cannot find image file \"" + SG_LOG(SG_IO, SG_DEV_ALERT, "Cannot find image file \"" << fileName << "\""); return ReaderWriter::ReadResult::FILE_NOT_FOUND; } @@ -329,7 +329,7 @@ ModelRegistry::readImage(const string& fileName, hash = f.computeHash(); } catch (sg_io_exception &e) { - SG_LOG(SG_INPUT, SG_ALERT, "Modelregistry::failed to compute filehash '" << absFileName << "' " << e.getFormattedMessage()); + SG_LOG(SG_IO, SG_DEV_ALERT, "Modelregistry::failed to compute filehash '" << absFileName << "' " << e.getFormattedMessage()); hash = std::string(); } } @@ -407,12 +407,12 @@ ModelRegistry::readImage(const string& fileName, } if (pot_message.size()) - SG_LOG(SG_IO, SG_WARN, pot_message << " " << absFileName); + SG_LOG(SG_IO, SG_DEV_WARN, pot_message << " " << absFileName); // unlikely that after resizing in height the width will still be outside of the max texture size. if (height > max_texture_size) { - SG_LOG(SG_IO, SG_WARN, "Image texture too high (max " << max_texture_size << ") " << width << "," << height << " " << absFileName); + SG_LOG(SG_IO, SG_DEV_WARN, "Image texture too high (max " << max_texture_size << ") " << width << "," << height << " " << absFileName); int factor = height / max_texture_size; height /= factor; width /= factor; @@ -420,7 +420,7 @@ ModelRegistry::readImage(const string& fileName, } if (width > max_texture_size) { - SG_LOG(SG_IO, SG_WARN, "Image texture too wide (max " << max_texture_size << ") " << width << "," << height << " " << absFileName); + SG_LOG(SG_IO, SG_DEV_WARN, "Image texture too wide (max " << max_texture_size << ") " << width << "," << height << " " << absFileName); int factor = width / max_texture_size; height /= factor; width /= factor; @@ -488,7 +488,7 @@ ModelRegistry::readImage(const string& fileName, if (processor) { - SG_LOG(SG_IO, SG_ALERT, "Creating " << targetFormat << " for " + absFileName); + SG_LOG(SG_IO, SG_DEV_ALERT, "Creating " << targetFormat << " for " + absFileName); // normal maps: // nvdxt.exe - quality_highest - rescaleKaiser - Kaiser - dxt5nm - norm processor->compress(*srcImage, targetFormat, true, true, osgDB::ImageProcessor::USE_CPU, osgDB::ImageProcessor::PRODUCTION); @@ -528,11 +528,11 @@ ModelRegistry::readImage(const string& fileName, absFileName = newName; } catch (...) { - SG_LOG(SG_IO, SG_ALERT, "Exception processing " << absFileName << " may be corrupted"); + SG_LOG(SG_IO, SG_DEV_ALERT, "Exception processing " << absFileName << " may be corrupted"); } } else - SG_LOG(SG_IO, SG_WARN, absFileName + " too small " << width << "," << height); + SG_LOG(SG_IO, SG_DEV_WARN, absFileName + " too small " << width << "," << height); } } } @@ -546,7 +546,7 @@ ModelRegistry::readImage(const string& fileName, res = registry->readImageImplementation(absFileName, opt); if (!res.success()) { - SG_LOG(SG_IO, SG_WARN, "Image loading failed:" << res.message()); + SG_LOG(SG_IO, SG_DEV_WARN, "Image loading failed:" << res.message()); return res; } diff --git a/simgear/scene/model/SGMaterialAnimation.cxx b/simgear/scene/model/SGMaterialAnimation.cxx index 065631e2..c380d9e6 100644 --- a/simgear/scene/model/SGMaterialAnimation.cxx +++ b/simgear/scene/model/SGMaterialAnimation.cxx @@ -381,9 +381,9 @@ public: osg::StateAttribute::ON); } } else { - SG_LOG(SG_IO, SG_WARN, "texture animation: requested texture : " << textureName << " not found. Searched paths:" ); + SG_LOG(SG_IO, SG_DEV_WARN, "texture animation: requested texture : " << textureName << " not found. Searched paths:" ); for( osgDB::FilePathList::iterator it = _texturePathList.begin(); it != _texturePathList.end(); ++it ) { - SG_LOG(SG_IO, SG_WARN, " - " << *it ); + SG_LOG(SG_IO, SG_DEV_WARN, " - " << *it ); } } } @@ -420,7 +420,7 @@ SGMaterialAnimation::SGMaterialAnimation(simgear::SGTransientModelData &modelDat SGAnimation(modelData), texturePathList(modelData.getOptions()->getDatabasePathList()) { if (modelData.getConfigNode()->hasChild("global")) - SG_LOG(SG_IO, SG_ALERT, modelData.getPath() << + SG_LOG(SG_IO, SG_DEV_ALERT, modelData.getPath() << ": Use of in material animation is " "no longer supported."); } diff --git a/simgear/scene/model/SGPickAnimation.cxx b/simgear/scene/model/SGPickAnimation.cxx index 9f2a9eac..943c021a 100644 --- a/simgear/scene/model/SGPickAnimation.cxx +++ b/simgear/scene/model/SGPickAnimation.cxx @@ -186,7 +186,7 @@ osg::Vec2d eventToWindowCoords(const osgGA::GUIEventAdapter& ea) osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _texX(x), _texY(y), _mask(mask), _done(false) { - SG_LOG(SG_INPUT, SG_DEBUG, "VncVisitor constructor " + SG_LOG(SG_IO, SG_DEBUG, "VncVisitor constructor " << x << "," << y << " mask " << mask); } @@ -240,7 +240,7 @@ osg::Vec2d eventToWindowCoords(const osgGA::GUIEventAdapter& ea) int pixX = _texX * img->s(); int pixY = _texY * img->t(); _done = img->sendPointerEvent(pixX, pixY, _mask); - SG_LOG(SG_INPUT, SG_DEBUG, "VncVisitor image said " << _done + SG_LOG(SG_IO, SG_DEBUG, "VncVisitor image said " << _done << " to coord " << pixX << "," << pixY); } } @@ -267,7 +267,7 @@ public: : _condition(condition) , _node(node) { - SG_LOG(SG_INPUT, SG_DEBUG, "Configuring VNC callback"); + SG_LOG(SG_IO, SG_DEBUG, "Configuring VNC callback"); const char *cornernames[3] = {"top-left", "top-right", "bottom-left"}; SGVec3d *cornercoords[3] = {&_topLeft, &_toRight, &_toDown}; for (int c =0; c < 3; c++) { @@ -289,7 +289,7 @@ public: { if (!_condition || _condition->test()) { SGVec3d loc(info.local); - SG_LOG(SG_INPUT, SG_DEBUG, "VNC pressed " << button << ": " << loc); + SG_LOG(SG_IO, SG_DEBUG, "VNC pressed " << button << ": " << loc); loc -= _topLeft; _x = dot(loc, _toRight) / _squaredRight; _y = dot(loc, _toDown) / _squaredDown; @@ -307,7 +307,7 @@ public: { if (!_condition || _condition->test()) { SG_UNUSED(keyModState); - SG_LOG(SG_INPUT, SG_DEBUG, "VNC release"); + SG_LOG(SG_IO, SG_DEBUG, "VNC release"); VncVisitor vv(_x, _y, 0); _node->accept(vv); } diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index adb86e41..7084c3a3 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -95,7 +95,7 @@ SGReaderWriterXML::readNode(const std::string& name, int num_anims; std::tie(num_anims, result) = sgLoad3DModel_internal(p, options); } catch (const sg_exception &t) { - SG_LOG(SG_INPUT, SG_ALERT, "Failed to load model: " << t.getFormattedMessage() + SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load model: " << t.getFormattedMessage() << "\n\tfrom:" << fileName); result=new osg::Node; } @@ -264,7 +264,7 @@ sgLoad3DModel_internal(const SGPath& path, SGPropertyNode *overlay) { if (!path.exists()) { - SG_LOG(SG_INPUT, SG_ALERT, "Failed to load file: \"" << path << "\""); + SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load file: \"" << path << "\""); return std::make_tuple(0, (osg::Node *) NULL); } @@ -293,7 +293,7 @@ sgLoad3DModel_internal(const SGPath& path, try { readProperties(modelpath, props); } catch (const sg_exception &t) { - SG_LOG(SG_INPUT, SG_ALERT, "Failed to load xml: " + SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load xml: " << t.getFormattedMessage()); throw; } @@ -414,7 +414,7 @@ sgLoad3DModel_internal(const SGPath& path, NULL, modelDir); if (submodelPath.isNull()) { - SG_LOG(SG_INPUT, SG_ALERT, "Failed to load file: \"" << subPathStr << "\""); + SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load file: \"" << subPathStr << "\""); continue; } @@ -433,7 +433,7 @@ sgLoad3DModel_internal(const SGPath& path, sub_props->getNode("overlay")); animationcount += num_anims; } catch (const sg_exception &t) { - SG_LOG(SG_INPUT, SG_ALERT, "Failed to load submodel: " << t.getFormattedMessage() + SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load submodel: " << t.getFormattedMessage() << "\n\tfrom:" << t.getOrigin()); continue; } @@ -484,7 +484,7 @@ sgLoad3DModel_internal(const SGPath& path, // Load panels vector panel_nodes = props->getChildren("panel"); for (unsigned i = 0; i < panel_nodes.size(); i++) { - SG_LOG(SG_INPUT, SG_DEBUG, "Loading a panel"); + SG_LOG(SG_IO, SG_DEBUG, "Loading a panel"); osg::ref_ptr panel = load_panel(panel_nodes[i]); if (panel_nodes[i]->hasValue("name")) panel->setName(panel_nodes[i]->getStringValue("name")); diff --git a/simgear/scene/model/SGTrackToAnimation.cxx b/simgear/scene/model/SGTrackToAnimation.cxx index 2705a566..e4f4e47b 100644 --- a/simgear/scene/model/SGTrackToAnimation.cxx +++ b/simgear/scene/model/SGTrackToAnimation.cxx @@ -69,7 +69,7 @@ class FindGroupVisitor: _group(0) { if( name.empty() ) - SG_LOG(SG_IO, SG_WARN, "FindGroupVisitor: empty name provided"); + SG_LOG(SG_IO, SG_DEV_WARN, "FindGroupVisitor: empty name provided"); } osg::Group* getGroup() const @@ -91,7 +91,7 @@ class FindGroupVisitor: SG_LOG ( SG_IO, - SG_WARN, + SG_DEV_WARN, "FindGroupVisitor: name not unique '" << _name << "'" ); } @@ -154,7 +154,7 @@ class SGTrackToAnimation::UpdateCallback: if( _lock_axis.normalize() == 0.0 ) { - anim->log(SG_WARN, "invalid lock-axis"); + anim->log(SG_DEV_WARN, "invalid lock-axis"); _lock_axis.set(0, 1, 0); } @@ -184,7 +184,7 @@ class SGTrackToAnimation::UpdateCallback: if( _slave_dof < 2 ) // Without slave_dof >= 2, can not rotate out of plane normal to // lock axis. - anim->log(SG_WARN, "track-axis not perpendicular to lock-axis"); + anim->log(SG_DEV_WARN, "track-axis not perpendicular to lock-axis"); // Make tracking axis perpendicular to locked axis _track_axis -= _lock_axis * proj; @@ -192,7 +192,7 @@ class SGTrackToAnimation::UpdateCallback: if( _track_axis.normalize() == 0.0 ) { - anim->log(SG_WARN, "invalid track-axis"); + anim->log(SG_DEV_WARN, "invalid track-axis"); if( std::fabs(_lock_axis.x()) < 0.1 ) _track_axis.set(1, 0, 0); else @@ -383,7 +383,7 @@ SGTrackToAnimation::SGTrackToAnimation(simgear::SGTransientModelData &modelData) modelData.getNode()->accept(target_finder); if( !(_target_group = target_finder.getGroup()) ) - log(SG_ALERT, "target not found: '" + target + '\''); + log(SG_DEV_ALERT, "target not found: '" + target + '\''); std::string slave = modelData.getConfigNode()->getStringValue("slave-name"); if( !slave.empty() ) diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index 8f50e5ff..f095123a 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -455,9 +455,9 @@ SGAnimation::~SGAnimation() } if (!info.empty()) { - SG_LOG(SG_IO, SG_ALERT, "Could not find at least one of the following" + SG_LOG(SG_IO, SG_DEV_ALERT, "Could not find at least one of the following" " objects for animation: " << info); - SG_LOG(SG_IO, SG_ALERT, " in file: " << _modelData.getPath()); + SG_LOG(SG_IO, SG_DEV_ALERT, " in file: " << _modelData.getPath()); } } } @@ -673,7 +673,7 @@ public: _group(0) { if (name.empty()) - SG_LOG(SG_IO, SG_WARN, "FindGroupVisitor: empty name provided"); + SG_LOG(SG_IO, SG_DEV_WARN, "FindGroupVisitor: empty name provided"); } osg::Group* getGroup() const @@ -695,7 +695,7 @@ public: SG_LOG ( SG_IO, - SG_WARN, + SG_DEV_WARN, "FindGroupVisitor: name not unique '" << _name << "'" ); } @@ -774,13 +774,13 @@ bool SGAnimation::setCenterAndAxisFromObject(osg::Node *rootNode, SGVec3d& cente object_group->setNodeMask(0); } else { - SG_LOG(SG_INPUT, SG_ALERT, "Could not find a valid line segment for animation: " << axis_object_name); - SG_LOG(SG_IO, SG_ALERT, " in file: " << _modelData.getPath()); + SG_LOG(SG_IO, SG_DEV_ALERT, "Could not find a valid line segment for animation: " << axis_object_name); + SG_LOG(SG_IO, SG_DEV_ALERT, " in file: " << _modelData.getPath()); } } else if (can_warn) { - SG_LOG(SG_INPUT, SG_ALERT, "Could not find at least one of the following objects for axis animation: " << axis_object_name); - SG_LOG(SG_IO, SG_ALERT, " in file: " << _modelData.getPath()); + SG_LOG(SG_IO, SG_DEV_ALERT, "Could not find at least one of the following objects for axis animation: " << axis_object_name); + SG_LOG(SG_IO, SG_DEV_ALERT, " in file: " << _modelData.getPath()); } } if (axisSegment) @@ -2398,14 +2398,14 @@ SGTexTransformAnimation::createAnimationGroup(osg::Group& parent) else if (subtype == "textrapezoid") appendTexTrapezoid(*transformConfigs[i], updateCallback); else { - SG_LOG(SG_INPUT, SG_ALERT, + SG_LOG(SG_IO, SG_DEV_ALERT, "Ignoring unknown texture transform subtype"); - SG_LOG(SG_IO, SG_ALERT, " in file: " << _modelData.getPath()); + SG_LOG(SG_IO, SG_DEV_ALERT, " in file: " << _modelData.getPath()); } } } else { - SG_LOG(SG_INPUT, SG_ALERT, "Ignoring unknown texture transform type"); - SG_LOG(SG_IO, SG_ALERT, " in file: " << _modelData.getPath()); + SG_LOG(SG_IO, SG_DEV_ALERT, "Ignoring unknown texture transform type"); + SG_LOG(SG_IO, SG_DEV_ALERT, " in file: " << _modelData.getPath()); } texMat->setUpdateCallback(updateCallback);