Browse Source

Fix font code for Godot 4 in Finite State Machine (#1027)

This clears out some errors that happen on every load of this demo in Godot 4 onward.
It also makes the fonts actually work, as they did not before.

We probably don't strictly **need** these font settings for a demo, but they were here before.

I don't think `SourceCodePro-Black.ttf` was ever used, based on looking at history. So I removed it.

Both `.tres` files are gone too, as those are not used in Godot 4.

I have updated everything that used `SourceCodePro-Bold.ttf` to the new setup.
Christen Lofland 1 year ago
parent
commit
5553ecfd88

+ 5 - 1
2d/finite_state_machine/Demo.tscn

@@ -1,6 +1,7 @@
-[gd_scene load_steps=8 format=3 uid="uid://dmn8nkpogiwsf"]
+[gd_scene load_steps=9 format=3 uid="uid://dmn8nkpogiwsf"]
 
 [ext_resource type="PackedScene" uid="uid://bpdyvy2681m3i" path="res://player/Player.tscn" id="1"]
+[ext_resource type="FontFile" uid="uid://b5bspum6ffekd" path="res://fonts/SourceCodePro-Bold.ttf" id="2_r1c5f"]
 [ext_resource type="PackedScene" uid="uid://cvi13chv8g4hj" path="res://debug/StatesStackDiplayer.tscn" id="3"]
 [ext_resource type="PackedScene" uid="uid://bq6rrfy53rfvo" path="res://debug/ControlsPanel.tscn" id="4"]
 
@@ -43,6 +44,9 @@ libraries = {
 "": SubResource("AnimationLibrary_qbwwp")
 }
 
+[node name="StateNameDisplayer" parent="Player" index="5"]
+theme_override_fonts/font = ExtResource("2_r1c5f")
+
 [node name="Explanations" type="RichTextLabel" parent="."]
 anchors_preset = 15
 anchor_right = 1.0

+ 5 - 1
2d/finite_state_machine/debug/StatesStackDiplayer.tscn

@@ -1,6 +1,7 @@
-[gd_scene load_steps=2 format=3 uid="uid://cvi13chv8g4hj"]
+[gd_scene load_steps=3 format=3 uid="uid://cvi13chv8g4hj"]
 
 [ext_resource type="Script" path="res://debug/states_stack_displayer.gd" id="1"]
+[ext_resource type="FontFile" uid="uid://b5bspum6ffekd" path="res://fonts/SourceCodePro-Bold.ttf" id="2_58if7"]
 
 [node name="StatesStackDiplayer" type="Panel"]
 offset_right = 210.0
@@ -17,6 +18,7 @@ grow_vertical = 2
 
 [node name="Title" type="Label" parent="VBoxContainer"]
 layout_mode = 2
+theme_override_fonts/font = ExtResource("2_58if7")
 text = "StateStack"
 uppercase = true
 
@@ -26,6 +28,7 @@ layout_mode = 2
 [node name="Numbers" type="Label" parent="VBoxContainer/HBoxContainer"]
 unique_name_in_owner = true
 layout_mode = 2
+theme_override_fonts/font = ExtResource("2_58if7")
 text = "1.
 2."
 horizontal_alignment = 2
@@ -33,5 +36,6 @@ horizontal_alignment = 2
 [node name="States" type="Label" parent="VBoxContainer/HBoxContainer"]
 unique_name_in_owner = true
 layout_mode = 2
+theme_override_fonts/font = ExtResource("2_58if7")
 text = "Jump
 Test"

BIN
2d/finite_state_machine/fonts/SourceCodePro-Black.ttf


+ 0 - 33
2d/finite_state_machine/fonts/SourceCodePro-Black.ttf.import

@@ -1,33 +0,0 @@
-[remap]
-
-importer="font_data_dynamic"
-type="FontFile"
-uid="uid://b7c5m4mw0jhww"
-path="res://.godot/imported/SourceCodePro-Black.ttf-5ac54eeedbdedbc63d01069716d9852f.fontdata"
-
-[deps]
-
-source_file="res://fonts/SourceCodePro-Black.ttf"
-dest_files=["res://.godot/imported/SourceCodePro-Black.ttf-5ac54eeedbdedbc63d01069716d9852f.fontdata"]
-
-[params]
-
-Rendering=null
-antialiasing=1
-generate_mipmaps=false
-multichannel_signed_distance_field=false
-msdf_pixel_range=8
-msdf_size=48
-allow_system_fallback=true
-force_autohinter=false
-hinting=1
-subpixel_positioning=1
-oversampling=0.0
-Fallbacks=null
-fallbacks=[]
-Compress=null
-compress=true
-preload=[]
-language_support={}
-script_support={}
-opentype_features={}

+ 0 - 12
2d/finite_state_machine/fonts/source_code_pro_explanations.tres

@@ -1,12 +0,0 @@
-[gd_resource type="Font" load_steps=2 format=2]
-
-[ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="FontData" id=1]
-
-[resource]
-
-size = 20
-use_mipmaps = false
-use_filter = true
-font_data = ExtResource( 1 )
-_sections_unfolded = [ "Font", "Settings" ]
-

+ 0 - 12
2d/finite_state_machine/fonts/source_code_pro_explanations_bold.tres

@@ -1,12 +0,0 @@
-[gd_resource type="Font" load_steps=2 format=2]
-
-[ext_resource path="res://fonts/SourceCodePro-Black.ttf" type="FontData" id=1]
-
-[resource]
-
-size = 24
-use_mipmaps = false
-use_filter = true
-font_data = ExtResource( 1 )
-_sections_unfolded = [ "Font", "Settings" ]
-