I've took some serious look into the new SceneFormat component in Ogre 2.2. It's great to diagnose/optimize scenes, but I had to do a few adjustments to make it work:
1. OgreSceneFormat doesn't link HlmsPbs. I had to add it manually in VisualStudio
2. Only direct children of the root scene node are exported.
3. "saved_oitd_textures" is exported as a string, but the importer expects a bool.
Here is the patch to fix point 2&3. It works for all scenes I've tried so far.
Code: Select all
---
.../SceneFormat/src/OgreSceneFormatExporter.cpp | 40 +++++++++++++---------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/Components/SceneFormat/src/OgreSceneFormatExporter.cpp b/Components/SceneFormat/src/OgreSceneFormatExporter.cpp
index 6793ced..01ed748 100644
--- a/Components/SceneFormat/src/OgreSceneFormatExporter.cpp
+++ b/Components/SceneFormat/src/OgreSceneFormatExporter.cpp
@@ -720,9 +720,9 @@ namespace Ogre
MovableObject::getDefaultVisibilityFlags() );
if( exportFlags & SceneFlags::TexturesOitd )
- jsonStr.a( ",\n\t\"saved_oitd_textures\" : \"true\"" );
+ jsonStr.a( ",\n\t\"saved_oitd_textures\" : true" );
if( exportFlags & SceneFlags::TexturesOriginal )
- jsonStr.a( ",\n\t\"saved_original_textures\" : \"true\"" );
+ jsonStr.a( ",\n\t\"saved_original_textures\" : true" );
flushLwString( jsonStr, outJson );
@@ -744,20 +744,28 @@ namespace Ogre
exportSceneNode( jsonStr, outJson, rootSceneNode );
outJson += "\n\t\t}";
- Node::NodeVecIterator nodeItor = rootSceneNode->getChildIterator();
- while( nodeItor.hasMoreElements() )
- {
- Node *node = nodeItor.getNext();
- SceneNode *sceneNode = dynamic_cast<SceneNode*>( node );
-
- if( sceneNode && mListener->exportSceneNode( sceneNode ) )
- {
- mNodeToIdxMap[sceneNode] = nodeCount++;
- outJson += ",\n\t\t{";
- exportSceneNode( jsonStr, outJson, sceneNode );
- outJson += "\n\t\t}";
- }
- }
+ std::queue<SceneNode*> nodeQueue;
+ nodeQueue.push(rootSceneNode);
+
+ while (!nodeQueue.empty()) {
+ SceneNode* frontNode = nodeQueue.front();
+ nodeQueue.pop();
+ Node::NodeVecIterator nodeItor = frontNode->getChildIterator();
+ while (nodeItor.hasMoreElements())
+ {
+ Node *node = nodeItor.getNext();
+ SceneNode *sceneNode = dynamic_cast<SceneNode*>(node);
+
+ if (sceneNode && mListener->exportSceneNode(sceneNode))
+ {
+ mNodeToIdxMap[sceneNode] = nodeCount++;
+ outJson += ",\n\t\t{";
+ exportSceneNode(jsonStr, outJson, sceneNode);
+ outJson += "\n\t\t}";
+ nodeQueue.push(sceneNode);
+ }
+ }
+ }
}
outJson += "\n\t]";
}
* Can you export/import camera information? It'll be great if we can preserve camera's position/rotation/fov etc.
* Floating point numbers are exported as "raw bytes", which makes manual inspecting/writing scripts harder. For example, I'd like to write scripts to "prune" the scene graph before importing. Can we have an option to export "human-readable" floating point numbers?
* Datablocks: emissive is not exported
* PCC: the "pause" parameter is exported as integer, but importer expects a bool (I'm not using it anyway, but the code says so...)
Thanks!
