Editing Grease Pencil Points in View Space

Hello! I’d like to get the coordinates of my selected Grease Pencil points and move them in relation to the 2D Camera View Plane coordinates (as you do when you use the View Transform Orientation).

View Orientation

For example, if the scene’s render resolution is square and the camera view is 1080x1080, the top left corner of the Camera View Plane would be 0,0 and the bottom right corner would be 1080,1080, making this line’s top point 494,118 and the bottom point 494,954
Grease Pencil Points

I found this post, https://blender.stackexchange.com/questions/6377/coordinates-of-corners-of-camera-view-border, which shows how to get the camera’s view relative to the area. How could I (& should I) take a similar approach, which seems to be:

Get the camera frame in pixels

  • getting the View Frame’s 4 points for the cameras frame
  • convert to world space
  • convert to pixel space with location_3d_to_region_2d

Get the Grease Pencil points in pixels:

  • convert to world space based on Grease Pencil object’s matrix?
  • convert to pixel space with location_3d_to_region_2d?
  • move the points in pixels based on the Camera View coordinates?
  • convert back to the Grease Pencil’s object space?

Any guidance on how to go about this would be most appreciated. Thank you!

Have you seen this:

1 Like