diff options
Diffstat (limited to 'source/blender/editors/transform/transform_convert.c')
-rw-r--r-- | source/blender/editors/transform/transform_convert.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index 027ae04795a..78e785e0e71 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -69,6 +69,8 @@ #include "ED_clip.h" #include "ED_mask.h" +#include "UI_view2d.h" + #include "WM_api.h" /* for WM_event_add_notifier to deal with stabilization nodes */ #include "WM_types.h" @@ -787,6 +789,19 @@ void clipUVData(TransInfo *t) /* ********************* ANIMATION EDITORS (GENERAL) ************************* */ +/* In modal, `t->center_global` may not have been inited yet. */ +void transform_convert_center_global_v2(TransInfo *t, float r_center[2]) +{ + /* In modal, `t->center2d` may not have been inited yet. */ + if (t->flag & T_MODAL) { + UI_view2d_region_to_view( + (View2D *)t->view, t->mouse.imval[0], t->mouse.imval[1], &r_center[0], &r_center[1]); + } + else { + copy_v2_v2(r_center, t->center_global); + } +} + /* This function tests if a point is on the "mouse" side of the cursor/frame-marking */ bool FrameOnMouseSide(char side, float frame, float cframe) { |