diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-10-26 18:22:11 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-10-26 19:35:13 +0300 |
commit | 2d5c9e0bafcca0624ceec324b6c3ca384a748d36 (patch) | |
tree | f7af13b8900ff9a917a50208f26106b20c0d4db5 /source/blender/editors | |
parent | 5acbc01d0dd6e2453bafc637e6ac995848bf205e (diff) |
Cleanup: 3D View context, early returns for clearer flow
Refactor `view3d_context()` to use early `return`s instead of a bundle of
`if`/`else if`/`else`, some of which had `return`s and some not.
No functional changes.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index c2618a340d9..2b0e302a0d1 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1700,8 +1700,9 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes if (CTX_data_dir(member)) { CTX_data_dir_set(result, view3d_context_dir); + return CTX_RESULT_OK; } - else if (CTX_data_equals(member, "active_object")) { + if (CTX_data_equals(member, "active_object")) { /* In most cases the active object is the `view_layer->basact->object`. * For the 3D view however it can be NULL when hidden. * @@ -1727,11 +1728,8 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes return CTX_RESULT_OK; } - else { - return CTX_RESULT_MEMBER_NOT_FOUND; - } - return CTX_RESULT_OK; + return CTX_RESULT_MEMBER_NOT_FOUND; } static void view3d_id_remap(ScrArea *area, SpaceLink *slink, ID *old_id, ID *new_id) |