Skip to content
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

Add MFnBase #32

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Add MFnBase #32

wants to merge 2 commits into from

Conversation

Muream
Copy link
Contributor

@Muream Muream commented May 22, 2022

This PR implements the Bindings for MFnBase and makes MFnDependencyNode a subclass of it, as well as MFnDagNode a subclass of MFnDependencyNode

I also noticed that the MDGModifier and MDagModifier classes were defined exactly like the other classes in ForwardDeclarations.inl so I've updated that.

MFnBase has two methods that have been added in Maya 2020, I think I managed to get them to compile only for the right releases of cmdc but we'll see.
I do feel like this means we should release a version of the stubs per maya version though? Otherwise when working with 2019 we'll get completion on methods that don't exist.

I'm expecting this to fail at the moment because MFnBase::className() returns MFnBase and not FnBase like I think we would expect.
I'm not actually sure how to dynamically get the name of the class in C++?
I'm also not really sure that this even matters as we can just call MFnBase.__name__ in python.

@mottosso
Copy link
Owner

I do feel like this means we should release a version of the stubs per maya version though? Otherwise when working with 2019 we'll get completion on methods that don't exist.

Most likely yes.

I'm not actually sure how to dynamically get the name of the class in C++?

You cannot, not unless pybind has something for it. The common thing to do is parse the C++ text files, which in our case might be possible? E.g. any line that starts with class .

I'm expecting this to fail at the moment because MFnBase::className() returns MFnBase and not FnBase like I think we would expect.

Shouldn't we override it, to return our own name?

@Muream
Copy link
Contributor Author

Muream commented May 23, 2022

@scottenglert I thought I could add you as a reviewer but looks like I can't, so quick ping to notify you of this PR.

Shouldn't we override it, to return our own name?

Yeah, that's why I wanted to dynamically get the name of the class to avoid re-implementing this in all subclasses.
Parsing the source file feels a bit awkward and prone to breaking in the future though.
I'll think about it

I just noticed that the tests technically failed but they got marked as if they passed on the github actions, not quite sure why that is but I can look into that as well.

@scottenglert
Copy link
Collaborator

Has anyone actually have used the "className" in real code? I have not and I agree with just calling the __name__ on the class object.

@mottosso
Copy link
Owner

Ahaha, good point! Safe to ignore that method. :)

@Muream
Copy link
Contributor Author

Muream commented May 23, 2022

I think I'll implement it but raise something like Not Implemented: use cls.__name__ instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants