1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Add a failsafe to the previous commit's solution

This commit is contained in:
Emmanouil Papadeas 2024-09-13 01:05:53 +03:00
parent 1e2e5dc431
commit 8c7594a1c8

View file

@ -76,6 +76,8 @@ func commit_action(cel: Image, project := Global.current_project) -> void:
var c := offsets[i] var c := offsets[i]
offsets_image.set_pixel(i, 0, Color(c, c, c, c)) offsets_image.set_pixel(i, 0, Color(c, c, c, c))
var actual_index := gradient.offsets.find(offsets[i]) var actual_index := gradient.offsets.find(offsets[i])
if actual_index == -1:
actual_index = i
gradient_image.set_pixel(i, 0, gradient.colors[actual_index]) gradient_image.set_pixel(i, 0, gradient.colors[actual_index])
var offsets_tex := ImageTexture.create_from_image(offsets_image) var offsets_tex := ImageTexture.create_from_image(offsets_image)
var gradient_tex: Texture2D var gradient_tex: Texture2D