Fix everything for Pandemonium.

This commit is contained in:
Relintai 2023-08-12 10:02:42 +02:00
parent 7b3194f500
commit d1e4b34cdc
7 changed files with 29 additions and 29 deletions

View File

@ -36,8 +36,8 @@ func _init() -> void:
_line_edit = LineEdit.new() _line_edit = LineEdit.new()
_line_edit.set_as_toplevel(true) _line_edit.set_as_toplevel(true)
_line_edit.visible = false _line_edit.visible = false
_line_edit.add_stylebox_override("normal", style) _line_edit.add_theme_stylebox_override("normal", style)
_line_edit.add_stylebox_override("focus", StyleBoxEmpty.new()) _line_edit.add_theme_stylebox_override("focus", StyleBoxEmpty.new())
var _ret: int var _ret: int
_ret = _line_edit.connect("focus_exited", self, "_on_line_edit_focus_exited") _ret = _line_edit.connect("focus_exited", self, "_on_line_edit_focus_exited")
@ -48,8 +48,8 @@ func _init() -> void:
func _draw() -> void: func _draw() -> void:
var font := get_font("font", "LineEdit") var font := get_theme_font("font", "LineEdit")
var color := get_color("highlighted_font_color" if _mouse_hovering else "font_color", "Editor") var color := get_theme_color("highlighted_font_color" if _mouse_hovering else "font_color", "Editor")
var number_string := "%.3f" % value var number_string := "%.3f" % value
var number_size := font.get_string_size(number_string) var number_size := font.get_string_size(number_string)
var pos := Vector2( var pos := Vector2(
@ -70,7 +70,7 @@ func _draw() -> void:
func _get_minimum_size() -> Vector2: func _get_minimum_size() -> Vector2:
var ms := _stylebox_normal.get_minimum_size() var ms := _stylebox_normal.get_minimum_size()
ms.y += get_font("font", "LineEdit").get_height() ms.y += get_theme_font("font", "LineEdit").get_height()
return ms return ms
@ -121,13 +121,13 @@ func set_value(v: float) -> void:
func _update_stylebox() -> void: func _update_stylebox() -> void:
_stylebox_normal = get_stylebox("normal", "LineEdit") _stylebox_normal = get_theme_stylebox("normal", "LineEdit")
_stylebox_hover = StyleBoxFlat.new() _stylebox_hover = StyleBoxFlat.new()
_stylebox_hover.bg_color = get_color("highlight_color", "Editor") _stylebox_hover.bg_color = get_theme_color("highlight_color", "Editor")
_stylebox_editing = StyleBoxFlat.new() _stylebox_editing = StyleBoxFlat.new()
_stylebox_editing.bg_color = get_color("dark_color_2", "Editor") _stylebox_editing.bg_color = get_theme_color("dark_color_2", "Editor")
_stylebox_value = StyleBoxFlat.new() _stylebox_value = StyleBoxFlat.new()
_stylebox_value.bg_color = get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4) _stylebox_value.bg_color = get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4)
func _drag_prepare(mouse: InputEventMouse) -> void: func _drag_prepare(mouse: InputEventMouse) -> void:

View File

@ -78,18 +78,18 @@ func _notification(what: int):
match what: match what:
NOTIFICATION_ENTER_TREE, NOTIFICATION_THEME_CHANGED: NOTIFICATION_ENTER_TREE, NOTIFICATION_THEME_CHANGED:
find_node("ScrollContainer").add_stylebox_override("bg", get_stylebox("bg", "Tree")) find_node("ScrollContainer").add_theme_stylebox_override("bg", get_theme_stylebox("bg", "Tree"))
if extra_button: if extra_button:
var popup = extra_button.get_popup() var popup = extra_button.get_popup()
popup.set_item_icon(popup.get_item_index(ExtraOption.COPY), get_icon("ActionCopy", "EditorIcons")) popup.set_item_icon(popup.get_item_index(ExtraOption.COPY), get_theme_icon("ActionCopy", "EditorIcons"))
popup.set_item_icon(popup.get_item_index(ExtraOption.PASTE), get_icon("ActionPaste", "EditorIcons")) popup.set_item_icon(popup.get_item_index(ExtraOption.PASTE), get_theme_icon("ActionPaste", "EditorIcons"))
func edit(path: String) -> void: func edit(path: String) -> void:
if _modified: if _modified:
_popup_confirm( _popup_confirm(
translator.tr("There are unsaved changes.\nOpen '%s' anyway?") % path, str(translator.tr("There are unsaved changes.\nOpen '%s' anyway?")) % path,
"_set_editing_file", [path] "_set_editing_file", [path]
) )
else: else:
@ -176,7 +176,7 @@ func _set_editing_file(path: String) -> int: # Error
else: else:
var err := _config.load(path) var err := _config.load(path)
if err != OK: if err != OK:
_popup_message(translator.tr("'%s' is not a valid SFXR file.") % path) _popup_message(str(translator.tr("'%s' is not a valid SFXR file.")) % path)
return err return err
audio_player.stream = load(path) audio_player.stream = load(path)
@ -189,7 +189,7 @@ func _set_modified(value: bool) -> void:
_modified = value _modified = value
var has_file := not _path.empty() var has_file := not _path.empty()
var base = _path if has_file else translator.tr("Unsaved sound") var base = _path if has_file else str(translator.tr("Unsaved sound"))
if _modified: if _modified:
base += "(*)" base += "(*)"
filename_label.text = base filename_label.text = base

View File

@ -13,4 +13,4 @@ func _notification(what: int):
match what: match what:
NOTIFICATION_ENTER_TREE, NOTIFICATION_THEME_CHANGED: NOTIFICATION_ENTER_TREE, NOTIFICATION_THEME_CHANGED:
if icon_name: if icon_name:
icon = get_icon(icon_name, "EditorIcons") icon = get_theme_icon(icon_name, "EditorIcons")

View File

@ -25,10 +25,10 @@ func set_plugin(v: EditorPlugin) -> void:
_translate_node(get_parent()) _translate_node(get_parent())
func tr(message: String) -> String: func tr(message: StringName) -> StringName:
if _translation: if _translation:
var translated := _translation.get_message(message) var translated := _translation.get_message(message)
if not translated.empty(): if translated != "":
return translated return translated
return message return message

View File

@ -36,20 +36,20 @@ func get_preset_name(preset):
func get_import_options(preset): func get_import_options(preset):
return [ return [
{ {
name="loop", "name":"loop",
default_value=false, "default_value":false,
}, },
{ {
name="bit_depth", "name":"bit_depth",
property_hint=PROPERTY_HINT_ENUM, "property_hint":PROPERTY_HINT_ENUM,
hint_string="8 Bits,16 Bits", "hint_string":"8 Bits,16 Bits",
default_value=SFXRGenerator.WavBits.WAV_BITS_8, "default_value":SFXRGenerator.WavBits.WAV_BITS_8,
}, },
{ {
name="sample_rate", "name":"sample_rate",
property_hint=PROPERTY_HINT_ENUM, "property_hint":PROPERTY_HINT_ENUM,
hint_string="44100 Hz,22050 Hz", "hint_string":"44100 Hz,22050 Hz",
default_value=SFXRGenerator.WavFreq.WAV_FREQ_44100, "default_value":SFXRGenerator.WavFreq.WAV_FREQ_44100,
}, },
] ]

View File

@ -10,8 +10,8 @@ anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
custom_constants/vseparation = 32
custom_constants/hseparation = 32 custom_constants/hseparation = 32
custom_constants/vseparation = 32
columns = 2 columns = 2
script = ExtResource( 1 ) script = ExtResource( 1 )