Hi Randolph,

this is a typical problem of (python) wrappers; the "getVertexArray"
returns a general Array, which is currently not wrapped. The trick
would be to somewhere "cast" the general Array back to its specific
type in Python, e.g. a Vec3Array. We've used some of these tricks in
the wrappings themselves by a dynamic_cast through C++ run-time type
information (not accessible to users), and some you can access
yourself, e.g. osg.Node.asLOD .

To fix your particular problem we might introduce extensions to Array
such as osg.Array.asVec3Array etc, or better would be to automatically
let SWIG convert all returning values of Array to its "real" type. In
any case this means diving into SWIG specifics. I'll post this as an
issue on the list
(http://code.google.com/p/osgswig/issues/detail?id=27), but I cannot
give guarantees when it will be picked up.

Gerwin



On Thu, Feb 26, 2009 at 5:19 AM, Randolph Fritz <rfr...@u.washington.edu> wrote:
> I'm writing a prototype OSG to Radiance exporter in Python.  I've got to the
> point of code that iterates over all geodes in the scene graph. Problem
> is--then what? Is the only way to read the elements of the arrays ctype and
> pointers? Or is there something a bit simpler and safer?
>
> Perhaps-relevant bit of code:
>   def apply_Geode(self,ge):
>       for i in range(ge.getNumDrawables()):
>           geom = ge.getDrawable(i).asGeometry()
>           if geom:
>               arr = geom.getVertexArray()
>               for i in range(arr.getNumElements()):
>                   # This doesn't seem to work--what does?
>                  arr.accept(i,self.val)
>
>
> --
> Randolph Fritz
>  design machine group
>  architecture department
>  university of washington
> rfr...@u.washington.edu
>
> _______________________________________________
> 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

Reply via email to