Possible AutoWrap bug


05-12-2008 08:03:49

I've got most of OGRE 1.6 updated with the proper header changes, and I've slowly started making the required Attributes.xml changes, but I've run in to a bit of a snag. In OGRE 1.6, the Renderable class has a new piece of functionality, a user defined Any. This is accessed using Renderable::setUserAny/RenderAble::getUserAny. Now, we don't support Any, so I need to set these methods to ignore in the Attributes.xml. Basically my Renderable definition looks as such:

<class name="Renderable" WrapType="Interface">
<class name="Visitor" WrapType="NativeDirector" />
<class name="RenderSystemData" Ignore="" />
<function name="getRenderSystemData" Ignore="" />
<function name="setRenderSystemData" Ignore="" />
<function name="getUserAny" Ignore="" />
<function name="setUserAny" Ignore="" />

This works, and IRenderable, Renderable and the Visitor proxy classes all generate, without any of the "UserAny" functions.

Now the issue is with classes that implement IRenderable, such as ShadowRenderable (by virtue of being a sub-class of Ogre::Renderable on the native side). It seems the class generator igores the Ignore attribute when generating interface implementation code. So even though Renderable and IRenderable do not contain the UserAny properties (as the native functions are set to be ignored), all the classes that implement IRenderable are still being generated with the UserAny property.

I am really not sure where to look in the AutoWrap code to fix this. I am sure it's a simple fix, simply adding an IsIgnored check somewhere, but after about four hours of stepping through the code tonight, I couldn't find it.


05-12-2008 08:15:17

I haven't dealt with wrapping Ogre, and I haven't set up managed code in ages so I don't know how to help you.

But I am curious...WHY don't we support 'Any'?


05-12-2008 08:31:26

I haven't dealt with wrapping Ogre, and I haven't set up managed code in ages so I don't know how to help you.

But I am curious...WHY don't we support 'Any'?

No need, .NET has Object, which is the same basic idea. In the places where OGRE supports a user-defined Any, MOGRE tries to expose a user Object slot for the same purpose. I'll do the same for the 1.6 Renderable property.

That said, I fixed the AutoWrap bug. In DefTypes.cs at line 1193 in DefClass.GetProperties(), you have to change:

if (f.IsProperty)


if (f.IsProperty && !f.IsIgnored)

It was generating property code for functions that were set to ignore.


05-12-2008 08:51:19

Ah! I see.

Glad you're making progress :)


05-12-2008 17:11:46

I fixed another AutoWrap issue late last night. If you define a class as WrapType="Interface", then give it a sub-class of WrapType="NativeDirector" (see Renderable above with it's new Visitor type), the interfaces for the director were created once for the interface definition and once for the abstract base class definition. I've changed this and now the director interfaces are created only for the abstract base class.

So in the case of renderable, you end up with:


The various methods that take that type, take Renderable::Visitor as their type (such as MovableObject.visitRenderables).