CEGUI in Panda3d (WIP)

interrogate chokes on various things (typedefs of std::stream, classes inheriting from std::iterators…).

Is there a way to exclude parts of a file from being interrogated?

No, but you might be able to satisfy interrogate by defining enough of the iostream interface in parser-inc/iostream, which is the header file that interrogate reads to understand iostreams. Presently, that file defines the stream classes in the default namespace, but you could modify it to put them in the std namespace instead, more correctly.

David

I don’t see the need to convert the wrappers to interrogate. The way described above works for me. Why duplicate the work already done by someone else?

Besides, I don’t have the time to look into interrogate.

Should someone else need to do this, they would need to wrap most of the headers in the CEGUI’s include directory.

Nik

If you make it work with interrogate it would be trivial to include CEGUI with panda3d and have other people fix bugs with it, and have it become part of panda3d.

Yeah, it would be silly to ship Panda3D with python-ogre.

I can do the interrogate work, though, if you want.

Well, I’m not nik but…Yes, please! :stuck_out_tongue:

Sure, that would be great, thanks!

Nik

(What’s with the reply notifications not working?)

On a related note, is there documentation for Interrogate out there? I’ve seen the It’s The Panda Show! webisode about Interrogate, and I’ve read the interrogate.exe usage help, but I’m still relatively clueless on the overall process of integrating a third party library into Panda, as well as the details of playing nice with Interrogate (ref-counting, ownership semantics, that kind of thing). I’ve integrated CEGUI into preexisting game engines before, and I’d be quite happy to help out here, and it occurs to me that some facets of CEGUI, like its approach to event publishing, probably wouldn’t be automagically and perfectly handled by Interrogate.

Hm, have you already seen this manual page? It might help you a little bit further:
panda3d.org/manual/index.php/Interrogate

It’s true there’s not a lot of that sort of documentation. Interrogate isn’t often used to directly instrument a third-party library that wasn’t built with interrogate in mind. It’s an incredibly useful tool for automatically instrumenting simple interfaces, but there are certain fancy C++ tricks that just don’t automatically translate into other languages.

Off the top of my head, the rules are:

  • Methods that return pointers or references are presumed to retain ownership.
  • Methods that accept pointers or references are presumed not to take ownership.
  • Methods that return concrete objects will implicitly construct a new wrapper object, which does keep its own ownership. A valid copy constructor is required.
  • Objects that inherit from Panda’s ReferenceCount are automatically reference-counted properly, superceding the first two rules. Obviously this rule doesn’t help at all for third-party libraries.
  • Objects that inherit from Panda’s TypedObject are automatically downcast to the appropriate type on the Python side. Also not useful for third parties.
  • A method that returns NULL will actually return None. The reverse conversion is not performed, for safety reasons; there is thus no way to pass a NULL pointer into a method.
  • Raw pointers to primitive types, like int, float, etc., are not supported. Methods that receive or return these parameters are not instrumented.
  • Nested classes and template classes are supported. Templates may need to be explicitly instantiated in a .N file.
  • STL iterators generally aren’t supported, but other STL operations can be used (cf. Panda’s PointerToArray class). STL basic_string and wide_string class is automatically converted to and from Python string and unicode objects.
  • Function pointers are obviously not supported. Void pointers are not supported.

David

If Interrogate isn’t ideal for 3rd party code (which makes sense… I’m pretty sure CEGUI doesn’t go out of its way to put PUBLISHED: in its classes), would the solution be to make a thin, Panda-compliant wrapper around CEGUI to do that stuff? Without support for function pointers (let alone member function pointers), CEGUI wouldn’t otherwise have any way of firing events.

Of course there are ways to use function pointers in a code that is parsed by Interrogate, you just need to make a function that receives a PyObject pointer and use the Python API to call that function.

Making a thin, Panda-compliant wrapper is the way we most commonly expose a third-party library via interrogate. But nik pointed out above that CEGUI has a huge interface, so it may not be easy to make a thin, Panda-compliant wrapper around it.

Depending on CEGUI’s interface design, interrogate might not be the best choice to instrument it. Maybe we can talk to the team who designed the wrappers for python-ogre, and see if they’d be willing to spin python-CEGUI into its own project.

David

It’s huge, but the widely used part of it is not huge. One major reason CEGUI’s interface is so bulging is because it technically gives you a huge degree of flexibility. Falagard, its XML-based skinning system, is not integrated into the core, but rather plugs in, so there’s a lot of exposed interfaces purely for the purpose of writing one’s own skinning interface. Moreover, there’s hundreds of Property classes, CEGUI’s special little way of being data-driven, which would have no place in an exposed Python interface.

One would just need to expose the widget classes (assuming and hiding the use of Falagard), plus maybe a couple dozen miscellaneous classes like Font and Imageset. Actually, it looks like that’s exactly what CEGUIPython is doing.

A small update:

I’ve contacted the Python-Ogre developers, and Andy Miller, their lead developer, was very quick to respond.

The thread is here:
http://groups.google.com/group/python-ogre-developers/browse_thread/thread/588b6d5bd2afce07

Nik

Good news!

David

I’m interested in using this, but I would like it to work with DirectX. Is there any plan to support it? Can I help? Also does what is done so far work with cegui 0.7?

Sorry to double-post, but disregard this. First, I’m gonna try to use panda’s gui first. Second, pro-rsoft told me how to integrate cegui and it doesn’t look that hard now that there are callbacks for it.

The latest implementation should work on both DirectX and OpenGL. The renderer translates Cegui’s quads into Panda’s polygons, and then Panda3d renders these with either OpenGL or DirectX.

It would be nice if you would try it out and post the results. I’ll be checking this thread more often, since the reply notifications are not working for me at all.

Nik

Anybody succeeded to get this working with panda 1.6 or 1.7 ?

i tried the above steps (on a windows pc with GNU32 etc) and got to the step of compiling the wrappers

# Compile wrappers - this takes a while.
python python-ogre/BuildModule.py -c cegui 

Now, in the log.out file:

01-25 04:34 PythonOgre.BuildModule INFO     Compiling Source code for cegui
01-25 04:34 PythonOgre.BuildModule DEBUG    Spawning 'scons -j3 PROJECTS=cegui' in 'D:\Projects\Games\Libraries\Temp\python-ogre'
01-25 04:34 PythonOgre.BuildModule WARNING  Task Failed
01-25 04:34 PythonOgre.BuildModule DEBUG    
01-25 04:34 PythonOgre.BuildModule DEBUG   Scons The Name Specified Is Not Recognized

So i search for scons… but and got it inside at python/…(blah)…/site-packages/scons but i have no idea how to get this working.

Is there any human readable guide / steps guid to do this (since its months ago since the last post).

thank you