diff --git a/src/osgPlugins/Inventor/ConvertFromInventor.cpp b/src/osgPlugins/Inventor/ConvertFromInventor.cpp index 93a97decc..eac2e7a99 100644 --- a/src/osgPlugins/Inventor/ConvertFromInventor.cpp +++ b/src/osgPlugins/Inventor/ConvertFromInventor.cpp @@ -104,7 +104,7 @@ ConvertFromInventor::restructure(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "restructure() " + OSG_DEBUG << NOTIFY_HEADER << "restructure() " << node->getTypeId().getName().getString(); #endif @@ -179,11 +179,15 @@ ConvertFromInventor::restructure(void* data, SoCallbackAction* action, #ifdef DEBUG_IV_PLUGIN if (numModifiedChildren == 0) - osg::notify(osg::DEBUG_INFO) << ": no changes necessary" << std::endl; + { + OSG_DEBUG << ": no changes necessary" << std::endl; + } else - osg::notify(osg::DEBUG_INFO) << ": " << numModifiedChildren << + { + OSG_DEBUG << ": " << numModifiedChildren << " nodes of " << childrenTotal << " restruc., " << numRemovedNodes << " removed" << std::endl; + } #endif return SoCallbackAction::CONTINUE; @@ -212,7 +216,7 @@ ConvertFromInventor::restructurePostNode(void* data, SoCallbackAction* action, if (nodesToRemove.size() > 0) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "postNode() " + OSG_DEBUG << NOTIFY_HEADER << "postNode() " << node->getTypeId().getName().getString() << " (level " << stack.size() << ") removed " << nodesToRemove.size() << " node(s)" << std::endl; @@ -235,7 +239,7 @@ void ConvertFromInventor::preprocess(SoNode* root) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "Preprocessing..." << std::endl; + OSG_DEBUG << NOTIFY_HEADER << "Preprocessing..." << std::endl; #endif SoCallbackAction action; @@ -264,7 +268,7 @@ osg::Node* ConvertFromInventor::convert(SoNode* ivRootNode) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "Converting..." << std::endl; + OSG_DEBUG << NOTIFY_HEADER << "Converting..." << std::endl; #endif // Transformation matrix for converting Inventor coordinate system to OSG @@ -376,9 +380,9 @@ notifyAboutMatrixContent(const osg::NotifySeverity level, const SbMatrix &m) SbVec3f axis; float angle; r.getValue(axis, angle); - osg::notify(level) << NOTIFY_HEADER << " Translation: " << + OSG_NOTIFY(level) << NOTIFY_HEADER << " Translation: " << t[0] << "," << t[1] << "," << t[2] << std::endl; - osg::notify(level) << NOTIFY_HEADER << " Rotation: (" << + OSG_NOTIFY(level) << NOTIFY_HEADER << " Rotation: (" << axis[0] << "," << axis[1] << "," << axis[2] << ")," << angle << std::endl; } /////////////////////////////////////////////////////////////////// @@ -415,7 +419,7 @@ ConvertFromInventor::appendNode(osg::Node *n, const SoCallbackAction *action) } #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "appendNode: " + OSG_DEBUG << NOTIFY_HEADER << "appendNode: " << n->className(); #endif @@ -427,7 +431,7 @@ ConvertFromInventor::appendNode(osg::Node *n, const SoCallbackAction *action) #ifdef DEBUG_IV_PLUGIN if (osg::isNotifyEnabled(osg::DEBUG_INFO)) - osg::notify(osg::DEBUG_INFO) << + OSG_DEBUG << " uses parent transformation" << std::endl; #endif @@ -448,7 +452,7 @@ ConvertFromInventor::appendNode(osg::Node *n, const SoCallbackAction *action) #ifdef DEBUG_IV_PLUGIN if (osg::isNotifyEnabled(osg::DEBUG_INFO)) - osg::notify(osg::DEBUG_INFO) << + OSG_DEBUG << " reuses previous transformation" << std::endl; #endif @@ -467,7 +471,7 @@ ConvertFromInventor::appendNode(osg::Node *n, const SoCallbackAction *action) #ifdef DEBUG_IV_PLUGIN if (osg::isNotifyEnabled(osg::DEBUG_INFO)) { - osg::notify(osg::DEBUG_INFO) << + OSG_DEBUG << " uses local transformation:" << std::endl; notifyAboutMatrixContent(osg::DEBUG_INFO, SbMatrix((SbMat&)(*osg::Matrixf(m).ptr()))); @@ -538,7 +542,7 @@ ConvertFromInventor::preNode(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preNode() " + OSG_DEBUG << NOTIFY_HEADER << "preNode() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -549,7 +553,7 @@ ConvertFromInventor::preNode(void* data, SoCallbackAction* action, thisPtr->ivPushState(action, node); #ifdef DEBUG_IV_PLUGIN if (osg::isNotifyEnabled(osg::DEBUG_INFO)) { - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "push state, saved values: " << std::endl; + OSG_DEBUG << NOTIFY_HEADER << "push state, saved values: " << std::endl; notifyAboutMatrixContent(osg::DEBUG_INFO, action->getModelMatrix()); } #endif @@ -563,7 +567,7 @@ ConvertFromInventor::postNode(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "postNode() " + OSG_DEBUG << NOTIFY_HEADER << "postNode() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -576,7 +580,7 @@ ConvertFromInventor::postNode(void* data, SoCallbackAction* action, #ifdef DEBUG_IV_PLUGIN if (osg::isNotifyEnabled(osg::DEBUG_INFO)) { - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << + OSG_DEBUG << NOTIFY_HEADER << "pop state, restored transformation: " << std::endl; notifyAboutMatrixContent(osg::DEBUG_INFO, action->getModelMatrix()); } @@ -591,7 +595,7 @@ ConvertFromInventor::preTransformSeparator(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preTransformSeparator() " + OSG_DEBUG << NOTIFY_HEADER << "preTransformSeparator() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -608,7 +612,7 @@ ConvertFromInventor::postTransformSeparator(void* data, SoCallbackAction* action const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "postTransformSeparator() " + OSG_DEBUG << NOTIFY_HEADER << "postTransformSeparator() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -625,7 +629,7 @@ ConvertFromInventor::preLOD(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preLOD() " + OSG_DEBUG << NOTIFY_HEADER << "preLOD() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -683,7 +687,7 @@ ConvertFromInventor::postLOD(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "postLOD() " + OSG_DEBUG << NOTIFY_HEADER << "postLOD() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -709,7 +713,7 @@ ConvertFromInventor::postLOD(void* data, SoCallbackAction* action, int num = lod->getNumChildren(); if (ivLOD->range.getNum()+1 != num && !(num == 0 && ivLOD->range.getNum() == 0)) { - osg::notify(osg::WARN) << NOTIFY_HEADER << + OSG_WARN << NOTIFY_HEADER << "Warning: SoLOD does not contain " "correct data in range field." << std::endl; if (ivLOD->range.getNum()+1 < num) { @@ -732,7 +736,7 @@ ConvertFromInventor::postLOD(void* data, SoCallbackAction* action, } #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << + OSG_DEBUG << NOTIFY_HEADER << "Appending osg::LOD with " << num << " children." << std::endl; #endif @@ -751,7 +755,7 @@ ConvertFromInventor::preShape(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preShape() " + OSG_DEBUG << NOTIFY_HEADER << "preShape() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -850,7 +854,7 @@ ConvertFromInventor::postShape(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "postShape() " + OSG_DEBUG << NOTIFY_HEADER << "postShape() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -906,14 +910,21 @@ ConvertFromInventor::postShape(void* data, SoCallbackAction* action, if (thisPtr->textureCoords.empty()) - osg::notify(osg::DEBUG_INFO)<<"tex coords not found"<getNumTextureCoordinates()>0) - osg::notify(osg::DEBUG_INFO)<<"tex coords found"<getTypeId().getName().getString(); if (node->isOfType(SoTexture2::getClassTypeId())) { SoTexture2 *t = (SoTexture2*)node; if (t->filename.getValue().getLength()) - osg::notify(osg::DEBUG_INFO) << " " << t->filename.getValue().getString(); + OSG_DEBUG << " " << t->filename.getValue().getString(); } - osg::notify(osg::DEBUG_INFO) << std::endl; + OSG_DEBUG << std::endl; #endif ConvertFromInventor* thisPtr = (ConvertFromInventor *) (data); @@ -1056,7 +1067,7 @@ ConvertFromInventor::preLight(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preLight() " + OSG_DEBUG << NOTIFY_HEADER << "preLight() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -1181,7 +1192,7 @@ ConvertFromInventor::preEnvironment(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preLight() " + OSG_DEBUG << NOTIFY_HEADER << "preLight() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -1212,7 +1223,7 @@ convertShader(osg::Shader::Type osgShaderType, if (ivShader->sourceType.getValue() == SoShaderObject::GLSL_PROGRAM) osgShader->setShaderSource(ivShader->sourceProgram.getValue().getString()); else { - osg::notify(osg::WARN) << NOTIFY_HEADER << "Can not convert " + OSG_WARN << NOTIFY_HEADER << "Can not convert " << "shader. Unsupported shader language." << std::endl; return false; } @@ -1226,7 +1237,7 @@ ConvertFromInventor::preShaderProgram(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preShaderProgram() " + OSG_DEBUG << NOTIFY_HEADER << "preShaderProgram() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -1262,13 +1273,13 @@ ConvertFromInventor::preShaderProgram(void* data, SoCallbackAction* action, // Create OSG shader osg::Program *osgProgram = new osg::Program(); if (!convertShader(osg::Shader::VERTEX, ivVertexShader, osgProgram)) - osg::notify(osg::WARN) << NOTIFY_HEADER + OSG_WARN << NOTIFY_HEADER << "Failed to add vertex shader." << std::endl; if (!convertShader(osg::Shader::GEOMETRY, ivGeometryShader, osgProgram)) - osg::notify(osg::WARN) << NOTIFY_HEADER + OSG_WARN << NOTIFY_HEADER << "Failed to add geometry shader." << std::endl; if (!convertShader(osg::Shader::FRAGMENT, ivFragmentShader, osgProgram)) - osg::notify(osg::WARN) << NOTIFY_HEADER + OSG_WARN << NOTIFY_HEADER << "Failed to add fragment shader." << std::endl; // Put shader to the state stack @@ -1276,7 +1287,7 @@ ConvertFromInventor::preShaderProgram(void* data, SoCallbackAction* action, #else - osg::notify(osg::WARN) << NOTIFY_HEADER << "Warning: The model " + OSG_WARN << NOTIFY_HEADER << "Warning: The model " "contains shaders while your Inventor does not support " "them." << std::endl; #endif @@ -1344,7 +1355,7 @@ ConvertFromInventor::getStateSet(SoCallbackAction* action) texEnv->setMode(osg::TexEnv::REPLACE); break; default: - osg::notify(osg::WARN) << "Unsupported TexEnv mode." << std::endl; + OSG_WARN << "Unsupported TexEnv mode." << std::endl; break; } @@ -1525,7 +1536,7 @@ ConvertFromInventor::convertIVTexToOSGTex(const SoNode* soNode, SoCallbackAction* action) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER + OSG_DEBUG << NOTIFY_HEADER << "convertIVTexToOSGTex (" << soNode->getTypeId().getName().getString() << ")" << std::endl; @@ -1537,7 +1548,7 @@ ConvertFromInventor::convertIVTexToOSGTex(const SoNode* soNode, // Get the texture size and components const unsigned char* soImageData = action->getTextureImage(soSize, soNC); if (!soImageData) { - osg::notify(osg::WARN) << NOTIFY_HEADER + OSG_WARN << NOTIFY_HEADER << "Warning: Error while loading texture data." << std::endl; return NULL; } @@ -1562,19 +1573,19 @@ ConvertFromInventor::convertIVTexToOSGTex(const SoNode* soNode, ((SoVRMLImageTexture*)soNode)->url.getValues(0)[0].getString() : ""; #endif else - osg::notify(osg::WARN) << NOTIFY_HEADER + OSG_WARN << NOTIFY_HEADER << " Warning: Unsupported texture type: " << soNode->getTypeId().getName().getString() << std::endl; #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER + OSG_DEBUG << NOTIFY_HEADER << " Converting file name: " << fileName << " -> "; #endif if (fileName[0]=='\"') fileName.erase(fileName.begin()); if (fileName.size() > 0 && fileName[fileName.size()-1]=='\"') fileName.erase(fileName.begin()+fileName.size()-1); #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << fileName << std::endl; + OSG_DEBUG << fileName << std::endl; #endif // Create the osg::Image @@ -1630,7 +1641,7 @@ ConvertFromInventor::preInfo(void* data, SoCallbackAction* action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preInfo() " + OSG_DEBUG << NOTIFY_HEADER << "preInfo() " << node->getTypeId().getName().getString() << std::endl; #endif ConvertFromInventor* thisPtr = (ConvertFromInventor *) (data); @@ -1645,7 +1656,7 @@ ConvertFromInventor::preRotor(void *data, SoCallbackAction *action, const SoNode *node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preRotor() " + OSG_DEBUG << NOTIFY_HEADER << "preRotor() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -1693,7 +1704,7 @@ ConvertFromInventor::prePendulum(void* data, SoCallbackAction *action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "prePendulum() " + OSG_DEBUG << NOTIFY_HEADER << "prePendulum() " << node->getTypeId().getName().getString() << std::endl; #endif @@ -1752,7 +1763,7 @@ ConvertFromInventor::preShuttle(void* data, SoCallbackAction *action, const SoNode* node) { #ifdef DEBUG_IV_PLUGIN - osg::notify(osg::DEBUG_INFO) << NOTIFY_HEADER << "preShuttle() " + OSG_DEBUG << NOTIFY_HEADER << "preShuttle() " << node->getTypeId().getName().getString() << std::endl; #endif diff --git a/src/osgPlugins/Inventor/ConvertToInventor.cpp b/src/osgPlugins/Inventor/ConvertToInventor.cpp index 140ebacd1..f00205926 100644 --- a/src/osgPlugins/Inventor/ConvertToInventor.cpp +++ b/src/osgPlugins/Inventor/ConvertToInventor.cpp @@ -202,7 +202,7 @@ SoNode* ConvertToInventor::getIvSceneGraph() const void ConvertToInventor::apply(osg::Node &node) { #ifdef DEBUG_IV_WRITER - osg::notify(osg::INFO) << "IvWriter: node traversed" << std::endl; + OSG_INFO << "IvWriter: node traversed" << std::endl; #endif traverse(node); @@ -415,7 +415,7 @@ static void osgArray2ivMField(const osg::Array *array, SoMField &field, int star } }; - osg::notify(osg::WARN) << "IvWriter: No direct conversion for array. " + OSG_WARN << "IvWriter: No direct conversion for array. " << "The file may be broken." << std::endl; } @@ -484,13 +484,13 @@ bool ivProcessArray(const osg::Array *indices, const osg::Array *drawElemIndices srcField->getValues(startIndex), srcField->getNum(), drawElemIndices, numToProcess); else { - osg::notify(osg::WARN) << "IvWriter: NOT IMPLEMENTED" << std::endl; + OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl; assert(0); // FIXME: } destField->finishEditing(); if (!ok) - osg::notify(osg::WARN) << "IvWriter: Can not deindex - bug in model: index out of range." << std::endl; + OSG_WARN << "IvWriter: Can not deindex - bug in model: index out of range." << std::endl; } else { @@ -517,7 +517,7 @@ static void processIndices(const osg::Array *indices, const osg::Array *drawElem if (!indices && drawElemIndices) osgArray2ivMField(drawElemIndices, ivIndices, startIndex, stopIndex, numItemsUntilMinusOne); else { - osg::notify(osg::WARN) << "IvWriter: NOT IMPLEMENTED" << std::endl; + OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl; assert(0); // FIXME: } @@ -829,7 +829,7 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o if (ivState->osgTwoSided) { // warn if face culling is on if (ivState->osgCullFaceEnabled) - osg::notify(osg::WARN) << "IvWriter: Using face culling and two-sided lighting together! " + OSG_WARN << "IvWriter: Using face culling and two-sided lighting together! " "Ignoring face culling." << std::endl; // set two-sided lighting and backface culling off @@ -848,7 +848,7 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o if (ccw) // Warn if culling the lit faces while rendering unlit faces. // Inventor does not support this setup and it lits the unculled faces only. - osg::notify(osg::WARN) << "IvWriter: Culling was set in a way that one-sided lighting will lit the culled sides of faces. " + OSG_WARN << "IvWriter: Culling was set in a way that one-sided lighting will lit the culled sides of faces. " "Using lighting on correct faces." << std::endl; // face culling on @@ -946,9 +946,10 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o ivState->osgMaterial->getSpecularFrontAndBack() == false || ivState->osgMaterial->getEmissionFrontAndBack() == false || ivState->osgMaterial->getShininessFrontAndBack() == false) - osg::notify(osg::WARN) << "IvWriter: Model contains different materials for front and " + { + OSG_WARN << "IvWriter: Model contains different materials for front and " "back faces. This is not handled properly. Using front material only." << std::endl; - + } // Convert colors // OSG represents colors by: Vec3, Vec4,Vec4ub @@ -957,16 +958,21 @@ ConvertToInventor::InventorState* ConvertToInventor::createInventorState(const o // Although SoMaterial is used only, SoPackedColor may bring some possibilities on per-vertex // alpha and SoBaseColor may be useful on pre-lit scene. if (ivState->osgMaterial->getColorMode() != osg::Material::DIFFUSE && - ivState->osgMaterial->getColorMode() != osg::Material::OFF) { + ivState->osgMaterial->getColorMode() != osg::Material::OFF) + { - if (ivState->osgMaterial->getColorMode() == osg::Material::AMBIENT_AND_DIFFUSE) - osg::notify(osg::WARN) << "IvWriter: The model is using AMBIENT_AND_DIFFUSE material " - "mode while Inventor supports DIFFUSE mode only. " - "The model colors may not much exactly." << std::endl; - else - osg::notify(osg::WARN) << "IvWriter: The model is not using DIFFUSE material mode and " - "Inventor supports DIFFUSE mode only. " - "The model colors may not be correct." << std::endl; + if (ivState->osgMaterial->getColorMode() == osg::Material::AMBIENT_AND_DIFFUSE) + { + OSG_WARN << "IvWriter: The model is using AMBIENT_AND_DIFFUSE material " + "mode while Inventor supports DIFFUSE mode only. " + "The model colors may not much exactly." << std::endl; + } + else + { + OSG_WARN << "IvWriter: The model is not using DIFFUSE material mode and " + "Inventor supports DIFFUSE mode only. " + "The model colors may not be correct." << std::endl; + } } // Convert material components @@ -1318,7 +1324,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet } break; default: - osg::notify(osg::WARN) << "IvWriter: NOT IMPLEMENTED" << std::endl; + OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl; assert(0); } } else @@ -1346,7 +1352,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet } break; case GL_TRIANGLE_FAN: - osg::notify(osg::WARN) << "IvWriter: GL_TRIANGLE_FAN NOT IMPLEMENTED" << std::endl; + OSG_WARN << "IvWriter: GL_TRIANGLE_FAN NOT IMPLEMENTED" << std::endl; ((SoTriangleStripSet*)shape)->numVertices.setNum(1); ((SoTriangleStripSet*)shape)->numVertices.set1Value(0, elementsCount); break; @@ -1365,7 +1371,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet } break; default: - osg::notify(osg::WARN) << "IvWriter: NOT IMPLEMENTED" << std::endl; + OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl; assert(0); } } else @@ -1393,11 +1399,11 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet } break; default: - osg::notify(osg::WARN) << "IvWriter: NOT IMPLEMENTED" << std::endl; + OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl; assert(0); } } else { - osg::notify(osg::WARN) << "IvWriter: NOT IMPLEMENTED" << std::endl; + OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl; assert(0 && "Unknown non-indexed shape type."); } } @@ -1714,7 +1720,7 @@ void ConvertToInventor::processGeometry(const osg::Geometry *g, InventorState *i } default: - osg::notify(osg::WARN) << "IvWriter: NOT IMPLEMENTED" << std::endl; + OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl; } } @@ -1790,7 +1796,7 @@ void ConvertToInventor::processShapeDrawable(const osg::ShapeDrawable *d, Invent } void warnNonSupported() { - osg::notify(osg::WARN) << "IvWriter: Not supported ShapeDrawable found. Skipping it." << std::endl; + OSG_WARN << "IvWriter: Not supported ShapeDrawable found. Skipping it." << std::endl; } virtual void apply(const osg::Capsule&) { warnNonSupported(); } virtual void apply(const osg::InfinitePlane&) { warnNonSupported(); } @@ -1826,7 +1832,7 @@ void ConvertToInventor::processDrawable(osg::Drawable *d) processShapeDrawable(sd, ivDrawableState); } else - osg::notify(osg::WARN) << "IvWriter: Unsupported drawable found: \"" << d->className() << + OSG_WARN << "IvWriter: Unsupported drawable found: \"" << d->className() << "\". Skipping it." << std::endl; // Restore state @@ -1837,7 +1843,7 @@ void ConvertToInventor::processDrawable(osg::Drawable *d) void ConvertToInventor::apply(osg::Geode &node) { #ifdef DEBUG_IV_WRITER - osg::notify(osg::INFO) << "IvWriter: Geode traversed" << std::endl; + OSG_INFO << "IvWriter: Geode traversed" << std::endl; #endif // Create SoSeparator and convert StateSet for Geode @@ -1858,7 +1864,7 @@ void ConvertToInventor::apply(osg::Geode &node) void ConvertToInventor::apply(osg::Group &node) { #ifdef DEBUG_IV_WRITER - osg::notify(osg::INFO) << "IvWriter: Group traversed" << std::endl; + OSG_INFO << "IvWriter: Group traversed" << std::endl; #endif // Create SoSeparator and convert StateSet @@ -1873,7 +1879,7 @@ void ConvertToInventor::apply(osg::Group &node) void ConvertToInventor::apply(osg::Billboard& node) { #ifdef DEBUG_IV_WRITER - osg::notify(osg::INFO) << "IvWriter: Billboard traversed" << std::endl; + OSG_INFO << "IvWriter: Billboard traversed" << std::endl; #endif #ifdef __COIN__ @@ -1951,7 +1957,7 @@ void ConvertToInventor::apply(osg::Billboard& node) void ConvertToInventor::apply(osg::MatrixTransform& node) { #ifdef DEBUG_IV_WRITER - osg::notify(osg::INFO) << "IvWriter: MatrixTransform traversed" << std::endl; + OSG_INFO << "IvWriter: MatrixTransform traversed" << std::endl; #endif // Convert matrix @@ -1976,7 +1982,7 @@ void ConvertToInventor::apply(osg::MatrixTransform& node) void ConvertToInventor::apply(osg::PositionAttitudeTransform& node) { #ifdef DEBUG_IV_WRITER - osg::notify(osg::INFO) << "IvWriter: PositionAttitudeTransform traversed" << std::endl; + OSG_INFO << "IvWriter: PositionAttitudeTransform traversed" << std::endl; #endif // Convert matrix @@ -1996,7 +2002,7 @@ void ConvertToInventor::apply(osg::PositionAttitudeTransform& node) void ConvertToInventor::apply(osg::LOD& node) { #ifdef DEBUG_IV_WRITER - osg::notify(osg::INFO) << "IvWriter: LOD traversed" << std::endl; + OSG_INFO << "IvWriter: LOD traversed" << std::endl; #endif // Convert LOD @@ -2034,7 +2040,7 @@ void ConvertToInventor::apply(osg::LOD& node) } else { // undefined mode -> put warning - osg::notify(osg::WARN) << "IvWriter: Undefined LOD::RangeMode value." << std::endl; + OSG_WARN << "IvWriter: Undefined LOD::RangeMode value." << std::endl; ivLOD = new SoGroup; } diff --git a/src/osgPlugins/Inventor/ReaderWriterIV.cpp b/src/osgPlugins/Inventor/ReaderWriterIV.cpp index 3de780fdc..3f650ac1f 100644 --- a/src/osgPlugins/Inventor/ReaderWriterIV.cpp +++ b/src/osgPlugins/Inventor/ReaderWriterIV.cpp @@ -98,20 +98,28 @@ ReaderWriterIV::readNodeFromSoInput(SoInput &input, // Notify if (result.success()) { if (fileName.length()) - osg::notify(osg::NOTICE) << "osgDB::ReaderWriterIV::readNode() " + { + OSG_NOTICE << "osgDB::ReaderWriterIV::readNode() " << "File " << fileName.data() << " loaded successfully." << std::endl; + } else - osg::notify(osg::NOTICE) << "osgDB::ReaderWriterIV::readNode() " + { + OSG_NOTICE << "osgDB::ReaderWriterIV::readNode() " << "Stream loaded successfully." << std::endl; + } } else { if (fileName.length()) - osg::notify(osg::WARN) << "osgDB::ReaderWriterIV::readNode() " + { + OSG_WARN << "osgDB::ReaderWriterIV::readNode() " << "Failed to load file " << fileName.data() << "." << std::endl; + } else - osg::notify(osg::WARN) << "osgDB::ReaderWriterIV::readNode() " + { + OSG_WARN << "osgDB::ReaderWriterIV::readNode() " << "Failed to load stream." << std::endl; + } } return result; @@ -132,16 +140,16 @@ ReaderWriterIV::readNode(const std::string& file, if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; // Notify - osg::notify(osg::NOTICE) << "osgDB::ReaderWriterIV::readNode() Reading file " + OSG_NOTICE << "osgDB::ReaderWriterIV::readNode() Reading file " << fileName.data() << std::endl; - osg::notify(osg::INFO) << "osgDB::ReaderWriterIV::readNode() Inventor version: " + OSG_INFO << "osgDB::ReaderWriterIV::readNode() Inventor version: " << SoDB::getVersion() << std::endl; // Open the file SoInput input; if (!input.openFile(fileName.data())) { - osg::notify(osg::WARN) << "osgDB::ReaderWriterIV::readIVFile() " + OSG_WARN << "osgDB::ReaderWriterIV::readIVFile() " << "Cannot open file " << fileName << std::endl; return ReadResult::ERROR_IN_READING_FILE; } @@ -156,9 +164,9 @@ ReaderWriterIV::readNode(std::istream& fin, const osgDB::ReaderWriter::Options* options) const { // Notify - osg::notify(osg::NOTICE) << "osgDB::ReaderWriterIV::readNode() " + OSG_NOTICE << "osgDB::ReaderWriterIV::readNode() " "Reading from stream." << std::endl; - osg::notify(osg::INFO) << "osgDB::ReaderWriterIV::readNode() " + OSG_INFO << "osgDB::ReaderWriterIV::readNode() " "Inventor version: " << SoDB::getVersion() << std::endl; // Open the file @@ -188,7 +196,7 @@ ReaderWriterIV::readNode(std::istream& fin, } } input.setBuffer(buf, dataSize); - osg::notify(osg::INFO) << "osgDB::ReaderWriterIV::readNode() " + OSG_INFO << "osgDB::ReaderWriterIV::readNode() " "Stream size: " << dataSize << std::endl; // Perform reading from SoInput @@ -211,7 +219,7 @@ ReaderWriterIV::writeNode(const osg::Node& node, const std::string& fileName, if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; bool useVRML1 = !isInventorExtension(osgDB::getFileExtension(fileName)); - osg::notify(osg::NOTICE) << "osgDB::ReaderWriterIV::writeNode() Writing file " + OSG_NOTICE << "osgDB::ReaderWriterIV::writeNode() Writing file " << fileName.data() << std::endl; // Convert OSG graph to Inventor graph