Wrapper base class constructor

Kodachi_Garou

31-08-2009 16:08:09

Hi all,

This is a doubt that's been around since early versions of Mogre, and which has never been fully clarified in my head. Why is it that the Wrapper base class constructor has an 'internal' modifier instead of 'public' or better-still, 'protected'?

From what I can see this effectively prevents any extensions from being compiled from outside the Mogre assembly. Is there any special restriction or issue that justifies this being so? How is the wrapping of other plugins being handled so far?

I mean, suppose I have my own Ogre plugin which inherits from an Ogre base class, which in turn inherits from CLRObject. It makes sense that if I want to wrap it to C# I have to inherit from Wrapper and make use of the same base mechanism of all other classes, but I can only do this if I compile my plugin wrapper classes from inside Mogre project.

This would break extensibility tremendously.

Am I missing something?

Best regards,

Gonçalo

Bekas

02-09-2009 08:31:22

Am I missing something?
Nope, you are totally right; this was an unfortunate choice that prohibits extensions.

How is the wrapping of other plugins being handled so far?
AFAIK there are no other plugins wrapped, which is why there was no push to modify Wrapper so far.

[edit]Hmm, actually there were some wrapped plugins but I don't think they involved subclassing Ogre classes..
Can anyone involved on these plugins (HikariWrapper, managed Hydrax) chime in ?[/edit]

GantZ

02-09-2009 10:47:32

Hmm, actually there were some wrapped plugins but I don't think they involved subclassing Ogre classes..

about Hikariwrapper, there isn't any subclassing. you just need to provide a pointer to unmanaged ogre object. [edit] after some verification :), i have some subclassing, but only on ogre class that don't derive from CLRObject[/edit]

Kodachi_Garou

02-09-2009 11:56:32

Ok, and are there any impediments to changing the constructors to have a protected modifier? At least from now on this problem will be fixed.

I'm building Mogre from SVN source anyway, so I'll test the modification and see how it goes.

Thanks,

Gonçalo