Godot Version
Godot v4.2.1.stable
Question
I am trying to retrieve image data from a NoiseTexture2D. I seem to be able to get an image resource, but as soon as I try to get the associated data via Image.get_data(), it only returns null
I am aware, that image generation is run on a separate thread, so I tried using await texture.changed to see if that helps, but the result is either the same.
The relevant code snippets:
@onready var _map_image: Sprite2D = $"MapBackground/MapLayer/MapImage":
get:
return _map_image
var _map_noise_image: Image
func _ready() -> void:
await _map_image.texture.changed # does not solve the problem
_map_noise_image = _map_image.texture.noise.get_image(
_map_image.texture.get_width(), _map_image.texture.get_height(), false, true)
get_heightmap_data()
func get_heightmap_data():
# returns null on non null image
var heightmap_data = _map_noise_image.get_data()
return heightmap_data
I’d be grateful for any pointers as to where I might be going wrong here