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 defaults to keyword arguments in bmesh #118

Closed
xixixao opened this issue Nov 5, 2022 · 7 comments
Closed

Add defaults to keyword arguments in bmesh #118

xixixao opened this issue Nov 5, 2022 · 7 comments

Comments

@xixixao
Copy link

xixixao commented Nov 5, 2022

Description

All bmesh.ops take one required argument and all other arguments have defaults. This is not specified in the docs in type signatures but maybe we could special case it? The defaults can be found in the blender source (usually it's a 0, false, but for example for matrices it's Identity).

Are you willing to contribute about this feature. (Yes/No)

Yes, with some guidance

Screenshots [Optional]

Not having this leads to incorrect type errors:

Screen Shot 2022-11-04 at 18 30 43

@nutti
Copy link
Owner

nutti commented Nov 5, 2022

@xixixao

The defaults can be found in the blender source

It is difficult to handle because fake-bpy-module will not check the source.
If you send the patch to the Blender itself to add the default value to the document, fake-bpy-module can parse these values.
I think below document is useful for the reference.
https://docs.blender.org/api/current/bpy.ops.object.html#bpy.ops.object.add
This API document has the default value, so we can handle it.

@nutti
Copy link
Owner

nutti commented Nov 5, 2022

@xixixao

This code generates the doc itself.
This file parse the bmesh_opdefines.c to generate rst file, so we need to parse source code directly.

The defaults can be found in the blender source

Could you share your idea if you have an idea to get the default value from blender source?
Is default value definitely 0 or false?
If all default values are 0 or false, we can handle it easily from fake-bpy-module.

@xixixao
Copy link
Author

xixixao commented Nov 6, 2022

@nutti https://developer.blender.org/D16400 adds the defaults to the docs

@nutti
Copy link
Owner

nutti commented Nov 6, 2022

@xixixao

Great!
I think fixing to the official is better idea.

@xixixao
Copy link
Author

xixixao commented Nov 18, 2022

@nutti How did you get someone from Blender to review your diffs? I've tried the devtalk forum and blender.chat but didn't get any traction on the diff so far.

@nutti
Copy link
Owner

nutti commented Nov 19, 2022

@xixixao

I'm not sure when Blender developer reviews the patch.
(My other patch reviews are also stopped, so we need to wait patiently.)
Your action (devtalk forum and blender.chat) seems correct when the review is stopped.

@nutti
Copy link
Owner

nutti commented Dec 8, 2022

The patch is now merged to the official repo.
Thanks for your help @xixixao !

@nutti nutti closed this as completed Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants