Skip to content

Commit d248c34

Browse files
committed
tooltip: Don't save style overrides to tooltip.tscn
Previously, if you opened tooltip.tscn in the editor and hit Save, its `_ready()` method would persist the style overrides we use to apply the editor theme's fonts to the label. This isn't necessary, or desirable. Don't apply the style overrides if the tooltip scene itself is being edited. https://phabricator.endlessm.com/T35540
1 parent 9146bd1 commit d248c34

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

addons/block_code/ui/tooltip/tooltip.gd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ class_name Tooltip
33
extends RichTextLabel
44
## Rich-text control for block tooltips that matches the built-in inspector's tooltips' font styles
55

6+
const Util = preload("res://addons/block_code/ui/util.gd")
7+
68

79
func override_font(font_name: StringName, editor_font_name: StringName) -> Font:
810
var font = get_theme_font(editor_font_name, &"EditorFonts")
911
add_theme_font_override(font_name, font)
1012
return font
1113

1214

13-
func _ready():
15+
func override_fonts():
1416
# Set fonts to match documentation tooltips in inspector
1517
override_font(&"normal_font", &"doc")
1618
override_font(&"mono_font", &"doc_source")
@@ -22,3 +24,8 @@ func _ready():
2224
bold_italics.set_base_font(italics)
2325
bold_italics.set_variation_embolden(1.2)
2426
add_theme_font_override(&"bold_italics_font", bold_italics)
27+
28+
29+
func _ready():
30+
if not Util.node_is_part_of_edited_scene(self):
31+
override_fonts()

0 commit comments

Comments
 (0)