Problems binding my class

Monio

09-04-2007 10:01:35

Hi everyone!

I've got a problem to bind my C++ class to python using Boost.Python. I need to extend a method which receives a SceneManager python-ogre object as parameter, but I don't know how to do that.

I'm tried to write a converter, but I'm a newbee and I have many problems due to the SceneManager class is abstract.

Any idea, please?

andy

09-04-2007 11:32:56

I'm not sure I understand the question...

Perhaps you could be more specific on what you are trying to do.. Perhaps with pseudo code etc to explain the issue..

The whole point of using Python-Ogre is that you shouldn't have to use C++ and/or Boost -- however happy to help....

Cheers
Andy

Monio

09-04-2007 15:29:32

I'll try to be more specific :)

I've got a C++ class which implements a "special Ogre3D Entity" and i want to expose that class to python.

The following code illustrates the method, i talk in the previous post about.


bool MyClass::Method( SceneManager * sm )


I don't know how to expose that method to can pass a SceneManager pyOgre object as parameter.

andy

09-04-2007 15:58:28

How many methods in the class do you want to expose? Is it a single class?, how many lines of code?

I ask these questions as there are a couple of options:
  1. Convert it from C++ to Python - fairly simple and straight forwards (depending upon your C++ source)
    Write a small boost python wrapper for the C++ class - worth doing if the class is extremely unsuited to converting to Python, and if the class has a fairly simple interface.
    Wrap the class using Py++ in the same way we wrapped Ogre.[/list:u]
    Cheers
    Andy

Monio

09-04-2007 17:33:11

Thank you for your responses Andy.

At the moment, the class is very simple, but it's going growing up in the time, moreover, the class have to be written in C++, due to project's requires. So, the first option seems be unviable.

The other ones seems ok. I'm a very newbee using Boost.python, so it should be more advisable for myself to use py++. What do you think about?

I have to apologise myself for my bad English :S

roman.yakovenko

09-04-2007 18:26:14

I'm a very newbee using Boost.python, so it should be more advisable for myself to use py++. What do you think about?

If you have working development environment for Python-Ogre, you can go to code_generators/ogre directory and add include to your file to python_ore.h one. This will allow you to see generate code for your class. Also if you follow Ogre coding conventions, you will enjoy from the many things code generator is able to solve.

P.S. don't forget to clean cache

Monio

10-04-2007 10:26:48

Hi again!

I've been trying to expose my class using py++, but i've got a problem with gccxml.

I installed the gccxml 0.6.0 from the windows installer, but when I run the exec, it report me the following error:


Error occured while running GCC-XML: Compiler "C:/Program Files/Microsoft Visual Studio 8/VC/bin/cl.exe" is not supported by GCC_XML because none of MSVC 6, 7, or 7.1 is installed.
Could not determine GCCXML_FLAGS setting.


I have installed the Microsoft Visual Studio 2005 SP1 (vc8) and in the gccxml web tells that if I type cl as the gcc-xml compiler, it should work with the vc8 compiler too.

I also try to use the g++ compiler, but when I run the exec, then it report me this other error:


Error occured while running GCC-XML: Compiler "g++" is not supported by GCC_XML.
Could not determine GCCXML_FLAGS setting.


These errors drive me crazy :S

andy

10-04-2007 15:56:24

Currently only MSVC 7.1 is supported under Windows for building Python-Ogre

I intend to look at switching to VC2005 but that's a ways away...

Cheers

Andy

Monio

10-04-2007 16:16:36

Does gccxml works on windows with the g++ compiler?