problem with combo box

itsalamanca

10-11-2008 16:25:25

Hi,

I have a problem with a combo box, when a load file .mesh i have a runtime error.


combo->eventEditSelectAccept = newDelegate(this, &Myclass::notifyLoadSaveEditAccept);
std::vector<Ogre::String> strs = MyGUI::helper::getVectorResourcePath("*.mesh");
std::vector<Ogre::String>::iterator iter;
for (iter = strs.begin(); iter != strs.end(); ++iter)
{
const Ogre::DisplayString & item = anci_to_utf16(*iter);
combo->addItem(item);
}



but,when i load .layout, every thing works fine.

I don't know what happens.

my.name

10-11-2008 18:33:05

show log

itsalamanca

10-11-2008 21:26:52

mygui.og


22:24:08 | General | Info | PluginManager successfully initialized | c:\mygui\myguiengine\src\mygui_pluginmanager.cpp | 25
22:24:08 | General | Info | Load ini file 'core.lang' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
22:24:08 | General | Info | Load ini file 'core.layer' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
22:24:08 | General | Info | Load ini file 'core.skin' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
22:24:08 | General | Info | Load ini file 'core.font' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
22:24:08 | General | Info | Load ini file 'core.pointer' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
22:24:08 | General | Info | Load ini file 'core.plugin' from current path | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
22:24:08 | General | Error | Gui : 'XML_ERROR_OPEN_FILE' core.plugin | c:\mygui\myguiengine\src\mygui_gui.cpp | 280
22:24:08 | General | Info | Gui successfully initialized | c:\mygui\myguiengine\src\mygui_gui.cpp | 91
22:24:08 | General | Error | PointerManager : 'RF.pointer' not found | c:\mygui\myguiengine\src\mygui_gui.cpp | 272
22:24:09 | General | Info | Font 'MyGUI_CoreFont.18' using texture size 1024 x 128 | c:\mygui\myguiengine\src\mygui_font.cpp | 167
22:24:09 | General | Error | Widget 'edi' not found | c:\mygui\myguiengine\src\mygui_widgetmanager.cpp | 130
22:24:13 | General | Critical | Code point 241 not found in font MyGUI_CoreFont.18 | c:\mygui\myguiengine\src\mygui_font.cpp | 63



ogre.log

22:24:09: Can't assign material Examples/Rockwall to SubEntity of GroundEntity because this Material does not exist. Have you forgotten to define it in a .material script?
22:24:09: *** Initializing OIS ***
22:24:09: Texture: spot_shadow_fade.png: Loading 1 faces(PF_R8G8B8,128x128x1) with 5 generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
22:24:09: WARNING: Texture instance '0119E238_TextureRenderBox' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
22:24:13: OGRE EXCEPTION(10:MyGUIException): Code point 241 not found in font MyGUI_CoreFont.18
in MyGUI at c:\mygui\myguiengine\src\mygui_font.cpp (line 63)


and the line 63 og mygui_font.cpp

MYGUI_EXCEPT("Code point " << _id << " not found in font " << mName);
return null;

Altren

10-11-2008 22:29:45

Ogre return filenames in ansi, so you need to convert your file string from ansi to utf. Here's code from Layout Editor std::vector<Ogre::String> strs = MyGUI::helper::getVectorResourcePath("*.layout");
for (std::vector<Ogre::String>::iterator iter = strs.begin(); iter != strs.end(); ++iter)
{
const Ogre::DisplayString & item = anci_to_utf16(*iter);
combo->addItem(item);
}



Ogre::DisplayString EditorState::anci_to_utf16(const std::string & _source)
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
const char* srcPtr = _source.c_str();
int tmpSize = MultiByteToWideChar( CP_ACP, 0, srcPtr, -1, 0, 0 );
WCHAR* tmpBuff = new WCHAR [ tmpSize + 1 ];
MultiByteToWideChar( CP_ACP, 0, srcPtr, -1, tmpBuff, tmpSize );
std::wstring ret = tmpBuff;
delete[] tmpBuff;
return ret;
#else
return Ogre::DisplayString(_source).asWStr();
#endif
}
We will fix this soon, so getVectorResourcePath will return strings in utf.

To avoid crashing if you using characters that not in your font get fresh MyGUI. There we replace them with spaces.

itsalamanca

10-11-2008 22:38:34

sorry, i have problems to understand it,

I want to load .mesh, i mean, how i do to load it without problems.
i used the funcion anci_to_utf16 too, i took everything for layout editor code.

What you said to me, can you put it to me with some pseudocode at least.

Thanks.

Altren

10-11-2008 22:48:04

What OS do you use? Do you have non-English characters in you file names or in path?

itsalamanca

10-11-2008 22:52:28

Yes, you are right, i have non english caracters, i have put ñ, because i use spanish keyboard. Thanks a lot.

BYe.

Altren

11-11-2008 10:43:47

You can use non-english symbols in file names. Just add them to core font file.

itsalamanca

16-11-2008 11:38:59

Hi, i continue with my combo, and i have some problems, i dont know i make work it.
I mean, i see all the .mesh file, i select one, but i don't kow how to load it.
I want to select this mesh and load it in my window.
Somebody can say me how i do this???

thanks.

itsalamanca

16-11-2008 15:11:06

i have done some progress, and i localized the problem i this method::


bool load(std::string _fileName)
{
std::string _instance = "Editor";

MyGUI::xml::xmlDocument doc;
std::string file(MyGUI::helper::getResourcePath(_fileName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME));

doc.open(file);
MyGUI::xml::xmlNodePtr root = doc.getRoot();

std::string type;

if (root->findAttribute("mType", type)) {
if (type == "mesh")
{

Entity* entidad1= mSceneMgr->createEntity("Example", file);
SceneNode *thing;
thing=scene5->createChildSceneNode();
thing->attachObject(entidad1);

}

}

return true;
}



I thingk that, maybe, find atributes don't recognizes the type .mesh or something similar.

Thanks.

Sorry for my english.

itsalamanca

17-11-2008 16:10:37

if somebody can help me, i hope that this may help:

MyguiLog:


17:04:49 | General | Info | PluginManager successfully initialized | c:\mygui\myguiengine\src\mygui_pluginmanager.cpp | 25
17:04:49 | General | Info | Load ini file 'core.lang' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
17:04:49 | General | Info | Load ini file 'core.layer' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
17:04:49 | General | Info | Load ini file 'core.skin' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
17:04:49 | General | Info | Load ini file 'core.font' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
17:04:49 | General | Info | Load ini file 'core.pointer' from resource group : General | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
17:04:49 | General | Info | Load ini file 'core.plugin' from current path | c:\mygui\myguiengine\src\mygui_gui.cpp | 335
17:04:49 | General | Error | Gui : 'XML_ERROR_OPEN_FILE' core.plugin | c:\mygui\myguiengine\src\mygui_gui.cpp | 280
17:04:49 | General | Info | Gui successfully initialized | c:\mygui\myguiengine\src\mygui_gui.cpp | 91
17:04:49 | General | Info | Font 'MyGUI_CoreFont.18' using texture size 1024 x 128 | c:\mygui\myguiengine\src\mygui_font.cpp | 167


SO, i expect thar someboy can help me, i really need to do this combo to load meshes.

Thanks.

Altren

18-11-2008 10:24:04

Looks like you don't understand what are you doind :(
In your load function you loading _fileName as xml and then using same name as mesh name...

Here's small example how to load mesh if you already added it meshes list combobox:
combobox->eventComboAccept = MyGUI::newDelegate(this, &Your_Class::notifyComboAccept);


void notifyComboAccept(MyGUI::WidgetPtr _sender, size_t _index)
{
std::string file = _sender->getCaption();
Entity* entidad1= mSceneMgr->createEntity("Example", file);
SceneNode *thing;
thing=scene5->createChildSceneNode();
thing->attachObject(entidad1);
}

Jeanbono

22-12-2008 20:30:53

hi here;)

I got the same problem:

21:28:01 | General | Info | Font 'MyGUI_CoreFont.18' using texture size 1024 x 128 | c:\ogresdk\mygui\myguiengine\src\mygui_font.cpp | 167
21:28:19 | General | Critical | Code point 39265 not found in font MyGUI_CoreFont.18 | c:\ogresdk\mygui\myguiengine\src\mygui_font.cpp | 63


No combo box in my layout just some EditText and StaticText with 'é' and when I quit my app, I got the same problem.
It work fine by replacing 'é' ->'e'...strange problem, I follow this post for a possible solution :)