Re: Is there a bug in the scene saving commands?
Posted: Fri Aug 19, 2016 10:58 pm
I think i am narrowing the search. When i save the scene, I create my own dialog to save a file, but to load files, i use Irr's default gui file chooser. Using my own dialog doesn't break (I save an empty scene,and it has dots instead of commas) but after i use the file open dialog (you don't have to pick any option, you just have to show that gui), the saved file shows commas.
Try this example (is your example modified to add a fileopen dialog and to save the scene after. I could reproduce the bug with it.
Try this example (is your example modified to add a fileopen dialog and to save the scene after. I could reproduce the bug with it.
Code: Select all
// Testing serializing with animated models
#include <irrlicht.h>
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
using namespace irr;
int main(int argc, char *argv[])
{
IrrlichtDevice * Device = createDevice(video::EDT_OPENGL, core::dimension2d<u32>(640, 480));
if (!Device)
return false;
scene::ISceneManager* smgr = Device->getSceneManager();
video::IVideoDriver* videoDriver = Device->getVideoDriver();
smgr->addCameraSceneNode(0, core::vector3df(30, 30, 100),
core::vector3df(0, 0, 0),
-1);
smgr->addCubeSceneNode(10.0f, 0, -1);
smgr->addLightSceneNode(0, core::vector3df(0, 50, 0),
video::SColorf(1.0f, 1.0f, 1.0f),
1000.0f);
scene::IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/dwarf.x"));
//scene::IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/ninja.b3d"));
if (anms)
{
//anms->setScale(core::vector3df(5.f, 5.f, 5.f)); // ninja needs to be larger
anms->setMaterialFlag(video::EMF_LIGHTING, false);
}
bool reloadScene = false;
bool addOpenFile = true;
bool done = false;
while (Device->run())
{
if (Device->isWindowActive())
{
if (addOpenFile)
{
Device->getGUIEnvironment()->addFileOpenDialog(L"FOO");
addOpenFile = false;
}
if (reloadScene)
{
smgr->saveScene("scenetest.xml");
smgr->clear();
smgr->loadScene("scenetest.xml");
reloadScene = false;
done = true;
}
if (Device->getTimer()->getTime() > 5000 && !done)
reloadScene = true;
videoDriver->beginScene(3,0xFF000000,1.0f,0);
smgr->drawAll();
Device->getGUIEnvironment()->drawAll();
videoDriver->endScene();
}
Device->sleep(1);
}
Device->closeDevice();
Device->drop();
return 0;
}