Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-10-01 13:19:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-10-01 13:20:53 +0300
commitba798e0412cdcb5e6a10464ced105c8d6708c4b7 (patch)
tree6c2b781f07ead1f06342616187128b689fb7bf0f /source/blender/editors/space_image/image_edit.c
parent3370af2dc1ced49099a4a7e6e15f3ffd009d91ca (diff)
Image/Clip Space: Add view center to cursor operators
D5932 by @a.monti with edits
Diffstat (limited to 'source/blender/editors/space_image/image_edit.c')
-rw-r--r--source/blender/editors/space_image/image_edit.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index ccd0a2bfd79..ec2b1cc7fbe 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -301,6 +301,18 @@ void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, const int mval[2], float
co[1] = ((mval[1] - sy) / zoomy) / height;
}
+void ED_image_view_center_to_point(SpaceImage *sima, float x, float y)
+{
+ int width, height;
+ float aspx, aspy;
+
+ ED_space_image_get_size(sima, &width, &height);
+ ED_space_image_get_aspect(sima, &aspx, &aspy);
+
+ sima->xof = (x - 0.5f) * width * aspx;
+ sima->yof = (y - 0.5f) * height * aspy;
+}
+
void ED_image_point_pos(SpaceImage *sima, ARegion *ar, float x, float y, float *xr, float *yr)
{
int sx, sy, width, height;
@@ -476,3 +488,9 @@ bool ED_space_image_maskedit_mask_poll(bContext *C)
return false;
}
+
+bool ED_space_image_cursor_poll(bContext *C)
+{
+ return ED_operator_uvedit_space_image(C) || ED_space_image_maskedit_poll(C) ||
+ ED_space_image_paint_curve(C);
+}