I am having some trouble cropping images around a node (colo[u]rRect) for a PBR material painting tool (just trying to implement drawing on a flat canvas right now).
I have looked at the gdpaint demo, tested it, and it worked, so I used similar code, however it gave me a segment of the colo[u]rRect, as well as a grey strip (the bg) on the side/top, depending on the scale of the window.
my code is:
onready var IMAGE_SIZE = Vector2(500, 500) # the size of the colourRect
var img = get_viewport().get_texture().get_data()
img = img.get_rect(Rect2(canvas.get_global_rect().position, IMAGE_SIZE))
All I need to work out is how to crop the screenshot to a ColourRect.