Skip to content

Commit

Permalink
Merge pull request #54671 from Chaosus/fix_noise_tex_doc
Browse files Browse the repository at this point in the history
Fix example in `NoiseTexture` doc
  • Loading branch information
akien-mga authored Nov 6, 2021
2 parents 67b5577 + 9b0dddd commit bd31af3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/opensimplex/doc_classes/NoiseTexture.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
NoiseTexture can also generate normal map textures.
The class uses [Thread]s to generate the texture data internally, so [method Texture2D.get_image] may return [code]null[/code] if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the image and the generated byte data:
[codeblock]
var texture = preload("res://noise.tres")
yield(texture, "changed")
var texture = NoiseTexture.new()
texture.noise = OpenSimplexNoise.new()
await texture.changed
var image = texture.get_image()
var data = image.get_data()
[/codeblock]
Expand Down

0 comments on commit bd31af3

Please sign in to comment.