From: brett h. <bha...@ya...> - 2004-06-25 17:56:13
|
--- Timothy Stranex <ti...@st...> wrote: > 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 dReals vertices to > osg's > > > Vec3 vertices and pass that object directly to an osg geode. These functions could then be > > > exposed to Python, then we would not have to do the conversion in Python using tuples as the > > > middle-man. It sounds like its going to be hard, any ideas? > > > > 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. > > > > 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. > looks like CObjects are the way to go. The doc had a good example, it does not look like too much of a hack. -brett __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail |