22extends TextureRect
33
44
5- const RESOLUTION : Vector2i = Vector2i (64 , 64 )
6-
75var selected_output : StringName
86var node : GaeaGraphNode
97var slider_container : HBoxContainer
@@ -15,8 +13,8 @@ func _ready() -> void:
1513 if is_part_of_edited_scene ():
1614 return
1715
18- expand_mode = EXPAND_FIT_HEIGHT
19- stretch_mode = STRETCH_SCALE
16+ expand_mode = EXPAND_FIT_HEIGHT_PROPORTIONAL
17+ stretch_mode = STRETCH_KEEP_ASPECT
2018
2119 await get_tree ().process_frame
2220
@@ -50,8 +48,8 @@ func _ready() -> void:
5048
5149 get_parent ().add_child (slider_container )
5250
53- texture = ImageTexture . create_from_image ( Image . create_empty ( RESOLUTION . x , RESOLUTION . y , true , Image . FORMAT_RGBA8 ) )
54-
51+ var preview_resolution = GaeaEditorSettings . get_preview_resolution ( )
52+ texture = ImageTexture . create_from_image ( Image . create_empty ( preview_resolution , preview_resolution , true , Image . FORMAT_RGBA8 ))
5553
5654func toggle (for_output : StringName ) -> void :
5755 if not get_parent ().visible :
@@ -71,9 +69,10 @@ func update() -> void:
7169 if not is_visible_in_tree ():
7270 return
7371
74- var resolution : Vector2i = RESOLUTION
72+ var preview_resolution = GaeaEditorSettings .get_preview_resolution ()
73+ var resolution := Vector2i (preview_resolution , preview_resolution )
7574 if is_instance_valid (node .generator ):
76- resolution = resolution .min ( Vector2i ( node .generator .world_size .x , node .generator .world_size .y ))
75+ resolution . x = roundi ( float ( resolution .x ) * float ( node .generator .world_size .x ) / float ( node .generator .world_size .y ))
7776
7877 var data : Dictionary = node .resource .traverse (
7978 selected_output ,
0 commit comments