Closed angavrilov closed 1 year ago
@angavrilov
It seems the difference is not reflected in official API documentation, but it is of course known to Blender itself through the subtype property of RNA metadata:
As you may know, fake-bpy-module depends heavily on the official document. (You can see the generation script.) The generation script parses the docs and output the modules. https://github.com/nutti/fake-bpy-module/tree/master/src So, changing the official document itself is easier.
But if you have an idea to get the information from Blender itself including all other information, you can rewrite the analyzer instead of the original one. You can fix the generation script of the official document. https://github.com/blender/blender/blob/master/doc/python_api/sphinx_doc_gen.py
BTW, can these type be changed to bpy_prop_array
?
I think using bpy_prop_array
is much easier than parsing RNA metadata.
I submitted a patch to add this to the documentation: https://developer.blender.org/D16626
The point of using the correct type is type checking math expressions: obj1.location + obj1.rotation_quaternion @ obj2.location
etc is valid.
Thanks. I think changing the official document seems better to me. If the patch is merged, I will close this issue.
Well, it probably will require some changes in the code recognising type descriptions. The patch basically changes the standard "float array of ..." descriptions to "mathutils.Vector of ..." or "mathutils.Quaternion rotation of ..." etc, preserving the ranges, default values and so on.
@angavrilov
You patch is now merged :) I will revise the parse algorithm later.
The parse algorithm is fixed now. Thanks for your contribution to the official docs @angavrilov .
What about Matrix? The manual now names it explicitly too.
@angavrilov
Thanks. I forgot about Matrix. I have committed the patch.
It is necessary to find a way to distinguish fields of different mathutils vector variants, which are currently all represented as Vector.
It seems the difference is not reflected in official API documentation, but it is of course known to Blender itself through the
subtype
property of RNA metadata:The exact rules from code in
bpy_rna.c
are:COLOR
,COLOR_GAMMA
: useColor
if length 3; otherwisebpy_prop_array
.QUATERNION
,EULER
: use Euler if length 3, or Quaternion if length 4; otherwisebpy_prop_array
.bpy_prop_array
.