[fixed]Is there a bug in the scene saving commands?

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.

Re: Is there a bug in the scene saving commands?

Postby Mel » 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.
cpp 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;
}
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 2273
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Is there a bug in the scene saving commands?

Postby CuteAlien » Sun Aug 21, 2016 8:48 pm

Thanks, I'll check it next week.
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8533
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Is there a bug in the scene saving commands?

Postby CuteAlien » Mon Aug 22, 2016 10:23 am

I made 2 changes now. First the FileOpenDialog had indeed a bug. It messed with LC_ALL instead of just LC_CTPYE and that could lead to wrong locals after trying to restore old settings (likely because there can be different settings so restoring just one value can't work).
And I also ensured now that saveScene always uses "c" type for LC_NUMERIC so it always writes dot's now.
Thanks for the updated test-case - I would have missed the bug in FileOpenDialog otherwise!
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8533
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: [fixed]Is there a bug in the scene saving commands?

Postby Mel » Mon Aug 22, 2016 11:28 pm

Okay, tested and working fine!
Thanks to you guys!
This can be called fixed indeed! :)
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 2273
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: [fixed]Is there a bug in the scene saving commands?

Postby CuteAlien » Mon Aug 22, 2016 11:53 pm

Was rather interesting. I noticed that changing locale with setlocale in main didn't affect the library (Irrlicht linked as shared lib). Only changes in the library did affect it. Still not quite certain how it works - found online some thread which said it depends on how one links to MSVCRT.DLL (dynamic it would share, static it won't). So the library and the main application can have different locale settings at the same time.
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8533
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Previous

Return to Bug reports

Who is online

Users browsing this forum: No registered users and 1 guest