Commit: c7f106cbe22e0cf000a35dda7adff7d596843cc5
Author: Campbell Barton
Date:   Tue Aug 29 19:36:06 2017 +1000
Branches: master
https://developer.blender.org/rBc7f106cbe22e0cf000a35dda7adff7d596843cc5

View2D: function to get view to region matrix

===================================================================

M       source/blender/editors/include/UI_view2d.h
M       source/blender/editors/interface/view2d.c

===================================================================

diff --git a/source/blender/editors/include/UI_view2d.h 
b/source/blender/editors/include/UI_view2d.h
index 4caacb65f5f..4c0493a881c 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -203,6 +203,7 @@ bool  UI_view2d_view_to_region_clip(struct View2D *v2d, 
float x, float y, int *r
 
 void  UI_view2d_view_to_region(struct View2D *v2d, float x, float y, int 
*r_region_x, int *r_region_y) ATTR_NONNULL();
 void  UI_view2d_view_to_region_fl(struct View2D *v2d, float x, float y, float 
*r_region_x, float *r_region_y) ATTR_NONNULL();
+void  UI_view2d_view_to_region_m4(struct View2D *v2d, float matrix[4][4]) 
ATTR_NONNULL();
 void  UI_view2d_view_to_region_rcti(struct View2D *v2d, const struct rctf 
*rect_src, struct rcti *rect_dst) ATTR_NONNULL();
 bool  UI_view2d_view_to_region_rcti_clip(struct View2D *v2d, const struct rctf 
*rect_src, struct rcti *rect_dst) ATTR_NONNULL();
 
diff --git a/source/blender/editors/interface/view2d.c 
b/source/blender/editors/interface/view2d.c
index c78d97ef86f..c704c4ae126 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -2138,6 +2138,14 @@ void UI_view2d_view_to_region_rcti(View2D *v2d, const 
rctf *rect_src, rcti *rect
        clamp_rctf_to_rcti(rect_dst, &rect_tmp);
 }
 
+void UI_view2d_view_to_region_m4(View2D *v2d, float matrix[4][4])
+{
+       rctf mask;
+       unit_m4(matrix);
+       BLI_rctf_rcti_copy(&mask, &v2d->mask);
+       BLI_rctf_transform_calc_m4_pivot_min(&v2d->cur, &mask, matrix);
+}
+
 bool UI_view2d_view_to_region_rcti_clip(View2D *v2d, const rctf *rect_src, 
rcti *rect_dst)
 {
        const float cur_size[2]  = {BLI_rctf_size_x(&v2d->cur),  
BLI_rctf_size_y(&v2d->cur)};

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to