20 lines
468 B
GDScript3
20 lines
468 B
GDScript3
|
extends OptionButton
|
||
|
|
||
|
var fsrQuality: Array[float] = [0.50, 0.59, 0.67, 0.77, 1.0]
|
||
|
|
||
|
func _ready():
|
||
|
var viewport_scale := get_viewport().scaling_3d_scale
|
||
|
var closest := -1
|
||
|
var closest_diff := 999.0
|
||
|
|
||
|
for index in range(item_count):
|
||
|
var diff: float = abs(viewport_scale - fsrQuality[index])
|
||
|
|
||
|
if diff < closest_diff:
|
||
|
closest = index
|
||
|
closest_diff = diff
|
||
|
|
||
|
selected = closest
|
||
|
|
||
|
func on_item_selected(index):
|
||
|
get_viewport().scaling_3d_scale = fsrQuality[index]
|