|
From: Timothy S. <ti...@st...> - 2004-06-25 13:46:28
|
On Fri, 2004-06-25 at 09:28, Timothy Stranex wrote:
> On Fri, 2004-06-25 at 02:31, brett hartshorn wrote:
> > It would be nice to have some fast C functions that can convert ODE's d=
Reals vertices to osg's
> > Vec3 vertices and pass that object directly to an osg geode. These fun=
ctions could then be
> > exposed to Python, then we would not have to do the conversion in Pytho=
n using tuples as the
> > middle-man. It sounds like its going to be hard, any ideas?
>=20
> A function capable of doing that would need to know the internal
> structure of the Python Geode class and the C++ Geode class. To do that,
> PyODE would have the added dependencies of both PyOSG and OSG.
>=20
> I like Bernie's intermediate array module idea. PyOSG, Python-Ogre
> bindings and PyODE will each need to implement an importer and exporter
> from the internal types to the array object. Since the array module is
> already part of Python, it isn't an extra dependency.
I just noticed this in Python's Extending/Embedding documentation:
Python provides a special mechanism to pass C-level information
(pointers) from one extension module to another one: CObjects. A
CObject is a Python data type which stores a pointer (void *).
CObjects can only be created and accessed via their C API, but they
can be passed around like any other Python object. In particular,
they can be assigned to a name in an extension module's namespace.
Other extension modules can then import this module, retrieve the
value of this name, and then retrieve the pointer from the CObject.
The rest is at http://www.python.org/doc/2.3.3/ext/using-cobjects.html.
--=20
Timothy Stranex <ti...@st...>
|