Page 1 of 1

need Help -> irr::scene::ISceneManager::saveScene

Posted: Mon Nov 26, 2007 6:40 pm
by testirrdev
Hi !
Im new in this forum and new to irrlicht ( ....playing since 6 months with this engine )....

Okay, i have written an simple editor, he can add meshes, lights etc, change his properties and moving items with mouse etc. like IrrEdit.
I use my own fileformat to save the scene-data.
All works fine, but when i export my scene into *.irr format per saveScene(...), i have no RootSceneNode (?)
Output in my generated irrfile:

Code: Select all

<?xml version="1.0"?>
<irr_scene>

	<attributes>
		<string name="Name" value="" />
		<int name="Id" value="-1" />
		<colorf name="AmbientLight" value="0.000000, 0.000000, 0.000000, 0.000000" />
	</attributes>

	<node type="">

		<attributes>
			<string name="Name" value="" />
			<int name="Id" value="0815" />
			<vector3d name="Position" value="0.000000, 0.000000, 0.000000" />
			<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
			<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
......
..the same project in IrrEdit:

Code: Select all

<?xml version="1.0"?>
<irr_scene>

	<attributes>
		<string name="Name" value="root" />
		<int name="Id" value="-1" />
		<colorf name="AmbientLight" value="0.000000, 0.000000, 0.000000, 0.000000" />
	</attributes>

	<node type="mesh">

		<attributes>
			<string name="Name" value="" />
			<int name="Id" value="0815" />
			<vector3d name="Position" value="3.333332, 1.666666, -3.333332" />
			<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
			<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
I use VC8 and the application is MFC based.Here's the CWinApp Code to write the *irr file:

Code: Select all

// test irrfile, save
void CEditorApp::OnExportIrr()
{
	CFileDialog fd(FALSE, _T(""), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY,_T("All Files (*.*)|*.*||"));
		if ( fd.DoModal() != IDOK )
		{
			return;
		}
		else
		{

                                         smgr->saveScene( (CStringA)fd.GetFileName() );
		};
}
Can anybody tell me whats wrong in this code ?? :?

PS: SceneManager at all are defined in CWinApp like this:

Code: Select all

#include <irrlicht.h>
#pragma comment(lib,"irrext.lib")

using namespace irr;

irr::IrrlichtDevice* device;
irr::video::IVideoDriver* driver;
irr::scene::ISceneManager* smgr;
irr::scene::ICameraSceneNode* camera;
Thanks all.

Posted: Mon Nov 26, 2007 7:53 pm
by testirrdev
..........okay, i have the solution... 8)