Re: [osg-users] osg python binding
Hartmut Seichter wrote: >If you tried the newest trunk and SWIG you certainly stumbled across the >osg::Vec3f stuff ... do you have a solution for that? I don't know what stuff ypu mean, I have just tested the latest svn-trunk (osg 2.3.4) with swigwin-1.3.29 without problems. So maybe using an older swig version is a workaround for now. I noticed one swig error before, that was solved like this: //This is a little macro trick to prevent a swig error #define X_AXIS(a,b,c) X_AXIS=Vec3f(1.0,0.0,0.0); #define Y_AXIS(a,b,c) Y_AXIS=Vec3f(0.0,1.0,0.0); #define Z_AXIS(a,b,c) Z_AXIS=Vec3f(0.0,0.0,1.0); and this might be handy //create shortcuts for vecs in python #ifdef SWIGPYTHON %pythoncode %{ Vec2 = Vec2f Vec3 = Vec3f Vec4 = Vec4f %} #endif We changed some other stuff too, but the result in python is this: In [1]: import osg In [2]: a = osg.Vec3(1,2,3) In [3]: a Out[3]:> In [4]: print a [1, 2, 3] In [5]: myvec = osg.Vec3f() In [6]: myvec[0] = 10 In [7]: print myvec [10, 0, 0] When I find some time, I will try to see what the differences between our trunks are. And I will look at our cmake files. Have a nice day, René Molenaar _ Probeer Live Search: de zoekmachine van de makers van MSN! http://www.live.com/?searchOnly=true ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg python binding
This looks simple enough :) Can I incorporate this into the trunk? I would probably use osg/io_utils for the __str__ wrappers. If you tried the newest trunk and SWIG you certainly stumbled across the osg::Vec3f stuff ... do you have a solution for that? /H megamiller zoid wrote: > > Dear osgPython users, > > About the problem with vectors, > There is a file in our library, called osgPyExtend, which creates python > access to vectors and mat. > I have attached it. > > add %include "osgPyExtend.i" to osg.i > > I have more additions, but this one should be an easy to add. > > > > _ > Jouw nieuws en entertainment, vind je op MSN.nl! > http://nl.msn.com/ > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg python binding
Dear osgPython users, About the problem with vectors, There is a file in our library, called osgPyExtend, which creates python access to vectors and mat. I have attached it. add %include "osgPyExtend.i" to osg.i I have more additions, but this one should be an easy to add. _ Jouw nieuws en entertainment, vind je op MSN.nl! http://nl.msn.com/ %{ #include %} %define VECHELPER(name) value_type __getitem__(int i) { return (*self)[i]; } void __setitem__(int i, value_type v) { (*self)[i] = v; } %enddef %define VEC2HELPER(name) %extend osg::## name { std::string __str__() { std::ostringstream os; os << '[' << self->x() << ", " << self->y() << ']'; return os.str(); } VECHELPER(name) }; %enddef %define VEC3HELPER(name) %extend osg::## name { std::string __str__() { std::ostringstream os; os << '[' << self->x() << ", " << self->y() << ", " << self->z() << ']'; return os.str(); } VECHELPER(name) }; %enddef %define VEC4HELPER(name) %extend osg::## name { std::string __str__() { std::ostringstream os; os << '[' << self->r() << ", " << self->g() << ", " << self->b() << ", " << self->a() << ']'; return os.str(); } VECHELPER(name) }; %enddef %define MATHELPER(name) %extend osg::## name { std::string __str__() { std::ostringstream os; os << '[' << self->operator()(0,0) << ", " << self->operator()(0,1) << ", " << self->operator()(0,2) << ", " << self->operator()(0,3) << ']'; os << '[' << self->operator()(1,0) << ", " << self->operator()(1,1) << ", " << self->operator()(1,2) << ", " << self->operator()(1,3) << ']'; os << '[' << self->operator()(2,0) << ", " << self->operator()(2,1) << ", " << self->operator()(2,2) << ", " << self->operator()(2,3) << ']'; os << '[' << self->operator()(3,0) << ", " << self->operator()(3,1) << ", " << self->operator()(3,2) << ", " << self->operator()(3,3) << ']'; return os.str(); } }; %enddef VEC2HELPER(Vec2b) VEC2HELPER(Vec2s) VEC2HELPER(Vec2d) VEC2HELPER(Vec2f) VEC3HELPER(Vec3b) VEC3HELPER(Vec3s) VEC3HELPER(Vec3d) VEC3HELPER(Vec3f) VEC4HELPER(Vec4ub) VEC4HELPER(Vec4b) VEC4HELPER(Vec4s) VEC4HELPER(Vec4d) VEC4HELPER(Vec4f) MATHELPER(Matrixd) MATHELPER(Matrixf) ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg python binding
I have worked with the swigged version of osgPython for some time. It works pretty well, I updated the online version (to osg22) and added python style vectors, cmake system and some other extra's It is part of a bigger library, maybe I can seperate it, and share it. It uses the swig system of cmake and works on both windows and linux. As far as I know the swig osgPython is the best solution at this moment for osgPython. René Molenaar _ Bekijk Yes-R's real life soap op MSN Video! http://video.msn.com/video.aspx?mkt=nl-nl&tab=m1192527562294&vid=8aff5b76-b78d-4b55-8b64-ef7e1d73aab2&playlist=videoByUuids:uuids:50b732c2-c105-41e9-adf0-36bd627d4eaa,0813da8c-031b-423f-a79d-35d925aee805,5cce447e-948d-43af-9862-45bb6bb9d6d8,6a39138c-f562-4254-be70-9d93343650f8,f9b8d78f-05a4-4c74-8e4b-28d20a4037ab&from=NLNL_Yes-R ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg python binding
I' m also interested in scripting: tried introspection based osgLua and osgPython with not much success. Also tried binary version of osgSwig (version 2.1.11 I presume), was able to run viewer.py but not much more. I did not found many python examples, neither in any of the project above, Is it because the wrapping is not yet stable or like "the example are left as an exercise to the reader" Any available example scripts would be really appreciated by a novice python user as I am. Iwould also be very intersted in CMake building, and willing to help expecially under Windows platform. Thanks Luigi Hartmut Seichter wrote: >Hi Cedric, > >I am the developer of osgSWIG. You can find scripts in src/Languages/Python > >1) run wrap.sh >2) run compile.sh > >I know this is very much "suboptimal" and might not even work on your >distribution. I am working on a CMake based build system which probably >solves quite a lot of problems. There is also one big issue I am facing >with one of the headers in core OSG. You might stumble upon the same >thing, there are three const variables in osg::Vec3f which use the C++ >style of declaration and are not supported by SWIG > 1.3.30 > >/H > > >Cedric Pinson wrote: > > >>I have found http://code.google.com/p/osgswig/ to bind osg to python, i >>did not try yet. I would like to know if someone use it on linux. >>I would like feedback >> >>Cedric >> >> >> > >-- >Hartmut Seichter >PhD (HKU), Dipl.-Ing. (BUW) >www.technotecture.com > > >___ >osg-users mailing list >osg-users@lists.openscenegraph.org >http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg python binding
I tried it but i have a problem i can't create vec3array or i dont know how to do that. I imagine it's not so easy because of template ... let me know if it's possible. I hope osgSWIG will grow up, often it's easier to use script language instead of c++ thanks Hartmut Seichter wrote: > Hi Cedric, > > I am the developer of osgSWIG. You can find scripts in src/Languages/Python > > 1) run wrap.sh > 2) run compile.sh > > I know this is very much "suboptimal" and might not even work on your > distribution. I am working on a CMake based build system which probably > solves quite a lot of problems. There is also one big issue I am facing > with one of the headers in core OSG. You might stumble upon the same > thing, there are three const variables in osg::Vec3f which use the C++ > style of declaration and are not supported by SWIG > 1.3.30 > > /H > > > Cedric Pinson wrote: > >> I have found http://code.google.com/p/osgswig/ to bind osg to python, i >> did not try yet. I would like to know if someone use it on linux. >> I would like feedback >> >> Cedric >> >> > > -- > Hartmut Seichter > PhD (HKU), Dipl.-Ing. (BUW) > www.technotecture.com > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- +33 (0) 6 63 20 03 56 Cedric Pinson mailto:[EMAIL PROTECTED] http://www.plopbyte.net ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg python binding
Hi Cedric, I am the developer of osgSWIG. You can find scripts in src/Languages/Python 1) run wrap.sh 2) run compile.sh I know this is very much "suboptimal" and might not even work on your distribution. I am working on a CMake based build system which probably solves quite a lot of problems. There is also one big issue I am facing with one of the headers in core OSG. You might stumble upon the same thing, there are three const variables in osg::Vec3f which use the C++ style of declaration and are not supported by SWIG > 1.3.30 /H Cedric Pinson wrote: > I have found http://code.google.com/p/osgswig/ to bind osg to python, i > did not try yet. I would like to know if someone use it on linux. > I would like feedback > > Cedric > -- Hartmut Seichter PhD (HKU), Dipl.-Ing. (BUW) www.technotecture.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg python binding
I have found http://code.google.com/p/osgswig/ to bind osg to python, i did not try yet. I would like to know if someone use it on linux. I would like feedback Cedric -- +33 (0) 6 63 20 03 56 Cedric Pinson mailto:[EMAIL PROTECTED] http://www.plopbyte.net ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org