godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.96k stars 21.15k forks source link

Removing noise from noise texture doesn't update it to empty in the editor #37777

Open KoBeWi opened 4 years ago

KoBeWi commented 4 years ago

Godot version: 3.2.1

Issue description: 3AgxhjJ7dy It shows correctly after running game or reloading scene, so it's minor thing.

Sslaxx commented 4 years ago

If you reload the project in the editor, does it still show as empty?

KoBeWi commented 4 years ago

Yes.

Schmowser commented 4 years ago

I looked a bit into it. So, set_noise applies the noise filter and detaches it respectively:

https://github.com/godotengine/godot/blob/d817be92c2d9edce842ab37ab13117743f8a3bee/modules/opensimplex/noise_texture.cpp#L187-L198

In _update_texture, we get the image from generate_texture and set the texture data afterwards.

https://github.com/godotengine/godot/blob/d817be92c2d9edce842ab37ab13117743f8a3bee/modules/opensimplex/noise_texture.cpp#L181-L182

In _generate_texture, we have the following logic executed for the initial texture and when we clear the Noise from the texture:

https://github.com/godotengine/godot/blob/d817be92c2d9edce842ab37ab13117743f8a3bee/modules/opensimplex/noise_texture.cpp#L143-L145

First, I thought that this "empty" image should be different but it works for initializing the 2D node. In _set_texture_data, we call emit_changed and I wonder if we have to do something to the newly "empty" image such that the change is recognized. Does anyone know where this emit signal is listened to such that the viewport updates the image?

KoBeWi commented 2 weeks ago

Still valid in 4.4 b3bcb2d