Fix example in NoiseTexture
doc
This commit is contained in:
parent
4651b2ae5c
commit
9b0dddd8e5
|
@ -8,8 +8,9 @@
|
||||||
NoiseTexture can also generate normal map textures.
|
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:
|
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]
|
[codeblock]
|
||||||
var texture = preload("res://noise.tres")
|
var texture = NoiseTexture.new()
|
||||||
yield(texture, "changed")
|
texture.noise = OpenSimplexNoise.new()
|
||||||
|
await texture.changed
|
||||||
var image = texture.get_image()
|
var image = texture.get_image()
|
||||||
var data = image.get_data()
|
var data = image.get_data()
|
||||||
[/codeblock]
|
[/codeblock]
|
||||||
|
|
Loading…
Reference in a new issue