Consider shape_key_add()
. In the Python api it is listed in two places:
bpy.ops.object.shape_key_add
bpy.types.Object.shape_key_add
.
.
bpy.ops.object.shape_key_add
is coded in file object_shapekey.c as
void OBJECT_OT_shape_key_add(wmOperatorType *ot)
.
.
bpy.types.Object.shape_key_add
is coded in file rna_object_api.c as
func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
It looks like shape_key_add()
is supposed to be looked at as a member of class bpy.types.Object, and an instance of Object is declared in Class bpy.types.Operator
, and that shoouuld mean that, from the Python api perspective, there is only one method called shape_key_add() - I think? And maaybe because of the Python binding process, it was more practical just to recode certain functions like shape_key_add()
- I guess? Btw, I’m not real knowledgeable of the Python language.
.
.
Question: Why are some operators, like shape_key_add()
, coded multiple times ?
Question: Is shape_key_add()
supposed to be considered a single method - from a purely Python api perspective ?
.
.
I am interested in making certain operators and I want to get a better idea about where in the codebase should the operator code be duplicated.