Re: [pygccxml-development] More questions on the Ogre Binding
Brought to you by:
mbaas,
roman_yakovenko
|
From: Lakin W. <lak...@gm...> - 2006-05-29 20:08:36
|
Thanks roman, that approach worked. For archival purposes, the final
code that I used is:
def fix_unnamed_classes (mb):
ogre_ns =3D mb.namespace ('Ogre')
print len (ogre_ns.classes ('')) / 2
for unnamed_cls in ogre_ns.classes( '' ):
named_parent =3D unnamed_cls.parent
if not named_parent.name:
named_parent =3D named_parent.parent
for mvar in unnamed_cls.public_members:
if not mvar.name:
continue
named_parent.add_code(
'add_property( "%(mvar)s", &Ogre::Vector3::%(mvar)s)' \
% dict( mvar=3Dmvar.name ) )
The only strange part is that some of the names in
unnamed_cls.public_members are blank themselves, so I had to filter
them out as well.
Lakin
On 5/29/06, Lakin Wecker <lak...@gm...> wrote:
> On 5/29/06, Roman Yakovenko <rom...@gm...> wrote:
> >
> > I will add this feature, but not in a week or two.
>
> Cool.
>
> > I could be wrong, but there are
> > 4 or 5 places, where ogre uses such constructs.
>
> You're right, and the following approach will be sufficient for the
> time being.
>
> Lakin
>
> > mb =3D module_builder_t(...)
> > ogre =3D mb.namespace( 'ogre' )
> > print len( ogre.classes( '' ) ) / 2
> >
> > for unnamed_cls in ogre.classes( '' ):
> > named_parent =3D unnamed.parent
> > if not named_parent.name:
> > named_parent =3D named_parent.parent
> > for mvar in named_paret.member_variables():
> > named_parent.add_code(
> > 'add_property( "%(mvar)s", &Ogre::Vector3::%(mvar)s)"
> > % dict( mvar=3Dmvar.name ) ) )
> >
> > May be the previous code needs to be fixed, but I think you've got the =
idea.
> >
> > I work on preparing source code to release. This means: source code is =
open
> > for bug fixes + documentation. I have to do it, otherwise my project wi=
ll
> > never have documentation :-(.
> >
> > --
> > Roman Yakovenko
> > C++ Python language binding
> > http://www.language-binding.net/
> >
>
|