Further progress towards Godot 4.0 support

- Primary example scenes (menu, terminal, and asciicast) working but
  still a lot of warning/error messages and some regressions.
- Editor integrated terminal works, but still a lot of warning/error
  messages and some regressions.
- Added support for "blink" display attribute.
- Removed GDScript terminal code. Terminal node is now purely a
  GDExtension. So is LibuvUtils.
- GUT tests not working yet.
- Still a lot of things to fix.
- So far, only built for and manually tested on Linux x86_64.
This commit is contained in:
Leroy Hopson 2023-01-08 22:41:48 +13:00
parent aad8e39dae
commit ad7f97e493
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
30 changed files with 1385 additions and 1459 deletions

View file

@ -1,19 +1,26 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=3 uid="uid://did1ipako11pd"]
[ext_resource path="res://addons/godot_xterm/terminal.gd" type="Script" id=1]
[ext_resource path="res://examples/asciicast/example.cast" type="Animation" id=6]
[ext_resource type="Theme" uid="uid://b7vd50tw2g1nl" path="res://themes/default.tres" id="1_nsh8i"]
[ext_resource type="Animation" uid="uid://dcgqvylq0648u" path="res://examples/asciicast/example.cast" id="2_3048a"]
[node name="Terminal" type="Control"]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_02l7k"]
_data = {
"example": ExtResource("2_3048a")
}
[node name="Terminal" type="Terminal"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
focus_mode = 1
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
theme = ExtResource("1_nsh8i")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "example"
playback_speed = 2.0
method_call_mode = 1
anims/example = ExtResource( 6 )
libraries = {
"": SubResource("AnimationLibrary_02l7k")
}

View file

@ -42,11 +42,11 @@ var offset: int
func _ready():
if not $Terminal.is_connected("key_pressed",Callable(self,"_on_Terminal_key_pressed")):
if not $Terminal.is_connected("key_pressed", Callable(self, "_on_Terminal_key_pressed")):
# warning-ignore:return_value_discarded
$Terminal.connect("key_pressed",Callable(self,"_on_Terminal_key_pressed"))
$Terminal.connect("key_pressed", Callable(self, "_on_Terminal_key_pressed"))
# warning-ignore:return_value_discarded
$Terminal.connect("size_changed",Callable(self,"draw_all"))
$Terminal.connect("size_changed", Callable(self, "draw_all"))
$Terminal.grab_focus()
draw_all()
@ -134,7 +134,10 @@ func _on_Terminal_key_pressed(data: String, event: InputEventKey) -> void:
"Asciicast":
var scene = item.scene.instantiate()
var animation_player: AnimationPlayer = scene.get_node("AnimationPlayer")
scene.connect("key_pressed",Callable(self,"_on_Asciicast_key_pressed").bind(animation_player))
scene.connect(
"key_pressed",
Callable(self, "_on_Asciicast_key_pressed").bind(animation_player)
)
add_child(scene)
scene.grab_focus()
await animation_player.animation_finished
@ -163,7 +166,7 @@ func _on_Terminal_key_pressed(data: String, event: InputEventKey) -> void:
pass
# FIXME
#if OS.has_feature("JavaScript"):
#JavaScript.eval("window.history.back() || window.close()")
#JavaScript.eval("window.history.back() || window.close()")
#get_tree().quit()

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://brjrtf5fpptw8"]
[ext_resource type="Script" path="res://addons/godot_xterm/terminal.gd" id="1"]
[ext_resource type="Script" path="res://examples/menu/menu.gd" id="2"]
[ext_resource type="Theme" uid="uid://b7vd50tw2g1nl" path="res://themes/default.tres" id="2_o1653"]
[node name="Menu" type="Control"]
layout_mode = 3
@ -12,13 +12,11 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("2")
[node name="Terminal" type="Control" parent="."]
[node name="Terminal" type="Terminal" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
focus_mode = 1
script = ExtResource("1")
copy_on_selection = false
theme = ExtResource("2_o1653")

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=6 format=3 uid="uid://ddebdj001o1m5"]
[ext_resource path="res://examples/menu/menu.tscn" type="PackedScene" id=1]
[ext_resource path="res://themes/retro_green.tres" type="Theme" id=2]
[ext_resource type="PackedScene" uid="uid://brjrtf5fpptw8" path="res://examples/menu/menu.tscn" id="1"]
[ext_resource type="Theme" uid="uid://blh56m1gdieyu" path="res://themes/retro_green.tres" id="2"]
[sub_resource type="Shader" id=1]
[sub_resource type="Shader" id="1"]
code = "/*
Shader from Godot Shaders - the free shader library.
godotshaders.com/shader/VHS-and-CRT-monitor-effect
@ -234,31 +234,31 @@ void fragment()
COLOR = text;
}"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/overlay = true
shader_param/scanlines_opacity = 0.4
shader_param/scanlines_width = 0.25
shader_param/grille_opacity = 0.3
shader_param/resolution = Vector2( 768, 240 )
shader_param/pixelate = false
shader_param/roll = true
shader_param/roll_speed = 8.0
shader_param/roll_size = 15.0
shader_param/roll_variation = 1.8
shader_param/distort_intensity = 0.05
shader_param/noise_opacity = 0.4
shader_param/noise_speed = 5.0
shader_param/static_noise_intensity = 0.06
shader_param/aberration = 0.0
shader_param/brightness = 2.5
shader_param/discolor = true
shader_param/warp_amount = 1.0
shader_param/clip_warp = false
shader_param/vignette_intensity = 0.4
shader_param/vignette_opacity = 0.5
[sub_resource type="ShaderMaterial" id="2"]
shader = SubResource("1")
shader_parameter/overlay = true
shader_parameter/scanlines_opacity = 0.4
shader_parameter/scanlines_width = 0.25
shader_parameter/grille_opacity = 0.3
shader_parameter/resolution = Vector2(768, 240)
shader_parameter/pixelate = false
shader_parameter/roll = true
shader_parameter/roll_speed = 8.0
shader_parameter/roll_size = 15.0
shader_parameter/roll_variation = 1.8
shader_parameter/distort_intensity = 0.05
shader_parameter/noise_opacity = 0.4
shader_parameter/noise_speed = 5.0
shader_parameter/static_noise_intensity = 0.06
shader_parameter/aberration = 0.0
shader_parameter/brightness = 2.5
shader_parameter/discolor = true
shader_parameter/warp_amount = 1.0
shader_parameter/clip_warp = false
shader_parameter/vignette_intensity = 0.4
shader_parameter/vignette_opacity = 0.5
[sub_resource type="Environment" id=3]
[sub_resource type="Environment" id="3"]
background_mode = 4
glow_enabled = true
glow_intensity = 1.0
@ -266,36 +266,39 @@ glow_strength = 1.15
glow_blend_mode = 0
[node name="RetroTerm" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("2")
[node name="ColorRect" type="ColorRect" parent="."]
show_behind_parent = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0.156863, 0.156863, 0.156863, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
grow_horizontal = 2
grow_vertical = 2
color = Color(0.156863, 0.156863, 0.156863, 1)
[node name="Menu" parent="." instance=ExtResource( 1 )]
[node name="Menu" parent="." instance=ExtResource("1")]
layout_mode = 1
offset_left = 30.0
offset_top = 30.0
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="ColorRect" type="ColorRect" parent="CanvasLayer"]
modulate = Color( 0, 1, 0.4, 1 )
material = SubResource( 2 )
modulate = Color(0, 1, 0.4, 1)
material = SubResource("2")
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
grow_horizontal = 2
grow_vertical = 2
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( 3 )
environment = SubResource("3")

View file

@ -1,9 +1,9 @@
extends "res://addons/godot_xterm/terminal.gd"
extends Terminal
@export var exec_path: String := "bash"
@export var socat_path: String := "socat" # E.g. /usr/bin/socat
@export var port: int := 2023
@export var verbose: bool := false
@export var exec_path := "bash"
@export var socat_path := "socat" # E.g. /usr/bin/socat
@export var port := 2023
@export var verbose := false
var _timeout = 30
var _pid: int
@ -15,7 +15,7 @@ func _ready():
args.append("tcp-l:%d,reuseaddr,fork" % port)
args.append("exec:%s,pty,setsid,setpgid,stderr,ctty" % exec_path)
_pid = OS.execute(socat_path, args, false)
_pid = OS.create_process(socat_path, args)
func _process(delta):
@ -25,7 +25,7 @@ func _process(delta):
if _timeout < 1:
_error("Timeout: could not connect to socat")
if not _stream.is_connected_to_host():
if _stream.get_connected_host().is_empty():
if _stream.connect_to_host("127.0.0.1", port) != OK:
_error("Could not connect to socat")

View file

@ -1,14 +1,11 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=2 format=3 uid="uid://bc5o6m6ty0ejn"]
[ext_resource path="res://examples/socat_terminal/socat_terminal.gd" type="Script" id=1]
[ext_resource type="Script" path="res://examples/socat_terminal/socat_terminal.gd" id="1"]
[node name="Terminal" type="Control"]
[node name="Terminal" type="Terminal"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
focus_mode = 2
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="data_sent" from="." to="." method="_on_Terminal_data_sent"]
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1")

View file

@ -1,4 +1,4 @@
extends "res://addons/godot_xterm/terminal.gd"
extends Terminal
@onready var pty = $PTY

View file

@ -1,28 +1,24 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=3 uid="uid://cysad55lwtnc6"]
[ext_resource path="res://themes/audio/bell.wav" type="AudioStream" id=1]
[ext_resource path="res://addons/godot_xterm/pty.gd" type="Script" id=2]
[ext_resource path="res://examples/terminal/terminal.gd" type="Script" id=3]
[ext_resource type="AudioStream" uid="uid://n0hqjfxltbm0" path="res://themes/audio/bell.wav" id="1"]
[ext_resource type="Theme" uid="uid://0gk8swmcldbg" path="res://addons/godot_xterm/themes/default.tres" id="1_uci3c"]
[ext_resource type="Script" path="res://addons/godot_xterm/pty.gd" id="2"]
[ext_resource type="Script" path="res://examples/terminal/terminal.gd" id="3"]
[node name="Terminal" type="Control"]
[node name="Terminal" type="Terminal"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
focus_mode = 2
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
copy_on_selection = true
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_uci3c")
script = ExtResource("3")
[node name="PTY" type="Node" parent="."]
script = ExtResource( 2 )
script = ExtResource("2")
terminal_path = NodePath("..")
env = {
"COLORTERM": "truecolor",
"TERM": "xterm-256color"
}
[node name="Bell" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 1 )
stream = ExtResource("1")
[connection signal="bell" from="." to="Bell" method="play"]