From fd30c36985c6a5de09daf897800c36acb8c2c49a Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Sun, 28 Mar 2021 12:32:17 +0100 Subject: Rename Texture.get_data() to get_image() --- doc/classes/ImageTexture.xml | 6 +++--- doc/classes/Texture2D.xml | 2 +- doc/classes/Viewport.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'doc/classes') diff --git a/doc/classes/ImageTexture.xml b/doc/classes/ImageTexture.xml index 2bea482bc1..5fef56e354 100644 --- a/doc/classes/ImageTexture.xml +++ b/doc/classes/ImageTexture.xml @@ -18,11 +18,11 @@ var texture = load("res://icon.png") $Sprite2D.texture = texture [/codeblock] - This is because images have to be imported as [StreamTexture2D] first to be loaded with [method @GDScript.load]. If you'd still like to load an image file just like any other [Resource], import it as an [Image] resource instead, and then load it normally using the [method @GDScript.load] method. - But do note that the image data can still be retrieved from an imported texture as well using the [method Texture2D.get_data] method, which returns a copy of the data: + This is because images have to be imported as a [StreamTexture2D] first to be loaded with [method @GDScript.load]. If you'd still like to load an image file just like any other [Resource], import it as an [Image] resource instead, and then load it normally using the [method @GDScript.load] method. + [b]Note:[/b] The image can be retrieved from an imported texture using the [method Texture2D.get_image] method, which returns a copy of the image: [codeblock] var texture = load("res://icon.png") - var image : Image = texture.get_data() + var image : Image = texture.get_image() [/codeblock] An [ImageTexture] is not meant to be operated from within the editor interface directly, and is mostly useful for rendering images on screen dynamically via code. If you need to generate images procedurally from within the editor, consider saving and importing images as custom texture resources implementing a new [EditorImportPlugin]. [b]Note:[/b] The maximum texture size is 16384×16384 pixels due to graphics hardware limitations. diff --git a/doc/classes/Texture2D.xml b/doc/classes/Texture2D.xml index 2270b95c63..b648098a94 100644 --- a/doc/classes/Texture2D.xml +++ b/doc/classes/Texture2D.xml @@ -63,7 +63,7 @@ Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API. - + diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 8120ae539e..471d21374d 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -80,9 +80,9 @@ Returns the viewport's texture. - [b]Note:[/b] Due to the way OpenGL works, the resulting [ViewportTexture] is flipped vertically. You can use [method Image.flip_y] on the result of [method Texture2D.get_data] to flip it back, for example: + [b]Note:[/b] Due to the way OpenGL works, the resulting [ViewportTexture] is flipped vertically. You can use [method Image.flip_y] on the result of [method Texture2D.get_image] to flip it back, for example: [codeblock] - var img = get_viewport().get_texture().get_data() + var img = get_viewport().get_texture().get_image() img.flip_y() [/codeblock] -- cgit v1.2.3