factory is not found [SOLVED]

marten

06-02-2011 21:45:08

Hello everyone!
I've been trying to get some RTT going with MyGUI, but I'm having troubles getting the Unittest_RTTLayer sample to work.
I've copied the MyGUI_RTTLayer files to my project and I've added this to my core_layer.xml:


<Layer type="RTTLayer" name="RenderToTexture">
<Property key="Pick" value="false"/>
<Property key="TextureSize" value="256 256"/>
<Property key="TextureName" value="RTTTexture1"/>
</Layer>


And this is the way I implement it:

_platform = new MyGUI::OgrePlatform();
_platform->initialise(window, sceneManager);
_gui = new MyGUI::Gui();
_gui->initialise("core.xml");

MyGUI::FactoryManager::getInstance().registerFactory<MyGUI::RTTLayer>("Layer");


But I get this error in the log from the _gui->initialise row:
18:37:37 | Core | Critical | factory is 'RTTLayer' not found | ..\..\MyGUIEngine\src\MyGUI_LayerManager.cpp | 117



Any tips?

Altren

06-02-2011 23:05:27

I guess you load layers file through "core.xml" and same was as this done in Unittest_RTTLayer, so the problem is that you load file with layers description before you registered factory. In demo layers file loaded after factory is registered. Another way to handle this is to load "core.xml" after factory is registered:
_platform = new MyGUI::OgrePlatform();
_platform->initialise(window, sceneManager);
_gui = new MyGUI::Gui();
_gui->initialise(""); // empty string here

MyGUI::FactoryManager::getInstance().registerFactory<MyGUI::RTTLayer>("Layer");

MyGUI::ResourceManager::getInstance().load("core.xml");

marten

07-02-2011 14:03:30

Thanks!

I didn't realize you could and should initialise the gui without the data.