diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-03-06 08:45:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-03-06 09:05:18 +0300 |
commit | 73ef27f15611ccb254816e199f8c74103b3d5172 (patch) | |
tree | b16b99d872cbfc7fe643a50b2a0122b7ac9fcf09 /source/blender/python/intern/bpy_rna_anim.c | |
parent | e97aed1e73e72174e08dc1ea152725007647a6cc (diff) |
Cleanup: keyframing return arguments
- Use 'int' for counters instead of short.
- Use 'bool' instead of a counter when only a change is being detected.
- Use typed enum for keying set flags.
- Include in comments when a negate error code may be returned.
Diffstat (limited to 'source/blender/python/intern/bpy_rna_anim.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna_anim.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 0533e8cc499..d41ec59188c 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -338,7 +338,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb * not have any effect. */ ReportList reports; - short result = 0; + bool result = false; PointerRNA ptr = self->ptr; PropertyRNA *prop = NULL; @@ -372,13 +372,22 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb else { ID *id = self->ptr.owner_id; ReportList reports; - short result; + bool result; BKE_reports_init(&reports, RPT_STORE); BLI_assert(BKE_id_is_in_global_main(id)); - result = insert_keyframe( - G_MAIN, &reports, id, NULL, group_name, path_full, index, cfra, keytype, NULL, options); + result = (insert_keyframe(G_MAIN, + &reports, + id, + NULL, + group_name, + path_full, + index, + cfra, + keytype, + NULL, + options) != 0); MEM_freeN((void *)path_full); if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) { @@ -436,7 +445,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb * not have any effect. */ ReportList reports; - short result = 0; + bool result = false; PointerRNA ptr = self->ptr; PropertyRNA *prop = NULL; @@ -496,12 +505,13 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb return PyBool_FromLong(result); } else { - short result; + bool result; ReportList reports; BKE_reports_init(&reports, RPT_STORE); - result = delete_keyframe(G.main, &reports, self->ptr.owner_id, NULL, path_full, index, cfra); + result = (delete_keyframe( + G.main, &reports, self->ptr.owner_id, NULL, path_full, index, cfra) != 0); MEM_freeN((void *)path_full); if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) { |