CEGUI in Panda3d (WIP)

I’m not sure why scons is failing.

Try this guide for building PythonOgre on Windows:
http://wiki.python-ogre.org/index.php/WindowsBuildAuto

Just build all of PythonOgre, and then see if you can make sense of my instructions above.

Sorry, I haven’t had time to wrap this up and integrate it properly into the Panda source.

Hi nik. May I ask what is the status on this? We are interested in having a nice Cegui wrapper for the next major version of Panda. Is your patch at:

pastebin.ubuntu.com/154468/

your last version? Also, have you tested Cegui 0.7.1? If you need any help just let me know.

Hi Gogg,

yes, that is the patch for the Panda source to work with Cegui 0.6.x. I have it running with modified PythonOgre wrappers. I haven’t been working on this since.

I haven’t tried this with Cegui 0.7+. Cegui had some major changes to the way they render stuff.
See this: http://cegui.org.uk/api_reference/porting6to7.html
and especially this:
http://pdt.myby.co.uk/cegui/files/CEGUI-Renderer-Model-2.pdf

They’ve added quad caching, which I was doing in my code (with limited success). The quad rendering got a bit more complicated, but it’s for the better, it seems. So the renderer code will have to be rewritten to work with 0.7+.

The next issue is the Python wrappers. PythonOgre is the best for this. They’ve moved on to Cegui 0.7.1. I don’t know if their Cegui wrapper still depends on the Ogre wrapper and hence on Ogre (that was the case in 0.6.x).

It would be nice if you could work on this. I’ll try to help.

Nik

Here is a patch for the Panda3D tree that works with CEGUI 0.7.1:
paste.ubuntu.com/515434/

This is for Linux and makepanda.
You’ll need CEGUI 0.7.1 (later ones might work too).
I’m using Python bindings from PythonOgre. Their CEGUI bindings don’t depend on Ogre any more.

Any updates on this, and a potential Windows patch?

No major updates, code works with Cegui 0.7.1.

The patch should work on Windows too, but I don’t have a Windows machine to try this on.

If somebody tries to do the integration on Windows, I’ll try to help. You may need to compile PythonOgre on Windows:
http://wiki.python-ogre.org/index.php/WindowsBuildV2

Nik

Yeah I’m going to look into it this weekend, do I need the CEGUI binaries or source, and I don’t see a 0.7.1 for CEGUI I only see 0.7.4 (0.7.1 for the editors though)? And why would I need the Ogre3D stuff?

There are two parts to this:

  1. Getting Cegui to work with Panda in C++.

The patch has the file cegui.cxx to test this. It compiles into a binary that creates a GUI in C++.

For this you need to build the files in panda/src/cegui directory and link against the Cegui lib. I was using makepanda to do this.

  1. Python wrappers

This is where PythonOgre is used. They have the Python wrappers for Ogre, which also includes Cegui. Their Cegui wrapper still has some dependencies on Ogre (I said earlier that it doesn’t, but it does). These can be removed, but for a start, try it with Ogre.

To test this, run python_test.py.

Here, we need PythonOgre to link to the same Cegui lib as Panda.

I was using CeguiPython 1.6.4 which has Cegui version 0.7.1

Nik

How do you apply a patch in CVS because I can’t figure it out for the life of me?

On Linux, there is the patch command for this (cd src; patch -p1 < file.diff). You can do that in Cygwin too. If you use a CVS client with a GUI, it should have something like that as well.

Ok, I got the patch working (had to download gnu patch), now how do I compile the CEGUI stuff to get the lib you’re referring to?

From main directory, call ‘python makepanda/makepanda.py --everything’.
You’ll need to have the Cegui lib and header somewhere where makepanda can find them - install or compile Cegui as usual to get these.
If it can’t, it’ll say “WARNING: Could not locate thirdparty package cegui, excluding from build”.

Need you to a bit more specific as to getting CEGUI to compile, it keeps complaining about not being able to find CEGUIRect.h which I assume is due to it not being able to locate the .lib with that file in it. I’ve tried copying the lib folder from the CEGUI zip file into various places and telling VS where to look but it doesn’t seem to find it.

How does your folder setup look?

CEGUIRect.h is a header file. You’ll need to put all CEGUI headers into thirdparty folder.

I’m looking at this:
panda3d.org/manual/index.ph … alLang=cxx

Looks like you need to create a thirdparty\win-libs-vc9\cegui\include and …cegui\lib folders and put the headers (.h files) into the include folder, and libs (.dll or .lib) into the lib folder.
Also, you’ll need to add stuff to the Windows/VS section of makepanda.py. Look for “if (COMPILER==“MSVC”)” line there. Try to copy what some other library is doing, e.g. FCOLLADA.

This is more about how Panda’s thirdparty system should work on Windows, so I’m guessing here.

Yeah I got it all to compile, I need to figure out a way of defining NOMINMAX when using the makepanda.bat batch though because there’s a issue with windows already having min/max defined as macros and it causes compilation issues with CEGUI.

Hm, CEGUIBase.h undefines these macros, so there shouldn’t be an issue.

But try this: in ceguiPanda3dTexture.h, add “#define NOMINMAX” before including texture.h (texture.h pulls in windows.h eventually).

Same for ceguiSupport.h - if windows.h gets included before Cegui headers, #define NOMINMAX before the windows header (i.e. on top of the file).

Don’t ask me why but even defining NOMINMAX in the CEGUIString.h file where it is causing the issue doesn’t fix it I had to go into the function with the error and add a specific check to undefine ‘min’ when it compiles like this (around line 1250):

size_type	utf8_stream_len(size_type num = npos, size_type idx = 0) const
	{
		using namespace std;

		if (d_cplength < idx)
			CEGUI_THROW(out_of_range("Index was out of range for CEGUI::String object"));

		size_type	maxlen = d_cplength - idx;
		
		#ifdef min
		#	undef min
		#endif //min

		return encoded_size(&ptr()[idx], ceguimin(num, maxlen));
	}

And that moves me along to the next error (cross platform compilation sucks don’t it? lol)

1>panda/src/cegui/ceguiInputHandler.cxx(21) : error C2491: 'CeguiInputHandler::_type_handle' : definition of dllimport static data member not allowed

EDIT:
I found a better way around the min/max issue I just moved all the CEGUI includes into 1 file (like the physx integration does) and added #undef min / #undef max above them

Also the CeguiInputHandler error seems to be caused by the EXPCL_PANDA thing in the ceguiInputHandler, I changed it to EXPCL_PANDACEGUI and then in the config_cegui.h i changed that EXPCL_PANDAODE to EXPCL_PANDACEGUI and I got past that error.

Moving right along to the new error:

1>cegui.cxx
1>[ 48%] Building Interrogate database built/pandac/input/libpandacegui.in
1>            *** Error in /c/SVN/Panda3D/thirdparty/win-libs-vc9/cegui/include/CEGUIString.h near line 92, column 45:
1>            parse error
1>Error parsing file: 'ceguiSupport.h'

The line it complains about looks like this:

    class iterator : public std::iterator<std::random_access_iterator_tag, utf32>

I think it should also be noted I’m using CEGUI 0.7.5 for my headers/libs

Oh. In config_cegui.h, there is a typo. It should be
NotifyCategoryDecl(cegui, EXPCL_PANDACEGUI, EXPTP_PANDACEGUI);

(I copied this from ODE, so there was a stray EXPCL_PANDAODE there)

You must have been posting this while I had the thing open to edit my last post to explain what I had been changing to fix these things lol.

I’m in the IRC if you want to jump in there sometime to try to knock these out in a faster fashion rather than filling the thread with getting the windows version to compile.

Hi Krush,

I’ve put the new header config_cegui.h here:
pastebin.com/iAeBA2dw

and config_cegui.cxx:
pastebin.com/Yk4SCLHe

This compiles for me. I’ll check back in IRC, hope this works for you.