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

Use getters to lazy-load cleanEdge and OmniScale shaders

This commit is contained in:
Emmanouil Papadeas 2024-02-19 02:09:35 +02:00
parent 66ea1fcfe9
commit 22ddc96962
3 changed files with 10 additions and 10 deletions

View file

@ -4,8 +4,16 @@ enum GradientDirection { TOP, BOTTOM, LEFT, RIGHT }
## Continuation from Image.Interpolation ## Continuation from Image.Interpolation
enum Interpolation { SCALE3X = 5, CLEANEDGE = 6, OMNISCALE = 7 } enum Interpolation { SCALE3X = 5, CLEANEDGE = 6, OMNISCALE = 7 }
var blend_layers_shader := preload("res://src/Shaders/BlendLayers.gdshader") var blend_layers_shader := preload("res://src/Shaders/BlendLayers.gdshader")
var clean_edge_shader: Shader var clean_edge_shader: Shader:
var omniscale_shader := preload("res://src/Shaders/Effects/Rotation/OmniScale.gdshader") get:
if clean_edge_shader == null:
clean_edge_shader = load("res://src/Shaders/Effects/Rotation/cleanEdge.gdshader")
return clean_edge_shader
var omniscale_shader: Shader:
get:
if omniscale_shader == null:
omniscale_shader = load("res://src/Shaders/Effects/Rotation/OmniScale.gdshader")
return omniscale_shader
## Blends canvas layers into passed image starting from the origin position ## Blends canvas layers into passed image starting from the origin position

View file

@ -33,10 +33,6 @@ func _ready() -> void:
func _about_to_popup() -> void: func _about_to_popup() -> void:
if DrawingAlgos.clean_edge_shader == null:
DrawingAlgos.clean_edge_shader = load(
"res://src/Shaders/Effects/Rotation/cleanEdge.gdshader"
)
drag_pivot = false drag_pivot = false
if pivot == Vector2.INF: if pivot == Vector2.INF:
_calculate_pivot() _calculate_pivot()

View file

@ -22,10 +22,6 @@ func _ready() -> void:
func _on_ScaleImage_about_to_show() -> void: func _on_ScaleImage_about_to_show() -> void:
if DrawingAlgos.clean_edge_shader == null:
DrawingAlgos.clean_edge_shader = load(
"res://src/Shaders/Effects/Rotation/cleanEdge.gdshader"
)
Global.canvas.selection.transform_content_confirm() Global.canvas.selection.transform_content_confirm()
aspect_ratio = float(Global.current_project.size.x) / float(Global.current_project.size.y) aspect_ratio = float(Global.current_project.size.x) / float(Global.current_project.size.y)
width_value.value = Global.current_project.size.x width_value.value = Global.current_project.size.x