-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implment MDagModifier bindings #22
Conversation
I thought implementing MDagModifier was going to be a piece of cake, but I immediately ran into a problem. MDagModifier is a subclass of MDGModifier. However, I can't figure out how to subclass an existing binding. The official docs don't seem to say, and this issue suggests a way that feels kind of hacky... |
If you Google "pybind11 subclass" you will find a couple of threads on how to solve the problem, none of which worked in this scenario. The issue on the pybind github about subclasses (below) cites a way to subclass an existing binding that feels as robust as creating a class on the fly using type("MyClass", bases, attrs) -> pybind/pybind11#1193 Another issue recommends using py:base, which has been deprecated. -> pybind/pybind11#17 ...also it didn't work. It seems to me that because we are defining each class as an .inl rather than a .hpp or .cpp file, they are not aware of each other. To remedy this, I've included the MDGModifier binding in the MDagModifier file, with an pre-processor to prevent duplicate entries. Otherwise, the base class would be omitted in the main.cpp. I think this solution will work well when we get to other classes with many subclasses, like the whole MFn* tree.
After a lot of googling I have concluding that none of the examples out there work when using I did eventually figure out a solution that works - wrapping the base class in an |
@yantor3d quick heads up, I've changed the format of the docstrings in my last PR that's now been merged, you may get conflicts there We now also have automatically generated stubs, if that step fails during CI, make sure that:
A few other things might trip you so if you run into any problem, give me a ping. I'll add those notes in the |
Great work @Muream. Would it be possible to add a note to the README as well, along with a short gif demonstrating the final result in any of the editors you are using it in? |
Yep I can absolutely do that |
Thanks for the heads up! I'll take care of the merge after work. |
Stabalized and ready for merge |
Added
MDagModifier
bindingsFixes
build_win32.ps1
so MFn.Types.inl is cleaned up after each build