[osg-users] ANN: osgPython (SWIG) 2.2.0
René Molenaar
megamillerzoid at gmail.com
Thu Feb 14 13:24:49 PST 2008
Nice to hear!
I just merged the files and commited the new trunk.
Readme:
---------------------------------------------------------------------
Swig wrappers for OpenSceneGraph.
This is the new trunk of osgswig.
http://osgswig.googlecode.com/svn/trunk
or for members: https://osgswig.googlecode.com/svn/trunk
it is a merge of the original osgswig branch and
the branch used for the VRmeer Project (python and perl).
The merge contains new cmake files, that build the
following modules;
osg
osgDB
osgFX
osgGA
osgUtil
osgViewer
There is one (new) simple test example:
examples/python/simple/simpleosg
The default cmakesetting make these modules for python.
It is most recently tested with
swig 1.3.33
OpenSceneGraph 2.3.4
The merge also still contain all the files and documentation from the
original osgswig.
Revision 95 of:
http://osgswig.googlecode.com/svn/
or https://osgswig.googlecode.com/svn/ (for members)
contains the original osgswig.
---------------------------------------------------------------------
I think the files in the root svn folder can be deleted now,
just leaving the trunk folder.
For installing the python modules a python setup.py can be made
(look for a setup.py template).
cmake can then invoke "python setup.py install" to place the files in the
site-packages dir.
This file can then also be used for creating binary distributions ("python
setup.py bdist_wininst")
I did not look into the splitting the osg.i file,
maybe there is some swig function for this.
Maybe cmakefiles are needed for the other languages/modules.
If you have important fixes please tell.
Good luck,
René
2008/2/14, Luigi Calori <l.calori at cineca.it>:
>
> Thank you very much... it worked!!
>
> either
>
> %inline %{
> osg::Geode *NodeToGeode2(osg::Node *b) {
> return dynamic_cast<osg::Geode*>(b);
> }
> %}
>
> or
>
> %extend osg::Node {
> virtual osg::Geode* asGeode() {return
> dynamic_cast<osg::Geode*>(self);}
> };
>
> The Cmake projects worked fine (just some mods to standard FindOSG), I
> spent some time to find out how to install correctly into site_packages
> If I' m correct, the dll must be renamed .pyd and the generated py must
> be copied inside the site_packages
> I noticed the compile time of the _osg project is quite slow (at least
> on my machine) do you think it would be possible to split the big osg
> wrapper into smaller pieces to
> both speed up build time and separate original (yours) and added (mine)
>
> Do you plan to insert your CMake files into the osgswig svn?
> Having things in svn will really help a lot the development
> I' m planning to experiment further and then try to add site_packages
> installation to cmake if do not find a better way to work
>
> thanks again
> Luigi
>
> René Molenaar wrote:
>
> > I read this in the swig manual:
> >
> > If you need to cast a pointer or change its value, consider writing
> > some helper functions instead.
> > see: http://www.swig.org/Doc1.3/Python.html
> >
> >%inline %{
> >
> >/* C++-style cast */
> >Foo *BarToFoo(Bar *b) {
> > return dynamic_cast<Foo*>(b);
> >}
> >
> >%}
> >
> >
> >
> > You can also create the member function node.asGeode() in a similar
> > way with swig. This is a safe and handy method. There might be other
> > options... this way you would need to use swig, and can't use the
> > binary version.
> >
> > René
> >
> >
> >
>
> > 2008/2/13, Luigi Calori <l.calori at cineca.it <mailto:l.calori at cineca.it
> >>:
>
> >
> > René Molenaar wrote:
> >
> > > Swig wrappers for OpenSceneGraph Python and Perl
> > >
> > > These files are part of: The VRmeer Library - Delft University of
> > > Technology
> > >
> > > The files are based on osgswig (http://code.google.com/p/osgswig/)
> > > with some additions and CMake files.
> > >
> > Thanks for the post, I' ll try them as soon as possible, I' m
> > currently
> > try to learn python and osgswig using the binary version under
> > windows XP
> > I stumbled upon a problem:
> >
> > I would like to parse the one scene, so willing to use something
> > like:
> >
> >
> > node = osgDB.readNodeFile('cow.osg')
> >
> > while node.className() == 'Group':
> > print node.className()
> > node = node.asGroup().getChild(0)
> > print node.className()
> >
> > The problem arise when getChild() returns a Geode.
> > There is no --- node.asGeode() ---- method so I have no idea of
> > how to
> > get the handle of a Geode in the scene.
> >
> > Sorry for my dumbness, any help really appreciated,
> >
> > Luigi
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
>
> > <mailto:osg-users at lists.openscenegraph.org>
>
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
>
> >------------------------------------------------------------------------
>
> >
> >_______________________________________________
> >osg-users mailing list
> >osg-users at lists.openscenegraph.org
> >http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080214/060cab7f/attachment-0001.htm
More information about the osg-users
mailing list