Gui: export scene graph to file or buffer
This commit is contained in:
@@ -301,7 +301,7 @@ SoNode* Gui::SoFCDB::replaceSwitches(SoNode* node)
|
||||
return replaceSwitchesInSceneGraph(node);
|
||||
}
|
||||
|
||||
bool Gui::SoFCDB::writeToVRML(SoNode* node, const char* filename, bool binary)
|
||||
void Gui::SoFCDB::writeToVRML(SoNode* node, std::string& buffer)
|
||||
{
|
||||
SoNode* noSwitches = replaceSwitchesInSceneGraph(node);
|
||||
noSwitches->ref();
|
||||
@@ -313,13 +313,19 @@ bool Gui::SoFCDB::writeToVRML(SoNode* node, const char* filename, bool binary)
|
||||
SoVRMLGroup* vrmlRoot = tovrml2.getVRML2SceneGraph();
|
||||
vrmlRoot->setInstancePrefix(SbString("o"));
|
||||
vrmlRoot->ref();
|
||||
std::string buffer = SoFCDB::writeNodesToString(vrmlRoot);
|
||||
buffer = SoFCDB::writeNodesToString(vrmlRoot);
|
||||
vrmlRoot->unref(); // release the memory as soon as possible
|
||||
|
||||
// restore old settings
|
||||
vrml2.setOverrideMode(false);
|
||||
vrml2.apply(noSwitches);
|
||||
noSwitches->unref();
|
||||
}
|
||||
|
||||
bool Gui::SoFCDB::writeToVRML(SoNode* node, const char* filename, bool binary)
|
||||
{
|
||||
std::string buffer;
|
||||
writeToVRML(node, buffer);
|
||||
|
||||
Base::FileInfo fi(filename);
|
||||
if (binary) {
|
||||
|
||||
Reference in New Issue
Block a user