How does ImageTexture.set_data() work?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fuderiki

How does ImageTexture.set_data() work?
Is it copying the data in a texture?
Or is it pointing towards the PoolByteArray used by the image as data?
If I modify the PoolByteArray, will it change the displayed texture??

AFAIK, ImageTexture.set_data() passes by reference (as seen in the original code here). So if you manipulate the original PoolByteArray you would probably also change the image. BTW, to get the image data’s formatting, look at the ImageTexture.get_format() function, as well as the FORMAT_* constants.

Ertain | 2019-05-25 14:48