.NET bindings?

Panda3D seems like a great free engine, but I’m such a .NET/C# junkie I can’t imagine leaving it for Python. Has anyone made, or is thinking of making, a .NET wrapper for Panda3D?

I suppose, in theory, it’s probably possible. But man, that sounds like a lot of work.

Yeah, the problem with writing wrappers for extensive APIs is that it takes a long time and there’s very little room for creativity; i.e. boring.

I’ll look at the source; if the API is very object-oriented and close to what people would expect from a .NET assembly, it could mean mostly just copy/pasting class names/members and mapping them to the Win32 calls.

You couldn’t possibly do it manually. First, there are literally thousands of methods, and the list grows every day. More importantly, nobody here uses C#, so we wouldn’t know how to maintain the C# bindings. They’d be broken in less than a week.

So the generation really needs to be fully automated. There’s a program, interrogate, which generates the python bindings. To support C#, you’d have to make interrogate C#-aware.

Also, be aware that although the CPU-intensive stuff is all in C++, there are lots of utility functions implemented in python. For example, the task handling system, the debugging tools, and so forth.

Frankly, I think it’s much too hard.

Is that how often you release new versions? Because the bindings will only have to be updated with new public releases.

Either that, or just write a .h parser that does the boring work of finding all public methods, that at least decreases the amount of manual labor. And the wrapper doesn’t have to be 100% complete in version 1. Irrlicht.NET is popular although it’s lagging behind the C++ version.

It’s not impossible that 95% of that work could be done automatically by cutting/pasting into Visual Studio and compiling as IronPython.

That’s what makes me tick;) Unfortunately I have no free time ATM so I hope someone else feels that way too…

That’s kind of what interrogate is. Although it’s actually a full-fledged ANSI C++ parser, but it is designed to be able to write wrappers for multiple different languages. We used to use it to generate wrappers for Squeak, a long time ago, before we moved to Python. It might not be difficult to coerce it to generate wrappers for .NET now, but there would be a steep learning curve–interrogate is not the most elegantly written piece of Panda.

In fact, the wrappers that we generated for Squeak were actually just ordinary C functions, so that (for instance) myNodePath.get_pos() became nodepath_get_pos(myNodePath). We can probably still generate those C functions, after dusting off some long-unused code. If .NET can call ordinary C functions of this nature, you might be done (though the interface wouldn’t be quite so object-oriented).

Another option is to run Panda through SWIG, which can already generate .NET wrappers. Hugh Perkins reported some success with this a little while back; search the forums for his posts and the link to his Wiki.

David

Another option is to run Panda through SWIG, which can already generate .NET wrappers. Hugh Perkins reported some success with this a little while back; search the forums for his posts and the link to his Wiki.

Yes, although SWIG isn’t real aware of panda’s reference counting mechanisms.

I have started to develop .NET bindings for Panda3D… although I think if I continue to do it manually I will never finish. David, where can I find that generation tool?

Nevermind… panda3d.org/manual/index.php/Interrogate

must be zombie-week… resurrection of long-dead threads are all over the place :smiling_imp: