Fixed a problem in aspect ratio code of Image node

This commit is contained in:
Rodz Labs 2023-04-18 08:00:25 +02:00
parent c942014124
commit 0f51e1f0f8
1 changed files with 3 additions and 2 deletions

View File

@ -37,8 +37,9 @@ func get_filetime(file_path : String) -> int:
func get_adjusted_uv(uv : String) -> String:
if get_parameter("fix_ar"):
var ar : float = texture.get_height()
ar /= texture.get_width()
var ar : float = 1.0
if texture.get_width() != 0 and texture.get_height() != 0:
ar = texture.get_width() / texture.get_width()
uv = "((%s) - vec2(0.0, %f)) * vec2(1.0, %f)" % [uv, (1-ar)/2, 1/ar]
if get_parameter("clamp"):