diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-02-05 02:15:45 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-02-05 02:16:36 +0300 |
commit | ec9f237a9ef01e5966228e0789eeecc419021f56 (patch) | |
tree | 7ca30da182c2a650cefb6875e8976a04a07d44cc /source/blender/editors/space_view3d/view3d_navigate_dolly.c | |
parent | f79c8e25f17461bc6e8ac6deb0f0d55fc101e13c (diff) |
Cleanup: merge functions with similar usage
`viewops_data_alloc` allocates and stores some pointers in
`ViewOpsData` while `viewops_data_create` reuses already stored
pointers and also stores others in `ViewOpsData`.
The similar names and usages can confuse and in this case it also
creates a dependency on the order in which these functions are called.
Merging these functions simplifies usage and deduplicates code.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_navigate_dolly.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_navigate_dolly.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/view3d_navigate_dolly.c b/source/blender/editors/space_view3d/view3d_navigate_dolly.c index 7273ec7f7fa..07099ea221e 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_dolly.c +++ b/source/blender/editors/space_view3d/view3d_navigate_dolly.c @@ -239,8 +239,14 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED; } + const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init"); + /* makes op->customdata */ - viewops_data_alloc(C, op); + viewops_data_create(C, + op, + event, + (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) | + (use_cursor_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0)); vod = op->customdata; ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region); @@ -259,14 +265,6 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event) ED_region_tag_redraw(vod->region); } - const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init"); - - viewops_data_create(C, - op, - event, - (viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) | - (use_cursor_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0)); - /* if one or the other zoom position aren't set, set from event */ if (!RNA_struct_property_is_set(op->ptr, "mx") || !RNA_struct_property_is_set(op->ptr, "my")) { RNA_int_set(op->ptr, "mx", event->xy[0]); |