Cleanup: use nodiscard attribute for functions in the Python API
In most (cases functions returning a PyObject pointer requires it to be used by the caller, declare functions in the Python API with the `nodiscard` attribute.
This commit is contained in:
@@ -41,7 +41,7 @@ using BPy_ThreadStatePtr = void *;
|
||||
/**
|
||||
* Analogue of #PyEval_SaveThread()
|
||||
*/
|
||||
BPy_ThreadStatePtr BPY_thread_save();
|
||||
[[nodiscard]] BPy_ThreadStatePtr BPY_thread_save();
|
||||
/**
|
||||
* Analogue of #PyEval_RestoreThread()
|
||||
*/
|
||||
@@ -90,10 +90,10 @@ void BPY_driver_reset();
|
||||
* This evaluates Python driver expressions, `driver_orig->expression`
|
||||
* is a Python expression that should evaluate to a float number, which is returned.
|
||||
*/
|
||||
float BPY_driver_exec(PathResolvedRNA *anim_rna,
|
||||
ChannelDriver *driver,
|
||||
ChannelDriver *driver_orig,
|
||||
const AnimationEvalContext *anim_eval_context);
|
||||
[[nodiscard]] float BPY_driver_exec(PathResolvedRNA *anim_rna,
|
||||
ChannelDriver *driver,
|
||||
ChannelDriver *driver_orig,
|
||||
const AnimationEvalContext *anim_eval_context);
|
||||
|
||||
/**
|
||||
* Acquire the global-interpreter-lock (GIL) and wrap `Py_DECREF`.
|
||||
@@ -102,11 +102,9 @@ float BPY_driver_exec(PathResolvedRNA *anim_rna,
|
||||
void BPY_DECREF(void *pyob_ptr);
|
||||
|
||||
void BPY_DECREF_RNA_INVALIDATE(void *pyob_ptr);
|
||||
/**
|
||||
* \return true when `member` was found.
|
||||
* Note that this can include a "None" value.
|
||||
*/
|
||||
bool BPY_context_member_get(bContext *C, const char *member, bContextDataResult *result);
|
||||
[[nodiscard]] bool BPY_context_member_get(bContext *C,
|
||||
const char *member,
|
||||
bContextDataResult *result);
|
||||
void BPY_context_set(bContext *C);
|
||||
/**
|
||||
* Use for updating while a python script runs - in case of file load.
|
||||
@@ -137,7 +135,7 @@ void BPY_free_srna_pytype(StructRNA *srna);
|
||||
/**
|
||||
* Avoids duplicating keyword list.
|
||||
*/
|
||||
bool BPY_string_is_keyword(const char *str);
|
||||
[[nodiscard]] bool BPY_string_is_keyword(const char *str);
|
||||
|
||||
/* `bpy_rna_callback.cc` */
|
||||
|
||||
@@ -146,6 +144,6 @@ void BPY_callback_wm_free(wmWindowManager *wm);
|
||||
|
||||
/* I18n for addons */
|
||||
#ifdef WITH_INTERNATIONAL
|
||||
std::optional<blender::StringRefNull> BPY_app_translations_py_pgettext(blender::StringRef msgctxt,
|
||||
blender::StringRef msgid);
|
||||
[[nodiscard]] std::optional<blender::StringRefNull> BPY_app_translations_py_pgettext(
|
||||
blender::StringRef msgctxt, blender::StringRef msgid);
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@ void BPY_python_start(bContext *C, int argc, const char **argv);
|
||||
void BPY_python_end(bool do_python_exit);
|
||||
void BPY_python_reset(bContext *C);
|
||||
void BPY_python_use_system_env();
|
||||
bool BPY_python_use_system_env_get();
|
||||
[[nodiscard]] bool BPY_python_use_system_env_get();
|
||||
void BPY_python_backtrace(FILE *fp);
|
||||
|
||||
/* `bpy_app.cc` */
|
||||
|
||||
@@ -131,11 +131,11 @@ struct BPy_RunErrInfo {
|
||||
* \param r_value: The resulting value.
|
||||
* \return Success.
|
||||
*/
|
||||
bool BPY_run_string_as_number(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
double *r_value) ATTR_NONNULL(1, 3, 5);
|
||||
[[nodiscard]] bool BPY_run_string_as_number(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
double *r_value) ATTR_NONNULL(1, 3, 5);
|
||||
/**
|
||||
* Evaluate `expr` as an integer or pointer.
|
||||
*
|
||||
@@ -148,11 +148,11 @@ bool BPY_run_string_as_number(bContext *C,
|
||||
* \param r_value: The resulting value.
|
||||
* \return Success.
|
||||
*/
|
||||
bool BPY_run_string_as_intptr(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
intptr_t *r_value) ATTR_NONNULL(1, 3, 5);
|
||||
[[nodiscard]] bool BPY_run_string_as_intptr(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
intptr_t *r_value) ATTR_NONNULL(1, 3, 5);
|
||||
/**
|
||||
* Evaluate `expr` as a string.
|
||||
*
|
||||
@@ -163,19 +163,19 @@ bool BPY_run_string_as_intptr(bContext *C,
|
||||
* \param r_value: The resulting value.
|
||||
* \return Success.
|
||||
*/
|
||||
bool BPY_run_string_as_string_and_len(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value,
|
||||
size_t *r_value_len) ATTR_NONNULL(1, 3, 5, 6);
|
||||
[[nodiscard]] bool BPY_run_string_as_string_and_len(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value,
|
||||
size_t *r_value_len) ATTR_NONNULL(1, 3, 5, 6);
|
||||
|
||||
/** See #BPY_run_string_as_string_and_len */
|
||||
bool BPY_run_string_as_string(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value) ATTR_NONNULL(1, 3, 5);
|
||||
[[nodiscard]] bool BPY_run_string_as_string(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value) ATTR_NONNULL(1, 3, 5);
|
||||
|
||||
/**
|
||||
* Evaluate `expr` as a string or None.
|
||||
@@ -188,18 +188,19 @@ bool BPY_run_string_as_string(bContext *C,
|
||||
* \param r_value: The resulting value.
|
||||
* \return Success.
|
||||
*/
|
||||
bool BPY_run_string_as_string_and_len_or_none(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value,
|
||||
size_t *r_value_len) ATTR_NONNULL(1, 3, 5, 6);
|
||||
[[nodiscard]] bool BPY_run_string_as_string_and_len_or_none(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value,
|
||||
size_t *r_value_len)
|
||||
ATTR_NONNULL(1, 3, 5, 6);
|
||||
|
||||
/** See #BPY_run_string_as_string_and_len */
|
||||
bool BPY_run_string_as_string_or_none(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value) ATTR_NONNULL(1, 3, 5);
|
||||
[[nodiscard]] bool BPY_run_string_as_string_or_none(bContext *C,
|
||||
const char *imports[],
|
||||
const char *expr,
|
||||
BPy_RunErrInfo *err_info,
|
||||
char **r_value) ATTR_NONNULL(1, 3, 5);
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPyInit_bmesh();
|
||||
[[nodiscard]] PyObject *BPyInit_bmesh();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPyInit_bmesh_geometry();
|
||||
[[nodiscard]] PyObject *BPyInit_bmesh_geometry();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPyInit_bmesh_ops();
|
||||
[[nodiscard]] PyObject *BPyInit_bmesh_ops();
|
||||
|
||||
@@ -18,4 +18,4 @@ struct BPy_BMeshOpFunc {
|
||||
/**
|
||||
* This is the `__call__` for `bmesh.ops.xxx()`.
|
||||
*/
|
||||
PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw);
|
||||
[[nodiscard]] PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw);
|
||||
|
||||
@@ -125,27 +125,27 @@ struct BPy_BMIter {
|
||||
|
||||
void BPy_BM_init_types();
|
||||
|
||||
PyObject *BPyInit_bmesh_types();
|
||||
[[nodiscard]] PyObject *BPyInit_bmesh_types();
|
||||
|
||||
enum {
|
||||
BPY_BMFLAG_NOP = 0, /* do nothing */
|
||||
BPY_BMFLAG_IS_WRAPPED = 1, /* the mesh is owned by editmode */
|
||||
};
|
||||
|
||||
PyObject *BPy_BMesh_CreatePyObject(BMesh *bm, int flag);
|
||||
PyObject *BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v);
|
||||
PyObject *BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e);
|
||||
PyObject *BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f);
|
||||
PyObject *BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l);
|
||||
PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, char itype);
|
||||
PyObject *BPy_BMVertSeq_CreatePyObject(BMesh *bm);
|
||||
PyObject *BPy_BMEdgeSeq_CreatePyObject(BMesh *bm);
|
||||
PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm);
|
||||
PyObject *BPy_BMLoopSeq_CreatePyObject(BMesh *bm);
|
||||
PyObject *BPy_BMIter_CreatePyObject(BMesh *bm);
|
||||
[[nodiscard]] PyObject *BPy_BMesh_CreatePyObject(BMesh *bm, int flag);
|
||||
[[nodiscard]] PyObject *BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v);
|
||||
[[nodiscard]] PyObject *BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e);
|
||||
[[nodiscard]] PyObject *BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f);
|
||||
[[nodiscard]] PyObject *BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l);
|
||||
[[nodiscard]] PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, char itype);
|
||||
[[nodiscard]] PyObject *BPy_BMVertSeq_CreatePyObject(BMesh *bm);
|
||||
[[nodiscard]] PyObject *BPy_BMEdgeSeq_CreatePyObject(BMesh *bm);
|
||||
[[nodiscard]] PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm);
|
||||
[[nodiscard]] PyObject *BPy_BMLoopSeq_CreatePyObject(BMesh *bm);
|
||||
[[nodiscard]] PyObject *BPy_BMIter_CreatePyObject(BMesh *bm);
|
||||
|
||||
/** Just checks type and creates vert/edge/face/loop. */
|
||||
PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele);
|
||||
[[nodiscard]] PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele);
|
||||
|
||||
/**
|
||||
* Generic python seq as BMVert/Edge/Face array,
|
||||
@@ -153,46 +153,48 @@ PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele);
|
||||
*
|
||||
* The 'bm_r' value is assigned when empty, and used when set.
|
||||
*/
|
||||
void *BPy_BMElem_PySeq_As_Array_FAST(BMesh **r_bm,
|
||||
PyObject *seq_fast,
|
||||
Py_ssize_t min,
|
||||
Py_ssize_t max,
|
||||
Py_ssize_t *r_size,
|
||||
char htype,
|
||||
bool do_unique_check,
|
||||
bool do_bm_check,
|
||||
const char *error_prefix);
|
||||
void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm,
|
||||
PyObject *seq,
|
||||
Py_ssize_t min,
|
||||
Py_ssize_t max,
|
||||
Py_ssize_t *r_size,
|
||||
char htype,
|
||||
bool do_unique_check,
|
||||
bool do_bm_check,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] void *BPy_BMElem_PySeq_As_Array_FAST(BMesh **r_bm,
|
||||
PyObject *seq_fast,
|
||||
Py_ssize_t min,
|
||||
Py_ssize_t max,
|
||||
Py_ssize_t *r_size,
|
||||
char htype,
|
||||
bool do_unique_check,
|
||||
bool do_bm_check,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm,
|
||||
PyObject *seq,
|
||||
Py_ssize_t min,
|
||||
Py_ssize_t max,
|
||||
Py_ssize_t *r_size,
|
||||
char htype,
|
||||
bool do_unique_check,
|
||||
bool do_bm_check,
|
||||
const char *error_prefix);
|
||||
|
||||
PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len);
|
||||
PyObject *BPy_BMVert_Array_As_Tuple(BMesh *bm, BMVert **elem, Py_ssize_t elem_len);
|
||||
PyObject *BPy_BMEdge_Array_As_Tuple(BMesh *bm, BMEdge **elem, Py_ssize_t elem_len);
|
||||
PyObject *BPy_BMFace_Array_As_Tuple(BMesh *bm, BMFace **elem, Py_ssize_t elem_len);
|
||||
PyObject *BPy_BMLoop_Array_As_Tuple(BMesh *bm, BMLoop *const *elem, Py_ssize_t elem_len);
|
||||
[[nodiscard]] PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len);
|
||||
[[nodiscard]] PyObject *BPy_BMVert_Array_As_Tuple(BMesh *bm, BMVert **elem, Py_ssize_t elem_len);
|
||||
[[nodiscard]] PyObject *BPy_BMEdge_Array_As_Tuple(BMesh *bm, BMEdge **elem, Py_ssize_t elem_len);
|
||||
[[nodiscard]] PyObject *BPy_BMFace_Array_As_Tuple(BMesh *bm, BMFace **elem, Py_ssize_t elem_len);
|
||||
[[nodiscard]] PyObject *BPy_BMLoop_Array_As_Tuple(BMesh *bm,
|
||||
BMLoop *const *elem,
|
||||
Py_ssize_t elem_len);
|
||||
|
||||
int BPy_BMElem_CheckHType(PyTypeObject *type, char htype);
|
||||
[[nodiscard]] int BPy_BMElem_CheckHType(PyTypeObject *type, char htype);
|
||||
/**
|
||||
* Use for error strings only, not thread safe,
|
||||
*
|
||||
* \return a string like '(BMVert/BMEdge/BMFace/BMLoop)'
|
||||
*/
|
||||
char *BPy_BMElem_StringFromHType_ex(char htype, char ret[32]);
|
||||
char *BPy_BMElem_StringFromHType(char htype);
|
||||
[[nodiscard]] char *BPy_BMElem_StringFromHType_ex(char htype, char ret[32]);
|
||||
[[nodiscard]] char *BPy_BMElem_StringFromHType(char htype);
|
||||
|
||||
// void bpy_bm_generic_invalidate(BPy_BMGeneric *self);
|
||||
int bpy_bm_generic_valid_check(BPy_BMGeneric *self);
|
||||
int bpy_bm_generic_valid_check_source(BMesh *bm_source,
|
||||
const char *error_prefix,
|
||||
void **args,
|
||||
uint args_tot) ATTR_NONNULL(1, 2);
|
||||
[[nodiscard]] int bpy_bm_generic_valid_check(BPy_BMGeneric *self);
|
||||
[[nodiscard]] int bpy_bm_generic_valid_check_source(BMesh *bm_source,
|
||||
const char *error_prefix,
|
||||
void **args,
|
||||
uint args_tot) ATTR_NONNULL(1, 2);
|
||||
|
||||
#define BPY_BM_CHECK_OBJ(obj) \
|
||||
if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { \
|
||||
|
||||
@@ -52,9 +52,9 @@ struct BPy_BMLayerItem {
|
||||
int index; /* index of this layer type */
|
||||
};
|
||||
|
||||
PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, char htype);
|
||||
PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, char htype, int type);
|
||||
PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, char htype, int type, int index);
|
||||
[[nodiscard]] PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, char htype);
|
||||
[[nodiscard]] PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, char htype, int type);
|
||||
[[nodiscard]] PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, char htype, int type, int index);
|
||||
|
||||
void BPy_BM_init_types_customdata();
|
||||
|
||||
@@ -63,5 +63,7 @@ void BPy_BM_init_types_customdata();
|
||||
*
|
||||
* Assume all error checks are done, eg: `uv = vert[uv_layer]`
|
||||
*/
|
||||
PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer);
|
||||
int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *value);
|
||||
[[nodiscard]] PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer);
|
||||
[[nodiscard]] int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele,
|
||||
BPy_BMLayerItem *py_layer,
|
||||
PyObject *value);
|
||||
|
||||
@@ -27,17 +27,17 @@ struct MLoopCol;
|
||||
struct MVertSkin;
|
||||
struct BMesh;
|
||||
|
||||
int BPy_BMLoopUV_AssignPyObject(struct BMesh *bm, BMLoop *loop, PyObject *value);
|
||||
PyObject *BPy_BMLoopUV_CreatePyObject(struct BMesh *bm, BMLoop *loop, int layer);
|
||||
[[nodiscard]] int BPy_BMLoopUV_AssignPyObject(struct BMesh *bm, BMLoop *loop, PyObject *value);
|
||||
[[nodiscard]] PyObject *BPy_BMLoopUV_CreatePyObject(struct BMesh *bm, BMLoop *loop, int layer);
|
||||
|
||||
int BPy_BMVertSkin_AssignPyObject(struct MVertSkin *mvertskin, PyObject *value);
|
||||
PyObject *BPy_BMVertSkin_CreatePyObject(struct MVertSkin *mvertskin);
|
||||
[[nodiscard]] int BPy_BMVertSkin_AssignPyObject(struct MVertSkin *mvertskin, PyObject *value);
|
||||
[[nodiscard]] PyObject *BPy_BMVertSkin_CreatePyObject(struct MVertSkin *mvertskin);
|
||||
|
||||
int BPy_BMLoopColor_AssignPyObject(struct MLoopCol *mloopcol, PyObject *value);
|
||||
PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *mloopcol);
|
||||
[[nodiscard]] int BPy_BMLoopColor_AssignPyObject(struct MLoopCol *mloopcol, PyObject *value);
|
||||
[[nodiscard]] PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *mloopcol);
|
||||
|
||||
int BPy_BMDeformVert_AssignPyObject(struct MDeformVert *dvert, PyObject *value);
|
||||
PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert);
|
||||
[[nodiscard]] int BPy_BMDeformVert_AssignPyObject(struct MDeformVert *dvert, PyObject *value);
|
||||
[[nodiscard]] PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert);
|
||||
|
||||
/* call to init all types */
|
||||
void BPy_BM_init_types_meshdata();
|
||||
|
||||
@@ -35,9 +35,9 @@ struct BPy_BMEditSelIter {
|
||||
|
||||
void BPy_BM_init_types_select();
|
||||
|
||||
PyObject *BPy_BMEditSel_CreatePyObject(BMesh *bm);
|
||||
PyObject *BPy_BMEditSelIter_CreatePyObject(BMesh *bm);
|
||||
[[nodiscard]] PyObject *BPy_BMEditSel_CreatePyObject(BMesh *bm);
|
||||
[[nodiscard]] PyObject *BPy_BMEditSelIter_CreatePyObject(BMesh *bm);
|
||||
/**
|
||||
* \note doesn't actually check selection.
|
||||
*/
|
||||
int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value);
|
||||
[[nodiscard]] int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value);
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPyInit_bmesh_utils();
|
||||
[[nodiscard]] PyObject *BPyInit_bmesh_utils();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPyInit_blf();
|
||||
[[nodiscard]] PyObject *BPyInit_blf();
|
||||
|
||||
@@ -75,29 +75,30 @@ struct BPy_IDGroup_View {
|
||||
bool reversed;
|
||||
};
|
||||
|
||||
PyObject *BPy_Wrap_GetKeys(IDProperty *prop);
|
||||
PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop);
|
||||
PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop);
|
||||
[[nodiscard]] PyObject *BPy_Wrap_GetKeys(IDProperty *prop);
|
||||
[[nodiscard]] PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop);
|
||||
[[nodiscard]] PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop);
|
||||
|
||||
PyObject *BPy_Wrap_GetKeys_View_WithID(ID *id, IDProperty *prop);
|
||||
PyObject *BPy_Wrap_GetValues_View_WithID(ID *id, IDProperty *prop);
|
||||
PyObject *BPy_Wrap_GetItems_View_WithID(ID *id, IDProperty *prop);
|
||||
[[nodiscard]] PyObject *BPy_Wrap_GetKeys_View_WithID(ID *id, IDProperty *prop);
|
||||
[[nodiscard]] PyObject *BPy_Wrap_GetValues_View_WithID(ID *id, IDProperty *prop);
|
||||
[[nodiscard]] PyObject *BPy_Wrap_GetItems_View_WithID(ID *id, IDProperty *prop);
|
||||
|
||||
int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val);
|
||||
[[nodiscard]] int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val);
|
||||
|
||||
/**
|
||||
* For simple, non nested types this is the same as #BPy_IDGroup_WrapData.
|
||||
*/
|
||||
PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop);
|
||||
PyObject *BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent);
|
||||
[[nodiscard]] PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop);
|
||||
[[nodiscard]] PyObject *BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent);
|
||||
/**
|
||||
* \note group can be a pointer array or a group.
|
||||
* assume we already checked key is a string.
|
||||
*
|
||||
* \return success.
|
||||
*/
|
||||
bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *key, IDProperty *group, PyObject *ob);
|
||||
|
||||
[[nodiscard]] bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *key,
|
||||
IDProperty *group,
|
||||
PyObject *ob);
|
||||
void IDProp_Init_Types();
|
||||
|
||||
PyObject *BPyInit_idprop();
|
||||
[[nodiscard]] PyObject *BPyInit_idprop();
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
struct ImBuf;
|
||||
|
||||
PyObject *BPyInit_imbuf();
|
||||
[[nodiscard]] PyObject *BPyInit_imbuf();
|
||||
|
||||
extern PyTypeObject Py_ImBuf_Type;
|
||||
|
||||
/** Return the #ImBuf or null with an error set. */
|
||||
ImBuf *BPy_ImBuf_FromPyObject(PyObject *py_imbuf);
|
||||
[[nodiscard]] ImBuf *BPy_ImBuf_FromPyObject(PyObject *py_imbuf);
|
||||
|
||||
@@ -17,15 +17,15 @@ struct EnumPropertyItem;
|
||||
* Convert all items into a single comma separated string.
|
||||
* Use for creating useful error messages.
|
||||
*/
|
||||
char *pyrna_enum_repr(const EnumPropertyItem *item);
|
||||
[[nodiscard]] char *pyrna_enum_repr(const EnumPropertyItem *item);
|
||||
|
||||
/**
|
||||
* Same as #RNA_enum_value_from_id, but raises an exception.
|
||||
*/
|
||||
int pyrna_enum_value_from_id(const EnumPropertyItem *item,
|
||||
const char *identifier,
|
||||
int *r_value,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int pyrna_enum_value_from_id(const EnumPropertyItem *item,
|
||||
const char *identifier,
|
||||
int *r_value,
|
||||
const char *error_prefix);
|
||||
|
||||
/**
|
||||
* Takes a set of strings and map it to and array of booleans.
|
||||
@@ -35,22 +35,22 @@ int pyrna_enum_value_from_id(const EnumPropertyItem *item,
|
||||
* \param type_convert_sign: Maps signed to unsigned range,
|
||||
* needed when we want to use the full range of a signed short/char.
|
||||
*/
|
||||
unsigned int *pyrna_enum_bitmap_from_set(const EnumPropertyItem *items,
|
||||
PyObject *value,
|
||||
int type_size,
|
||||
bool type_convert_sign,
|
||||
int bitmap_size,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] unsigned int *pyrna_enum_bitmap_from_set(const EnumPropertyItem *items,
|
||||
PyObject *value,
|
||||
int type_size,
|
||||
bool type_convert_sign,
|
||||
int bitmap_size,
|
||||
const char *error_prefix);
|
||||
|
||||
/**
|
||||
* 'value' _must_ be a set type, error check before calling.
|
||||
*/
|
||||
int pyrna_enum_bitfield_from_set(const EnumPropertyItem *items,
|
||||
PyObject *value,
|
||||
int *r_value,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int pyrna_enum_bitfield_from_set(const EnumPropertyItem *items,
|
||||
PyObject *value,
|
||||
int *r_value,
|
||||
const char *error_prefix);
|
||||
|
||||
PyObject *pyrna_enum_bitfield_as_set(const EnumPropertyItem *items, int value);
|
||||
[[nodiscard]] PyObject *pyrna_enum_bitfield_as_set(const EnumPropertyItem *items, int value);
|
||||
|
||||
/**
|
||||
* Data for #pyrna_enum_value_parse_string & #pyrna_enum_bitfield_parse_set parsing utilities.
|
||||
@@ -71,8 +71,8 @@ struct BPy_EnumProperty_Parse {
|
||||
/**
|
||||
* Use with #PyArg_ParseTuple's `O&` formatting.
|
||||
*/
|
||||
int pyrna_enum_value_parse_string(PyObject *o, void *p);
|
||||
[[nodiscard]] int pyrna_enum_value_parse_string(PyObject *o, void *p);
|
||||
/**
|
||||
* Use with #PyArg_ParseTuple's `O&` formatting.
|
||||
*/
|
||||
int pyrna_enum_bitfield_parse_set(PyObject *o, void *p);
|
||||
[[nodiscard]] int pyrna_enum_bitfield_parse_set(PyObject *o, void *p);
|
||||
|
||||
@@ -1487,11 +1487,11 @@ PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag)
|
||||
/** \name Run String (Evaluate to Primitive Types)
|
||||
* \{ */
|
||||
|
||||
static PyObject *pyc_run_string_as_py_object(const char *imports[],
|
||||
const char *imports_star[],
|
||||
const char *expr,
|
||||
const char *filename)
|
||||
ATTR_NONNULL(3, 4) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] static PyObject *pyc_run_string_as_py_object(const char *imports[],
|
||||
const char *imports_star[],
|
||||
const char *expr,
|
||||
const char *filename)
|
||||
ATTR_NONNULL(3, 4);
|
||||
static PyObject *pyc_run_string_as_py_object(const char *imports[],
|
||||
const char *imports_star[],
|
||||
const char *expr,
|
||||
|
||||
@@ -35,17 +35,17 @@ void PyC_StackSpit();
|
||||
* - `SystemExit` exceptions will exit (so `sys.exit(..)` works, matching `PyErr_Print` behavior).
|
||||
* - The always returns a Python string (unless exiting where the function doesn't return).
|
||||
*/
|
||||
PyObject *PyC_ExceptionBuffer() ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
|
||||
[[nodiscard]] PyObject *PyC_ExceptionBuffer() ATTR_RETURNS_NONNULL;
|
||||
/**
|
||||
* A version of #PyC_ExceptionBuffer that returns the last exception only.
|
||||
*
|
||||
* Useful for error messages from evaluating numeric expressions for example
|
||||
* where a full multi-line stack-trace isn't needed and doesn't format well in the status-bar.
|
||||
*/
|
||||
PyObject *PyC_ExceptionBuffer_Simple() ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
|
||||
[[nodiscard]] PyObject *PyC_ExceptionBuffer_Simple() ATTR_RETURNS_NONNULL;
|
||||
|
||||
PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
|
||||
PyObject *PyC_FrozenSetFromStrings(const char **strings);
|
||||
[[nodiscard]] PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
|
||||
[[nodiscard]] PyObject *PyC_FrozenSetFromStrings(const char **strings);
|
||||
|
||||
/**
|
||||
* Similar to #PyErr_Format(),
|
||||
@@ -65,50 +65,58 @@ void PyC_Err_PrintWithFunc(PyObject *py_func);
|
||||
|
||||
void PyC_FileAndNum(const char **r_filename, int *r_lineno);
|
||||
void PyC_FileAndNum_Safe(const char **r_filename, int *r_lineno); /* checks python is running */
|
||||
int PyC_AsArray_FAST(void *array,
|
||||
size_t array_item_size,
|
||||
PyObject *value_fast,
|
||||
Py_ssize_t length,
|
||||
const PyTypeObject *type,
|
||||
const char *error_prefix);
|
||||
int PyC_AsArray(void *array,
|
||||
size_t array_item_size,
|
||||
PyObject *value,
|
||||
Py_ssize_t length,
|
||||
const PyTypeObject *type,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int PyC_AsArray_FAST(void *array,
|
||||
size_t array_item_size,
|
||||
PyObject *value_fast,
|
||||
Py_ssize_t length,
|
||||
const PyTypeObject *type,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int PyC_AsArray(void *array,
|
||||
size_t array_item_size,
|
||||
PyObject *value,
|
||||
Py_ssize_t length,
|
||||
const PyTypeObject *type,
|
||||
const char *error_prefix);
|
||||
|
||||
int PyC_AsArray_Multi_FAST(void *array,
|
||||
size_t array_item_size,
|
||||
PyObject *value_fast,
|
||||
const int *dims,
|
||||
int dims_len,
|
||||
const PyTypeObject *type,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int PyC_AsArray_Multi_FAST(void *array,
|
||||
size_t array_item_size,
|
||||
PyObject *value_fast,
|
||||
const int *dims,
|
||||
int dims_len,
|
||||
const PyTypeObject *type,
|
||||
const char *error_prefix);
|
||||
|
||||
int PyC_AsArray_Multi(void *array,
|
||||
size_t array_item_size,
|
||||
PyObject *value,
|
||||
const int *dims,
|
||||
int dims_len,
|
||||
const PyTypeObject *type,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int PyC_AsArray_Multi(void *array,
|
||||
size_t array_item_size,
|
||||
PyObject *value,
|
||||
const int *dims,
|
||||
int dims_len,
|
||||
const PyTypeObject *type,
|
||||
const char *error_prefix);
|
||||
|
||||
PyObject *PyC_Tuple_PackArray_F32(const float *array, uint len);
|
||||
PyObject *PyC_Tuple_PackArray_F64(const double *array, uint len);
|
||||
PyObject *PyC_Tuple_PackArray_I32(const int *array, uint len);
|
||||
PyObject *PyC_Tuple_PackArray_I32FromBool(const int *array, uint len);
|
||||
PyObject *PyC_Tuple_PackArray_Bool(const bool *array, uint len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_F32(const float *array, uint len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_F64(const double *array, uint len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_I32(const int *array, uint len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_I32FromBool(const int *array, uint len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_Bool(const bool *array, uint len);
|
||||
|
||||
/**
|
||||
* \note Any errors converting strings will return null with the error left as-is.
|
||||
*/
|
||||
PyObject *PyC_Tuple_PackArray_String(const char **array, uint len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_String(const char **array, uint len);
|
||||
|
||||
PyObject *PyC_Tuple_PackArray_Multi_F32(const float *array, const int dims[], int dims_len);
|
||||
PyObject *PyC_Tuple_PackArray_Multi_F64(const double *array, const int dims[], int dims_len);
|
||||
PyObject *PyC_Tuple_PackArray_Multi_I32(const int *array, const int dims[], int dims_len);
|
||||
PyObject *PyC_Tuple_PackArray_Multi_Bool(const bool *array, const int dims[], int dims_len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_Multi_F32(const float *array,
|
||||
const int dims[],
|
||||
int dims_len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_Multi_F64(const double *array,
|
||||
const int dims[],
|
||||
int dims_len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_Multi_I32(const int *array,
|
||||
const int dims[],
|
||||
int dims_len);
|
||||
[[nodiscard]] PyObject *PyC_Tuple_PackArray_Multi_Bool(const bool *array,
|
||||
const int dims[],
|
||||
int dims_len);
|
||||
|
||||
/**
|
||||
* Caller needs to ensure tuple is uninitialized.
|
||||
@@ -122,12 +130,13 @@ void PyC_List_Fill(PyObject *list, PyObject *value);
|
||||
* see: #111033.
|
||||
* Follow http://www.python.org/dev/peps/pep-0383/
|
||||
*/
|
||||
PyObject *PyC_UnicodeFromBytes(const char *str);
|
||||
[[nodiscard]] PyObject *PyC_UnicodeFromBytes(const char *str);
|
||||
/**
|
||||
* \param size: The length of the string: `strlen(str)`.
|
||||
*/
|
||||
PyObject *PyC_UnicodeFromBytesAndSize(const char *str, Py_ssize_t size);
|
||||
const char *PyC_UnicodeAsBytes(PyObject *py_str, PyObject **r_coerce); /* coerce must be NULL */
|
||||
[[nodiscard]] PyObject *PyC_UnicodeFromBytesAndSize(const char *str, Py_ssize_t size);
|
||||
[[nodiscard]] const char *PyC_UnicodeAsBytes(PyObject *py_str,
|
||||
PyObject **r_coerce); /* coerce must be NULL */
|
||||
/**
|
||||
* String conversion, escape non-unicode chars
|
||||
* \param r_size: The string length (not including the null terminator).
|
||||
@@ -135,7 +144,9 @@ const char *PyC_UnicodeAsBytes(PyObject *py_str, PyObject **r_coerce); /* coerce
|
||||
* as this is an alternative to Python's #PyUnicode_AsUTF8AndSize, follow it's naming.
|
||||
* \param r_coerce: must reference a pointer set to NULL.
|
||||
*/
|
||||
const char *PyC_UnicodeAsBytesAndSize(PyObject *py_str, Py_ssize_t *r_size, PyObject **r_coerce);
|
||||
[[nodiscard]] const char *PyC_UnicodeAsBytesAndSize(PyObject *py_str,
|
||||
Py_ssize_t *r_size,
|
||||
PyObject **r_coerce);
|
||||
|
||||
/**
|
||||
* Notes on using this structure:
|
||||
@@ -175,7 +186,7 @@ int PyC_ParseUnicodeAsBytesAndSize_OrNone(PyObject *o, void *p);
|
||||
* be sure to run #PyC_MainModule_Backup & #PyC_MainModule_Restore if there is
|
||||
* any chance that python is in the call stack.
|
||||
*/
|
||||
PyObject *PyC_DefaultNameSpace(const char *filename) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *PyC_DefaultNameSpace(const char *filename) ATTR_NONNULL(1);
|
||||
void PyC_RunQuicky(const char *filepath, int n, ...) ATTR_NONNULL(1);
|
||||
/**
|
||||
* Import `imports` into `py_dict`.
|
||||
@@ -185,20 +196,20 @@ void PyC_RunQuicky(const char *filepath, int n, ...) ATTR_NONNULL(1);
|
||||
* \return true when all modules import without errors, otherwise return false.
|
||||
* The caller is expected to handle the exception.
|
||||
*/
|
||||
bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[]);
|
||||
[[nodiscard]] bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[]);
|
||||
|
||||
/**
|
||||
* #PyC_MainModule_Restore MUST be called after #PyC_MainModule_Backup.
|
||||
*/
|
||||
PyObject *PyC_MainModule_Backup() ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *PyC_MainModule_Backup();
|
||||
void PyC_MainModule_Restore(PyObject *main_mod);
|
||||
|
||||
bool PyC_IsInterpreterActive();
|
||||
[[nodiscard]] bool PyC_IsInterpreterActive();
|
||||
|
||||
/**
|
||||
* Generic function to avoid depending on RNA.
|
||||
*/
|
||||
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name);
|
||||
[[nodiscard]] void *PyC_RNA_AsPointer(PyObject *value, const char *type_name);
|
||||
|
||||
/* flag / set --- interchange */
|
||||
struct PyC_FlagSet {
|
||||
@@ -206,58 +217,58 @@ struct PyC_FlagSet {
|
||||
const char *identifier;
|
||||
};
|
||||
|
||||
PyObject *PyC_FlagSet_AsString(const PyC_FlagSet *item);
|
||||
int PyC_FlagSet_ValueFromID_int(const PyC_FlagSet *item, const char *identifier, int *r_value);
|
||||
int PyC_FlagSet_ValueFromID(const PyC_FlagSet *item,
|
||||
const char *identifier,
|
||||
int *r_value,
|
||||
const char *error_prefix);
|
||||
int PyC_FlagSet_ToBitfield(const PyC_FlagSet *items,
|
||||
PyObject *value,
|
||||
int *r_value,
|
||||
const char *error_prefix);
|
||||
PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag);
|
||||
[[nodiscard]] PyObject *PyC_FlagSet_AsString(const PyC_FlagSet *item);
|
||||
[[nodiscard]] int PyC_FlagSet_ValueFromID_int(const PyC_FlagSet *item,
|
||||
const char *identifier,
|
||||
int *r_value);
|
||||
[[nodiscard]] int PyC_FlagSet_ValueFromID(const PyC_FlagSet *item,
|
||||
const char *identifier,
|
||||
int *r_value,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int PyC_FlagSet_ToBitfield(const PyC_FlagSet *items,
|
||||
PyObject *value,
|
||||
int *r_value,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag);
|
||||
|
||||
/**
|
||||
* \return success
|
||||
*
|
||||
* \note it is caller's responsibility to acquire & release GIL!
|
||||
*/
|
||||
bool PyC_RunString_AsNumber(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
double *r_value) ATTR_NONNULL(2, 3, 4) ATTR_WARN_UNUSED_RESULT;
|
||||
bool PyC_RunString_AsIntPtr(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
intptr_t *r_value) ATTR_NONNULL(2, 3, 4) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] bool PyC_RunString_AsNumber(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
double *r_value) ATTR_NONNULL(2, 3, 4);
|
||||
[[nodiscard]] bool PyC_RunString_AsIntPtr(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
intptr_t *r_value) ATTR_NONNULL(2, 3, 4);
|
||||
/**
|
||||
* \param r_value_size: The length of the string assigned: `strlen(*r_value)`.
|
||||
*/
|
||||
bool PyC_RunString_AsStringAndSize(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
char **r_value,
|
||||
size_t *r_value_size)
|
||||
ATTR_NONNULL(2, 3, 4, 5) ATTR_WARN_UNUSED_RESULT;
|
||||
bool PyC_RunString_AsString(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
char **r_value) ATTR_NONNULL(2, 3, 4) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] bool PyC_RunString_AsStringAndSize(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
char **r_value,
|
||||
size_t *r_value_size) ATTR_NONNULL(2, 3, 4, 5);
|
||||
[[nodiscard]] bool PyC_RunString_AsString(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
char **r_value) ATTR_NONNULL(2, 3, 4);
|
||||
|
||||
/**
|
||||
* \param r_value_size: The length of the string assigned: `strlen(*r_value)`.
|
||||
*/
|
||||
bool PyC_RunString_AsStringAndSizeOrNone(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
char **r_value,
|
||||
size_t *r_value_size)
|
||||
ATTR_NONNULL(2, 3, 4) ATTR_WARN_UNUSED_RESULT;
|
||||
bool PyC_RunString_AsStringOrNone(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
char **r_value) ATTR_NONNULL(2, 3, 4) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] bool PyC_RunString_AsStringAndSizeOrNone(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
char **r_value,
|
||||
size_t *r_value_size) ATTR_NONNULL(2, 3, 4);
|
||||
[[nodiscard]] bool PyC_RunString_AsStringOrNone(const char **imports,
|
||||
const char *expr,
|
||||
const char *filename,
|
||||
char **r_value) ATTR_NONNULL(2, 3, 4);
|
||||
|
||||
/**
|
||||
* Flush Python's `sys.stdout` and `sys.stderr`. Errors are ignored.
|
||||
@@ -269,7 +280,7 @@ void PyC_StdFilesFlush();
|
||||
*
|
||||
* \see #PyC_Long_AsBool for a similar function to use outside of argument parsing.
|
||||
*/
|
||||
int PyC_ParseBool(PyObject *o, void *p);
|
||||
[[nodiscard]] int PyC_ParseBool(PyObject *o, void *p);
|
||||
|
||||
struct PyC_StringEnumItems {
|
||||
int value;
|
||||
@@ -283,13 +294,14 @@ struct PyC_StringEnum {
|
||||
/**
|
||||
* Use with PyArg_ParseTuple's "O&" formatting.
|
||||
*/
|
||||
int PyC_ParseStringEnum(PyObject *o, void *p);
|
||||
const char *PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items, int value);
|
||||
[[nodiscard]] int PyC_ParseStringEnum(PyObject *o, void *p);
|
||||
[[nodiscard]] const char *PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items,
|
||||
int value);
|
||||
|
||||
/**
|
||||
* Silly function, we don't use arg. just check its compatible with `__deepcopy__`.
|
||||
*/
|
||||
int PyC_CheckArgs_DeepCopy(PyObject *args);
|
||||
[[nodiscard]] int PyC_CheckArgs_DeepCopy(PyObject *args);
|
||||
|
||||
/* Integer parsing (with overflow checks), -1 on error. */
|
||||
/**
|
||||
@@ -317,12 +329,12 @@ int PyC_CheckArgs_DeepCopy(PyObject *args);
|
||||
*
|
||||
* \note Don't use `bool` return type, so -1 can be used as an error value.
|
||||
*/
|
||||
int PyC_Long_AsBool(PyObject *value);
|
||||
int8_t PyC_Long_AsI8(PyObject *value);
|
||||
int16_t PyC_Long_AsI16(PyObject *value);
|
||||
[[nodiscard]] int PyC_Long_AsBool(PyObject *value);
|
||||
[[nodiscard]] int8_t PyC_Long_AsI8(PyObject *value);
|
||||
[[nodiscard]] int16_t PyC_Long_AsI16(PyObject *value);
|
||||
#if 0 /* inline */
|
||||
int32_t PyC_Long_AsI32(PyObject *value);
|
||||
int64_t PyC_Long_AsI64(PyObject *value);
|
||||
[[nodiscard]] int32_t PyC_Long_AsI32(PyObject *value);
|
||||
[[nodiscard]] int64_t PyC_Long_AsI64(PyObject *value);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -331,19 +343,19 @@ int64_t PyC_Long_AsI64(PyObject *value);
|
||||
* `PyLongObject`. This matches Python's signed integer parsing functions which also fall back to
|
||||
* calling #PyNumber_Index.
|
||||
*/
|
||||
uint8_t PyC_Long_AsU8(PyObject *value);
|
||||
uint16_t PyC_Long_AsU16(PyObject *value);
|
||||
uint32_t PyC_Long_AsU32(PyObject *value);
|
||||
[[nodiscard]] uint8_t PyC_Long_AsU8(PyObject *value);
|
||||
[[nodiscard]] uint16_t PyC_Long_AsU16(PyObject *value);
|
||||
[[nodiscard]] uint32_t PyC_Long_AsU32(PyObject *value);
|
||||
/**
|
||||
* #PyLong_AsUnsignedLongLong, unlike #PyLong_AsLongLong, does not fall back to calling
|
||||
* #PyNumber_Index when its argument is not a `PyLongObject` instance. To match parsing signed
|
||||
* integer types with #PyLong_AsLongLong, this function performs the #PyNumber_Index fallback, if
|
||||
* necessary, before calling #PyLong_AsUnsignedLongLong.
|
||||
*/
|
||||
uint64_t PyC_Long_AsU64(PyObject *value);
|
||||
[[nodiscard]] uint64_t PyC_Long_AsU64(PyObject *value);
|
||||
|
||||
/* inline so type signatures match as expected */
|
||||
Py_LOCAL_INLINE(int32_t) PyC_Long_AsI32(PyObject *value)
|
||||
[[nodiscard]] Py_LOCAL_INLINE(int32_t) PyC_Long_AsI32(PyObject *value)
|
||||
{
|
||||
#if PY_VERSION_HEX < 0x030d0000 /* <3.13 */
|
||||
return (int32_t)_PyLong_AsInt(value);
|
||||
@@ -351,40 +363,40 @@ Py_LOCAL_INLINE(int32_t) PyC_Long_AsI32(PyObject *value)
|
||||
return (int32_t)PyLong_AsInt(value);
|
||||
#endif
|
||||
}
|
||||
Py_LOCAL_INLINE(int64_t) PyC_Long_AsI64(PyObject *value)
|
||||
[[nodiscard]] Py_LOCAL_INLINE(int64_t) PyC_Long_AsI64(PyObject *value)
|
||||
{
|
||||
return (int64_t)PyLong_AsLongLong(value);
|
||||
}
|
||||
|
||||
/* utils for format string in `struct` module style syntax */
|
||||
char PyC_StructFmt_type_from_str(const char *typestr);
|
||||
bool PyC_StructFmt_type_is_float_any(char format);
|
||||
bool PyC_StructFmt_type_is_int_any(char format);
|
||||
bool PyC_StructFmt_type_is_byte(char format);
|
||||
bool PyC_StructFmt_type_is_bool(char format);
|
||||
[[nodiscard]] char PyC_StructFmt_type_from_str(const char *typestr);
|
||||
[[nodiscard]] bool PyC_StructFmt_type_is_float_any(char format);
|
||||
[[nodiscard]] bool PyC_StructFmt_type_is_int_any(char format);
|
||||
[[nodiscard]] bool PyC_StructFmt_type_is_byte(char format);
|
||||
[[nodiscard]] bool PyC_StructFmt_type_is_bool(char format);
|
||||
|
||||
/**
|
||||
* Create a `str` from `std::string`, wraps #PyC_UnicodeFromBytesAndSize.
|
||||
*/
|
||||
PyObject *PyC_UnicodeFromStdStr(const std::string &str);
|
||||
[[nodiscard]] PyObject *PyC_UnicodeFromStdStr(const std::string &str);
|
||||
|
||||
inline PyObject *PyC_Tuple_Pack_F32(const blender::Span<float> values)
|
||||
[[nodiscard]] inline PyObject *PyC_Tuple_Pack_F32(const blender::Span<float> values)
|
||||
{
|
||||
return PyC_Tuple_PackArray_F32(values.data(), values.size());
|
||||
}
|
||||
inline PyObject *PyC_Tuple_Pack_F64(const blender::Span<double> values)
|
||||
[[nodiscard]] inline PyObject *PyC_Tuple_Pack_F64(const blender::Span<double> values)
|
||||
{
|
||||
return PyC_Tuple_PackArray_F64(values.data(), values.size());
|
||||
}
|
||||
inline PyObject *PyC_Tuple_Pack_I32(const blender::Span<int> values)
|
||||
[[nodiscard]] inline PyObject *PyC_Tuple_Pack_I32(const blender::Span<int> values)
|
||||
{
|
||||
return PyC_Tuple_PackArray_I32(values.data(), values.size());
|
||||
}
|
||||
inline PyObject *PyC_Tuple_Pack_I32FromBool(const blender::Span<int> values)
|
||||
[[nodiscard]] inline PyObject *PyC_Tuple_Pack_I32FromBool(const blender::Span<int> values)
|
||||
{
|
||||
return PyC_Tuple_PackArray_I32FromBool(values.data(), values.size());
|
||||
}
|
||||
inline PyObject *PyC_Tuple_Pack_Bool(const blender::Span<bool> values)
|
||||
[[nodiscard]] inline PyObject *PyC_Tuple_Pack_Bool(const blender::Span<bool> values)
|
||||
{
|
||||
return PyC_Tuple_PackArray_Bool(values.data(), values.size());
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
extern struct PyC_StringEnumItems bpygpu_primtype_items[];
|
||||
extern struct PyC_StringEnumItems bpygpu_dataformat_items[];
|
||||
|
||||
bool bpygpu_is_init_or_error();
|
||||
[[nodiscard]] bool bpygpu_is_init_or_error();
|
||||
|
||||
#define BPYGPU_IS_INIT_OR_ERROR_OBJ \
|
||||
if (UNLIKELY(!bpygpu_is_init_or_error())) { \
|
||||
|
||||
@@ -14,4 +14,4 @@
|
||||
* However, it is currently of little use. */
|
||||
// #define BPYGPU_USE_GPUOBJ_FREE_METHOD
|
||||
|
||||
PyObject *BPyInit_gpu();
|
||||
[[nodiscard]] PyObject *BPyInit_gpu();
|
||||
|
||||
@@ -32,4 +32,4 @@ struct BPyGPUBatch {
|
||||
#endif
|
||||
};
|
||||
|
||||
PyObject *BPyGPUBatch_CreatePyObject(blender::gpu::Batch *batch) ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *BPyGPUBatch_CreatePyObject(blender::gpu::Batch *batch) ATTR_NONNULL(1);
|
||||
|
||||
@@ -39,7 +39,7 @@ struct BPyGPUBuffer {
|
||||
} buf;
|
||||
};
|
||||
|
||||
size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer);
|
||||
[[nodiscard]] size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer);
|
||||
/**
|
||||
* Create a buffer object
|
||||
*
|
||||
@@ -47,7 +47,7 @@ size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer);
|
||||
* \param buffer: When not NULL holds a contiguous buffer
|
||||
* with the correct format from which the buffer will be initialized
|
||||
*/
|
||||
BPyGPUBuffer *BPyGPU_Buffer_CreatePyObject(int format,
|
||||
const Py_ssize_t *shape,
|
||||
int shape_len,
|
||||
void *buffer);
|
||||
[[nodiscard]] BPyGPUBuffer *BPyGPU_Buffer_CreatePyObject(int format,
|
||||
const Py_ssize_t *shape,
|
||||
int shape_len,
|
||||
void *buffer);
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *bpygpu_capabilities_init();
|
||||
[[nodiscard]] PyObject *bpygpu_capabilities_init();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *bpygpu_compute_init();
|
||||
[[nodiscard]] PyObject *bpygpu_compute_init();
|
||||
|
||||
@@ -23,4 +23,4 @@ struct BPyGPUIndexBuf {
|
||||
blender::gpu::IndexBuf *elem;
|
||||
};
|
||||
|
||||
PyObject *BPyGPUIndexBuf_CreatePyObject(blender::gpu::IndexBuf *elem);
|
||||
[[nodiscard]] PyObject *BPyGPUIndexBuf_CreatePyObject(blender::gpu::IndexBuf *elem);
|
||||
|
||||
@@ -27,5 +27,5 @@ struct BPyGPUFrameBuffer {
|
||||
#endif
|
||||
};
|
||||
|
||||
PyObject *BPyGPUFrameBuffer_CreatePyObject(GPUFrameBuffer *fb, bool shared_reference)
|
||||
[[nodiscard]] PyObject *BPyGPUFrameBuffer_CreatePyObject(GPUFrameBuffer *fb, bool shared_reference)
|
||||
ATTR_NONNULL(1);
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *bpygpu_matrix_init();
|
||||
[[nodiscard]] PyObject *bpygpu_matrix_init();
|
||||
|
||||
@@ -25,4 +25,4 @@ struct BPyGPUOffScreen {
|
||||
GPUViewport *viewport;
|
||||
};
|
||||
|
||||
PyObject *BPyGPUOffScreen_CreatePyObject(GPUOffScreen *ofs) ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *BPyGPUOffScreen_CreatePyObject(GPUOffScreen *ofs) ATTR_NONNULL(1);
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *bpygpu_platform_init();
|
||||
[[nodiscard]] PyObject *bpygpu_platform_init();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *bpygpu_select_init();
|
||||
[[nodiscard]] PyObject *bpygpu_select_init();
|
||||
|
||||
@@ -33,8 +33,8 @@ struct BPyGPUShader {
|
||||
bool is_builtin;
|
||||
};
|
||||
|
||||
PyObject *BPyGPUShader_CreatePyObject(struct GPUShader *shader, bool is_builtin);
|
||||
PyObject *bpygpu_shader_init();
|
||||
[[nodiscard]] PyObject *BPyGPUShader_CreatePyObject(struct GPUShader *shader, bool is_builtin);
|
||||
[[nodiscard]] PyObject *bpygpu_shader_init();
|
||||
|
||||
/* gpu_py_shader_create_info.cc */
|
||||
|
||||
@@ -68,6 +68,6 @@ struct BPyGPUShaderCreateInfo {
|
||||
size_t constants_total_size;
|
||||
};
|
||||
|
||||
PyObject *BPyGPUStageInterfaceInfo_CreatePyObject(GPUStageInterfaceInfo *interface);
|
||||
PyObject *BPyGPUShaderCreateInfo_CreatePyObject(GPUShaderCreateInfo *info);
|
||||
bool bpygpu_shader_is_polyline(GPUShader *shader);
|
||||
[[nodiscard]] PyObject *BPyGPUStageInterfaceInfo_CreatePyObject(GPUStageInterfaceInfo *interface);
|
||||
[[nodiscard]] PyObject *BPyGPUShaderCreateInfo_CreatePyObject(GPUShaderCreateInfo *info);
|
||||
[[nodiscard]] bool bpygpu_shader_is_polyline(GPUShader *shader);
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *bpygpu_state_init();
|
||||
[[nodiscard]] PyObject *bpygpu_state_init();
|
||||
|
||||
@@ -31,7 +31,8 @@ struct BPyGPUTexture {
|
||||
GPUTexture *tex;
|
||||
};
|
||||
|
||||
int bpygpu_ParseTexture(PyObject *o, void *p);
|
||||
PyObject *bpygpu_texture_init();
|
||||
[[nodiscard]] int bpygpu_ParseTexture(PyObject *o, void *p);
|
||||
[[nodiscard]] PyObject *bpygpu_texture_init();
|
||||
|
||||
PyObject *BPyGPUTexture_CreatePyObject(GPUTexture *tex, bool shared_reference) ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *BPyGPUTexture_CreatePyObject(GPUTexture *tex, bool shared_reference)
|
||||
ATTR_NONNULL(1);
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
#include "gpu_py_vertex_buffer.hh" // IWYU pragma: export
|
||||
#include "gpu_py_vertex_format.hh" // IWYU pragma: export
|
||||
|
||||
PyObject *bpygpu_types_init();
|
||||
[[nodiscard]] PyObject *bpygpu_types_init();
|
||||
|
||||
@@ -23,4 +23,4 @@ struct BPyGPUUniformBuf {
|
||||
GPUUniformBuf *ubo;
|
||||
};
|
||||
|
||||
PyObject *BPyGPUUniformBuf_CreatePyObject(GPUUniformBuf *ubo) ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *BPyGPUUniformBuf_CreatePyObject(GPUUniformBuf *ubo) ATTR_NONNULL(1);
|
||||
|
||||
@@ -26,4 +26,4 @@ struct BPyGPUVertBuf {
|
||||
blender::gpu::VertBuf *buf;
|
||||
};
|
||||
|
||||
PyObject *BPyGPUVertBuf_CreatePyObject(blender::gpu::VertBuf *buf) ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *BPyGPUVertBuf_CreatePyObject(blender::gpu::VertBuf *buf) ATTR_NONNULL(1);
|
||||
|
||||
@@ -21,4 +21,4 @@ struct BPyGPUVertFormat {
|
||||
GPUVertFormat fmt;
|
||||
};
|
||||
|
||||
PyObject *BPyGPUVertFormat_CreatePyObject(GPUVertFormat *fmt);
|
||||
[[nodiscard]] PyObject *BPyGPUVertFormat_CreatePyObject(GPUVertFormat *fmt);
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_alembic_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_alembic_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_build_options_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_build_options_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_ffmpeg_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_ffmpeg_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_handlers_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_handlers_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_icons_module();
|
||||
[[nodiscard]] PyObject *BPY_app_icons_module();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_ocio_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_ocio_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_oiio_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_oiio_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_opensubdiv_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_opensubdiv_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_openvdb_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_openvdb_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_sdl_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_sdl_struct();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_timers_module();
|
||||
[[nodiscard]] PyObject *BPY_app_timers_module();
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_translations_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_translations_struct();
|
||||
void BPY_app_translations_end();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_app_usd_struct();
|
||||
[[nodiscard]] PyObject *BPY_app_usd_struct();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* For faster execution we keep a special dictionary for py-drivers, with
|
||||
* the needed modules and aliases.
|
||||
*/
|
||||
int bpy_pydriver_create_dict();
|
||||
[[nodiscard]] int bpy_pydriver_create_dict();
|
||||
/**
|
||||
* For PyDrivers
|
||||
* (drivers using one-line Python expressions to express relationships between targets).
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPyInit_geometry_set_type();
|
||||
[[nodiscard]] PyObject *BPyInit_geometry_set_type();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_msgbus_module();
|
||||
[[nodiscard]] PyObject *BPY_msgbus_module();
|
||||
|
||||
@@ -18,4 +18,4 @@ struct BPy_OperatorBase {
|
||||
PyObject_HEAD /* Required Python macro. */
|
||||
};
|
||||
|
||||
PyObject *BPY_operator_module();
|
||||
[[nodiscard]] PyObject *BPY_operator_module();
|
||||
|
||||
@@ -17,7 +17,7 @@ struct wmOperatorType;
|
||||
*
|
||||
* Accessed via sub-classes of `bpy.types.Macro` using the `define` method.
|
||||
*/
|
||||
PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args);
|
||||
[[nodiscard]] PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args);
|
||||
|
||||
/* Exposed to RNA/WM API. */
|
||||
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPyInit__bpy_path();
|
||||
[[nodiscard]] PyObject *BPyInit__bpy_path();
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
|
||||
struct StructRNA;
|
||||
|
||||
PyObject *BPY_rna_props();
|
||||
[[nodiscard]] PyObject *BPY_rna_props();
|
||||
/**
|
||||
* Run this on exit, clearing all Python callback users and disable the RNA callback,
|
||||
* as it would be called after Python has already finished.
|
||||
*/
|
||||
void BPY_rna_props_clear_all();
|
||||
|
||||
PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw);
|
||||
PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw);
|
||||
StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix);
|
||||
[[nodiscard]] PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw);
|
||||
[[nodiscard]] PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw);
|
||||
[[nodiscard]] StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix);
|
||||
|
||||
struct BPy_PropDeferred {
|
||||
PyObject_HEAD
|
||||
|
||||
@@ -192,31 +192,36 @@ struct BPy_FunctionRNA {
|
||||
FunctionRNA *func;
|
||||
};
|
||||
|
||||
StructRNA *srna_from_self(PyObject *self, const char *error_prefix);
|
||||
StructRNA *pyrna_struct_as_srna(PyObject *self, bool parent, const char *error_prefix);
|
||||
[[nodiscard]] StructRNA *srna_from_self(PyObject *self, const char *error_prefix);
|
||||
[[nodiscard]] StructRNA *pyrna_struct_as_srna(PyObject *self,
|
||||
bool parent,
|
||||
const char *error_prefix);
|
||||
|
||||
void BPY_rna_init();
|
||||
void BPY_rna_exit();
|
||||
PyObject *BPY_rna_module();
|
||||
[[nodiscard]] PyObject *BPY_rna_module();
|
||||
void BPY_update_rna_module();
|
||||
// PyObject *BPY_rna_doc();
|
||||
PyObject *BPY_rna_types();
|
||||
[[nodiscard]] PyObject *BPY_rna_types();
|
||||
void BPY_rna_types_finalize_external_types(PyObject *submodule);
|
||||
|
||||
PyObject *pyrna_struct_CreatePyObject_with_primitive_support(PointerRNA *ptr);
|
||||
PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr);
|
||||
PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop);
|
||||
[[nodiscard]] PyObject *pyrna_struct_CreatePyObject_with_primitive_support(PointerRNA *ptr);
|
||||
[[nodiscard]] PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr);
|
||||
[[nodiscard]] PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop);
|
||||
|
||||
/* Made public for other modules which don't deal closely with RNA. */
|
||||
PyObject *pyrna_id_CreatePyObject(ID *id);
|
||||
bool pyrna_id_FromPyObject(PyObject *obj, ID **id);
|
||||
bool pyrna_id_CheckPyObject(PyObject *obj);
|
||||
[[nodiscard]] PyObject *pyrna_id_CreatePyObject(ID *id);
|
||||
[[nodiscard]] bool pyrna_id_FromPyObject(PyObject *obj, ID **id);
|
||||
[[nodiscard]] bool pyrna_id_CheckPyObject(PyObject *obj);
|
||||
|
||||
/* operators also need this to set args */
|
||||
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, bool all_args, const char *error_prefix);
|
||||
PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);
|
||||
[[nodiscard]] int pyrna_pydict_to_props(PointerRNA *ptr,
|
||||
PyObject *kw,
|
||||
bool all_args,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);
|
||||
|
||||
int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class);
|
||||
[[nodiscard]] int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class);
|
||||
|
||||
const PointerRNA *pyrna_struct_as_ptr(PyObject *py_obj, const StructRNA *srna);
|
||||
const PointerRNA *pyrna_struct_as_ptr_or_null(PyObject *py_obj, const StructRNA *srna);
|
||||
@@ -239,11 +244,11 @@ struct BPy_StructRNA_Parse {
|
||||
*
|
||||
* Use with #PyArg_ParseTuple's `O&` formatting.
|
||||
*/
|
||||
int pyrna_struct_as_ptr_parse(PyObject *o, void *p);
|
||||
[[nodiscard]] int pyrna_struct_as_ptr_parse(PyObject *o, void *p);
|
||||
/**
|
||||
* A version of #pyrna_struct_as_ptr_parse that maps Python's `None` to #PointerRNA_NULL.
|
||||
*/
|
||||
int pyrna_struct_as_ptr_or_null_parse(PyObject *o, void *p);
|
||||
[[nodiscard]] int pyrna_struct_as_ptr_or_null_parse(PyObject *o, void *p);
|
||||
|
||||
void pyrna_struct_type_extend_capi(StructRNA *srna, PyMethodDef *method, PyGetSetDef *getset);
|
||||
|
||||
@@ -251,35 +256,35 @@ void pyrna_alloc_types();
|
||||
|
||||
/* Primitive type conversion. */
|
||||
|
||||
int pyrna_py_to_array(
|
||||
[[nodiscard]] int pyrna_py_to_array(
|
||||
PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix);
|
||||
int pyrna_py_to_array_index(PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
int arraydim,
|
||||
int arrayoffset,
|
||||
int index,
|
||||
PyObject *py,
|
||||
const char *error_prefix);
|
||||
PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index);
|
||||
[[nodiscard]] int pyrna_py_to_array_index(PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
int arraydim,
|
||||
int arrayoffset,
|
||||
int index,
|
||||
PyObject *py,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index);
|
||||
|
||||
PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop);
|
||||
PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self,
|
||||
PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
int index);
|
||||
PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop);
|
||||
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value);
|
||||
[[nodiscard]] PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop);
|
||||
[[nodiscard]] PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self,
|
||||
PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
int index);
|
||||
[[nodiscard]] PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop);
|
||||
[[nodiscard]] int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value);
|
||||
|
||||
bool pyrna_write_check();
|
||||
[[nodiscard]] bool pyrna_write_check();
|
||||
void pyrna_write_set(bool val);
|
||||
|
||||
void pyrna_invalidate(BPy_DummyPointerRNA *self);
|
||||
|
||||
int pyrna_struct_validity_check_only(const BPy_StructRNA *pysrna);
|
||||
[[nodiscard]] int pyrna_struct_validity_check_only(const BPy_StructRNA *pysrna);
|
||||
void pyrna_struct_validity_exception_only(const BPy_StructRNA *pysrna);
|
||||
int pyrna_struct_validity_check(const BPy_StructRNA *pysrna);
|
||||
[[nodiscard]] int pyrna_struct_validity_check(const BPy_StructRNA *pysrna);
|
||||
|
||||
int pyrna_prop_validity_check(const BPy_PropertyRNA *self);
|
||||
[[nodiscard]] int pyrna_prop_validity_check(const BPy_PropertyRNA *self);
|
||||
|
||||
/* bpy.utils.(un)register_class */
|
||||
extern PyMethodDef meth_bpy_register_class;
|
||||
|
||||
@@ -17,7 +17,11 @@ extern char pyrna_struct_keyframe_delete_doc[];
|
||||
extern char pyrna_struct_driver_add_doc[];
|
||||
extern char pyrna_struct_driver_remove_doc[];
|
||||
|
||||
PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw);
|
||||
PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw);
|
||||
PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args);
|
||||
PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args);
|
||||
[[nodiscard]] PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self,
|
||||
PyObject *args,
|
||||
PyObject *kw);
|
||||
[[nodiscard]] PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self,
|
||||
PyObject *args,
|
||||
PyObject *kw);
|
||||
[[nodiscard]] PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args);
|
||||
[[nodiscard]] PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args);
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
struct BPy_StructRNA;
|
||||
|
||||
#if 0
|
||||
PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args);
|
||||
PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args);
|
||||
[[nodiscard]] PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args);
|
||||
[[nodiscard]] PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args);
|
||||
#endif
|
||||
|
||||
PyObject *pyrna_callback_classmethod_add(PyObject *self, PyObject *args);
|
||||
PyObject *pyrna_callback_classmethod_remove(PyObject *self, PyObject *args);
|
||||
[[nodiscard]] PyObject *pyrna_callback_classmethod_add(PyObject *self, PyObject *args);
|
||||
[[nodiscard]] PyObject *pyrna_callback_classmethod_remove(PyObject *self, PyObject *args);
|
||||
|
||||
@@ -19,10 +19,12 @@ struct PathResolvedRNA;
|
||||
/**
|
||||
* A version of #driver_get_variable_value which returns a #PyObject.
|
||||
*/
|
||||
PyObject *pyrna_driver_get_variable_value(const AnimationEvalContext *anim_eval_context,
|
||||
ChannelDriver *driver,
|
||||
DriverVar *dvar,
|
||||
DriverTarget *dtar);
|
||||
[[nodiscard]] PyObject *pyrna_driver_get_variable_value(
|
||||
const AnimationEvalContext *anim_eval_context,
|
||||
ChannelDriver *driver,
|
||||
DriverVar *dvar,
|
||||
DriverTarget *dtar);
|
||||
|
||||
PyObject *pyrna_driver_self_from_anim_rna(PathResolvedRNA *anim_rna);
|
||||
bool pyrna_driver_is_equal_anim_rna(const PathResolvedRNA *anim_rna, const PyObject *py_anim_rna);
|
||||
[[nodiscard]] PyObject *pyrna_driver_self_from_anim_rna(PathResolvedRNA *anim_rna);
|
||||
[[nodiscard]] bool pyrna_driver_is_equal_anim_rna(const PathResolvedRNA *anim_rna,
|
||||
const PyObject *py_anim_rna);
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
bool python_script_error_jump(
|
||||
[[nodiscard]] bool python_script_error_jump(
|
||||
const char *filepath, int *r_lineno, int *r_offset, int *r_lineno_end, int *r_offset_end);
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_utils_previews_module();
|
||||
[[nodiscard]] PyObject *BPY_utils_previews_module();
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject *BPY_utils_units();
|
||||
[[nodiscard]] PyObject *BPY_utils_units();
|
||||
|
||||
@@ -22,7 +22,7 @@ extern char BaseMathObject_is_frozen_doc[];
|
||||
extern char BaseMathObject_is_valid_doc[];
|
||||
extern char BaseMathObject_owner_doc[];
|
||||
|
||||
PyObject *_BaseMathObject_new_impl(PyTypeObject *root_type, PyTypeObject *base_type);
|
||||
[[nodiscard]] PyObject *_BaseMathObject_new_impl(PyTypeObject *root_type, PyTypeObject *base_type);
|
||||
|
||||
#define BASE_MATH_NEW(struct_name, root_type, base_type) \
|
||||
((struct_name *)_BaseMathObject_new_impl(&root_type, base_type))
|
||||
@@ -71,13 +71,13 @@ struct BaseMathObject {
|
||||
/* avoid checking all types */
|
||||
#define BaseMathObject_CheckExact(v) (Py_TYPE(v)->tp_dealloc == (destructor)BaseMathObject_dealloc)
|
||||
|
||||
PyObject *BaseMathObject_owner_get(BaseMathObject *self, void *);
|
||||
PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void *);
|
||||
PyObject *BaseMathObject_is_frozen_get(BaseMathObject *self, void *);
|
||||
PyObject *BaseMathObject_is_valid_get(BaseMathObject *self, void *);
|
||||
[[nodiscard]] PyObject *BaseMathObject_owner_get(BaseMathObject *self, void *);
|
||||
[[nodiscard]] PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void *);
|
||||
[[nodiscard]] PyObject *BaseMathObject_is_frozen_get(BaseMathObject *self, void *);
|
||||
[[nodiscard]] PyObject *BaseMathObject_is_valid_get(BaseMathObject *self, void *);
|
||||
|
||||
extern char BaseMathObject_freeze_doc[];
|
||||
PyObject *BaseMathObject_freeze(BaseMathObject *self);
|
||||
[[nodiscard]] PyObject *BaseMathObject_freeze(BaseMathObject *self);
|
||||
|
||||
int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg);
|
||||
int BaseMathObject_clear(BaseMathObject *self);
|
||||
@@ -86,8 +86,11 @@ int BaseMathObject_is_gc(BaseMathObject *self);
|
||||
|
||||
PyMODINIT_FUNC PyInit_mathutils();
|
||||
|
||||
int EXPP_FloatsAreEqual(float af, float bf, int maxDiff);
|
||||
int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int floatSteps);
|
||||
[[nodiscard]] int EXPP_FloatsAreEqual(float af, float bf, int maxDiff);
|
||||
[[nodiscard]] int EXPP_VectorsAreEqual(const float *vecA,
|
||||
const float *vecB,
|
||||
int size,
|
||||
int floatSteps);
|
||||
|
||||
/** Checks the user is still valid. */
|
||||
using BaseMathCheckFunc = int (*)(BaseMathObject *);
|
||||
@@ -108,13 +111,13 @@ struct Mathutils_Callback {
|
||||
BaseMathSetIndexFunc set_index;
|
||||
};
|
||||
|
||||
unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb);
|
||||
[[nodiscard]] unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb);
|
||||
|
||||
int _BaseMathObject_CheckCallback(BaseMathObject *self);
|
||||
int _BaseMathObject_ReadCallback(BaseMathObject *self);
|
||||
int _BaseMathObject_WriteCallback(BaseMathObject *self);
|
||||
int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index);
|
||||
int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index);
|
||||
[[nodiscard]] int _BaseMathObject_CheckCallback(BaseMathObject *self);
|
||||
[[nodiscard]] int _BaseMathObject_ReadCallback(BaseMathObject *self);
|
||||
[[nodiscard]] int _BaseMathObject_WriteCallback(BaseMathObject *self);
|
||||
[[nodiscard]] int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index);
|
||||
[[nodiscard]] int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index);
|
||||
|
||||
void _BaseMathObject_RaiseFrozenExc(const BaseMathObject *self);
|
||||
void _BaseMathObject_RaiseNotFrozenExc(const BaseMathObject *self);
|
||||
@@ -157,50 +160,52 @@ void _BaseMathObject_RaiseNotFrozenExc(const BaseMathObject *self);
|
||||
* Helper function.
|
||||
* \return length of `value`, -1 on error.
|
||||
*/
|
||||
int mathutils_array_parse(
|
||||
[[nodiscard]] int mathutils_array_parse(
|
||||
float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix);
|
||||
/**
|
||||
* \return -1 is returned on error and no allocation is made.
|
||||
*/
|
||||
int mathutils_array_parse_alloc(float **array,
|
||||
int array_num_min,
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int mathutils_array_parse_alloc(float **array,
|
||||
int array_num_min,
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
/**
|
||||
* Parse an array of vectors.
|
||||
*/
|
||||
int mathutils_array_parse_alloc_v(float **array,
|
||||
int array_dim,
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int mathutils_array_parse_alloc_v(float **array,
|
||||
int array_dim,
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
/**
|
||||
* Parse an sequence array_dim integers into array.
|
||||
*/
|
||||
int mathutils_int_array_parse(int *array,
|
||||
int array_dim,
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int mathutils_int_array_parse(int *array,
|
||||
int array_dim,
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
/**
|
||||
* Parse sequence of array_dim sequences of integers and return allocated result.
|
||||
*/
|
||||
int mathutils_array_parse_alloc_vi(int **array,
|
||||
int array_dim,
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
[[nodiscard]] int mathutils_array_parse_alloc_vi(int **array,
|
||||
int array_dim,
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
/**
|
||||
* Parse sequence of variable-length sequences of integers and fill r_data with their values.
|
||||
*/
|
||||
bool mathutils_array_parse_alloc_viseq(PyObject *value,
|
||||
const char *error_prefix,
|
||||
blender::Array<blender::Vector<int>> &r_data);
|
||||
int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error_prefix);
|
||||
[[nodiscard]] bool mathutils_array_parse_alloc_viseq(PyObject *value,
|
||||
const char *error_prefix,
|
||||
blender::Array<blender::Vector<int>> &r_data);
|
||||
[[nodiscard]] int mathutils_any_to_rotmat(float rmat[3][3],
|
||||
PyObject *value,
|
||||
const char *error_prefix);
|
||||
|
||||
/**
|
||||
* helper function that returns a Python `__hash__`.
|
||||
*
|
||||
* \note consistent with the equivalent tuple of floats (CPython's `tuplehash`)
|
||||
*/
|
||||
Py_hash_t mathutils_array_hash(const float *array, size_t array_len);
|
||||
[[nodiscard]] Py_hash_t mathutils_array_hash(const float *array, size_t array_len);
|
||||
|
||||
/* zero remaining unused elements of the array */
|
||||
#define MU_ARRAY_ZERO (1u << 30)
|
||||
@@ -221,10 +226,12 @@ Py_hash_t mathutils_array_hash(const float *array, size_t array_len);
|
||||
* \note Vector/Matrix multiplication is not commutative.
|
||||
* \note Assume read callbacks have been done first.
|
||||
*/
|
||||
int column_vector_multiplication(float r_vec[4], VectorObject *vec, MatrixObject *mat);
|
||||
[[nodiscard]] int column_vector_multiplication(float r_vec[4],
|
||||
VectorObject *vec,
|
||||
MatrixObject *mat);
|
||||
|
||||
#ifndef MATH_STANDALONE
|
||||
/* dynstr as python string utility functions */
|
||||
/* dynstr as python string utility functions, frees 'ds'! */
|
||||
PyObject *mathutils_dynstr_to_py(struct DynStr *ds);
|
||||
[[nodiscard]] PyObject *mathutils_dynstr_to_py(struct DynStr *ds);
|
||||
#endif
|
||||
|
||||
@@ -27,10 +27,9 @@ struct ColorObject {
|
||||
|
||||
/* Prototypes. */
|
||||
|
||||
PyObject *Color_CreatePyObject(const float col[3],
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
|
||||
PyObject *Color_CreatePyObject_wrap(float col[3], PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
|
||||
[[nodiscard]] PyObject *Color_CreatePyObject(const float col[3], PyTypeObject *base_type);
|
||||
[[nodiscard]] PyObject *Color_CreatePyObject_wrap(float col[3], PyTypeObject *base_type)
|
||||
ATTR_NONNULL(1);
|
||||
PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype);
|
||||
|
||||
@@ -28,16 +28,15 @@ struct EulerObject {
|
||||
|
||||
/* prototypes */
|
||||
|
||||
PyObject *Euler_CreatePyObject(const float eul[3],
|
||||
short order,
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
|
||||
PyObject *Euler_CreatePyObject_wrap(float eul[3],
|
||||
short order,
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
|
||||
ATTR_NONNULL(1);
|
||||
PyObject *Euler_CreatePyObject_cb(PyObject *cb_user,
|
||||
short order,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *Euler_CreatePyObject(const float eul[3],
|
||||
short order,
|
||||
PyTypeObject *base_type);
|
||||
[[nodiscard]] PyObject *Euler_CreatePyObject_wrap(float eul[3],
|
||||
short order,
|
||||
PyTypeObject *base_type) ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *Euler_CreatePyObject_cb(PyObject *cb_user,
|
||||
short order,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype);
|
||||
|
||||
short euler_order_from_string(const char *str, const char *error_prefix);
|
||||
[[nodiscard]] short euler_order_from_string(const char *str, const char *error_prefix);
|
||||
|
||||
@@ -53,35 +53,34 @@ struct MatrixObject {
|
||||
|
||||
/* Prototypes. */
|
||||
|
||||
PyObject *Matrix_CreatePyObject(const float *mat,
|
||||
ushort col_num,
|
||||
ushort row_num,
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
|
||||
PyObject *Matrix_CreatePyObject_wrap(float *mat,
|
||||
ushort col_num,
|
||||
ushort row_num,
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
|
||||
ATTR_NONNULL(1);
|
||||
PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user,
|
||||
unsigned short col_num,
|
||||
unsigned short row_num,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *Matrix_CreatePyObject(const float *mat,
|
||||
ushort col_num,
|
||||
ushort row_num,
|
||||
PyTypeObject *base_type);
|
||||
[[nodiscard]] PyObject *Matrix_CreatePyObject_wrap(float *mat,
|
||||
ushort col_num,
|
||||
ushort row_num,
|
||||
PyTypeObject *base_type) ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user,
|
||||
unsigned short col_num,
|
||||
unsigned short row_num,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype);
|
||||
|
||||
/**
|
||||
* \param mat: Initialized matrix value to use in-place, allocated with #PyMem_Malloc
|
||||
*/
|
||||
PyObject *Matrix_CreatePyObject_alloc(float *mat,
|
||||
ushort col_num,
|
||||
ushort row_num,
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *Matrix_CreatePyObject_alloc(float *mat,
|
||||
ushort col_num,
|
||||
ushort row_num,
|
||||
PyTypeObject *base_type);
|
||||
|
||||
/* PyArg_ParseTuple's "O&" formatting helpers. */
|
||||
|
||||
int Matrix_ParseAny(PyObject *o, void *p);
|
||||
int Matrix_Parse2x2(PyObject *o, void *p);
|
||||
int Matrix_Parse3x3(PyObject *o, void *p);
|
||||
int Matrix_Parse4x4(PyObject *o, void *p);
|
||||
[[nodiscard]] int Matrix_ParseAny(PyObject *o, void *p);
|
||||
[[nodiscard]] int Matrix_Parse2x2(PyObject *o, void *p);
|
||||
[[nodiscard]] int Matrix_Parse3x3(PyObject *o, void *p);
|
||||
[[nodiscard]] int Matrix_Parse4x4(PyObject *o, void *p);
|
||||
|
||||
extern unsigned char mathutils_matrix_row_cb_index; /* default */
|
||||
extern unsigned char mathutils_matrix_col_cb_index;
|
||||
|
||||
@@ -28,11 +28,9 @@ struct QuaternionObject {
|
||||
|
||||
/* Prototypes. */
|
||||
|
||||
PyObject *Quaternion_CreatePyObject(const float quat[4],
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
|
||||
PyObject *Quaternion_CreatePyObject_wrap(float quat[4],
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
|
||||
[[nodiscard]] PyObject *Quaternion_CreatePyObject(const float quat[4], PyTypeObject *base_type);
|
||||
[[nodiscard]] PyObject *Quaternion_CreatePyObject_wrap(float quat[4], PyTypeObject *base_type)
|
||||
ATTR_NONNULL(1);
|
||||
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype);
|
||||
|
||||
@@ -26,30 +26,28 @@ struct VectorObject {
|
||||
|
||||
/* Prototypes. */
|
||||
|
||||
PyObject *Vector_CreatePyObject(const float *vec,
|
||||
int vec_num,
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *Vector_CreatePyObject(const float *vec,
|
||||
int vec_num,
|
||||
PyTypeObject *base_type);
|
||||
/**
|
||||
* Create a vector that wraps existing memory.
|
||||
*
|
||||
* \param vec: Use this vector in-place.
|
||||
*/
|
||||
PyObject *Vector_CreatePyObject_wrap(float *vec,
|
||||
int vec_num,
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
|
||||
ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *Vector_CreatePyObject_wrap(float *vec,
|
||||
int vec_num,
|
||||
PyTypeObject *base_type) ATTR_NONNULL(1);
|
||||
/**
|
||||
* Create a vector where the value is defined by registered callbacks,
|
||||
* see: #Mathutils_RegisterCallback
|
||||
*/
|
||||
PyObject *Vector_CreatePyObject_cb(PyObject *cb_user,
|
||||
int vec_num,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
|
||||
[[nodiscard]] PyObject *Vector_CreatePyObject_cb(PyObject *cb_user,
|
||||
int vec_num,
|
||||
unsigned char cb_type,
|
||||
unsigned char cb_subtype);
|
||||
/**
|
||||
* \param vec: Initialized vector value to use in-place, allocated with #PyMem_Malloc
|
||||
*/
|
||||
PyObject *Vector_CreatePyObject_alloc(float *vec,
|
||||
int vec_num,
|
||||
PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
|
||||
ATTR_NONNULL(1);
|
||||
[[nodiscard]] PyObject *Vector_CreatePyObject_alloc(float *vec,
|
||||
int vec_num,
|
||||
PyTypeObject *base_type) ATTR_NONNULL(1);
|
||||
|
||||
Reference in New Issue
Block a user