first Prototype

This commit is contained in:
Exobyt 2025-08-28 01:55:38 +02:00
parent e11825c698
commit 35ce267482
481 changed files with 17315 additions and 1 deletions

View file

@ -0,0 +1,95 @@
# Remap UI for LocalizationEditor : MIT License
# @author Vladimir Petrenko
@tool
extends MarginContainer
var _key
var _remap
var _data: LocalizationData
@onready var _remap_ui = $HBox/Remap
@onready var _audio_ui = $HBox/Audio
@onready var _video_ui = $HBox/Video
@onready var _image_ui = $HBox/Image
const LocalizationRemapDialogVideo = preload("res://addons/localization_editor/scenes/remaps/LocalizationRemapDialogVideo.tscn")
const LocalizationRemapDialogImage = preload("res://addons/localization_editor/scenes/remaps/LocalizationRemapDialogImage.tscn")
func set_data(key, remap, data: LocalizationData) -> void:
_key = key
_remap = remap
_data = data
_remap_ui.set_data(key, remap, data)
_init_connections()
_draw_view()
func _init_connections() -> void:
if not _data.is_connected("data_remapkey_value_changed", _draw_view):
assert(_data.data_remapkey_value_changed.connect(_draw_view) == OK)
if not _audio_ui.is_connected("pressed", _on_audio_pressed):
assert(_audio_ui.connect("pressed", _on_audio_pressed) == OK)
if not _video_ui.is_connected("pressed", _on_video_pressed):
assert(_video_ui.connect("pressed", _on_video_pressed) == OK)
if not _image_ui.is_connected("pressed", _on_image_pressed):
assert(_image_ui.connect("pressed", _on_image_pressed) == OK)
func _draw_view() -> void:
_check_buttons()
func _check_buttons() -> void:
_hide_buttons()
var type = _data.remap_type(_remap)
match type:
"audio":
_audio_ui.show()
"image":
_image_ui.show()
"video":
_video_ui.show()
func _hide_buttons() -> void:
_audio_ui.hide()
_video_ui.hide()
_image_ui.hide()
func _on_audio_pressed() -> void:
var audio_player
if get_tree().get_root().has_node("AudioPlayer"):
audio_player = get_tree().get_root().get_node("AudioPlayer") as AudioStreamPlayer
else:
audio_player = AudioStreamPlayer.new()
get_tree().get_root().add_child(audio_player)
var audio = load(_remap.value)
audio.set_loop(false)
audio_player.stream = audio
audio_player.play()
func _on_video_pressed() -> void:
var video_dialog: Window = LocalizationRemapDialogVideo.instantiate()
var root = get_tree().get_root()
root.add_child(video_dialog)
video_dialog.title = _data.filename(_remap.value)
var video_player = video_dialog.get_node("VideoPlayer") as VideoStreamPlayer
video_player.expand = true
var video: VideoStream = load(_remap.value)
video_player.stream = video
video_dialog.close_requested.connect(_video_dialog_close.bind(video_dialog))
video_dialog.popup_centered(Vector2i(500, 300))
video_player.play()
func _video_dialog_close(video_dialog: Window) -> void:
video_dialog.hide()
func _on_image_pressed() -> void:
var image_dialog: Window = LocalizationRemapDialogImage.instantiate()
var root = get_tree().get_root()
root.add_child(image_dialog)
image_dialog.title = _data.filename(_remap.value)
var texture = image_dialog.get_node("Texture") as TextureRect
var image = load(_remap.value)
texture.texture = image
image_dialog.close_requested.connect(_image_dialog_close.bind(image_dialog))
image_dialog.popup_centered(Vector2i(500, 300))
func _image_dialog_close(image_dialog: Window) -> void:
image_dialog.hide()

View file

@ -0,0 +1 @@
uid://cpx7wk0diu1h3

View file

@ -0,0 +1,39 @@
[gd_scene load_steps=6 format=3 uid="uid://dqtiybaaxohvp"]
[ext_resource type="Script" path="res://addons/localization_editor/scenes/remaps/LocalizationRemap.gd" id="4"]
[ext_resource type="PackedScene" uid="uid://cconuf5kyyt8x" path="res://addons/localization_editor/scenes/remaps/LocalizationRemapPath.tscn" id="5"]
[ext_resource type="Texture2D" uid="uid://bkeugb6vucegl" path="res://addons/localization_editor/icons/Audio.svg" id="5_84ecs"]
[ext_resource type="Texture2D" uid="uid://oxmydroedm6f" path="res://addons/localization_editor/icons/Video.svg" id="6_uxbjg"]
[ext_resource type="Texture2D" uid="uid://dl6cg75c815d8" path="res://addons/localization_editor/icons/Image.svg" id="7_is72i"]
[node name="Remap" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 3
theme_override_constants/margin_right = 3
theme_override_constants/margin_bottom = 3
script = ExtResource("4")
[node name="HBox" type="HBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 0
[node name="Remap" parent="HBox" instance=ExtResource("5")]
layout_mode = 2
[node name="Audio" type="Button" parent="HBox"]
layout_mode = 2
icon = ExtResource("5_84ecs")
[node name="Video" type="Button" parent="HBox"]
layout_mode = 2
icon = ExtResource("6_uxbjg")
[node name="Image" type="Button" parent="HBox"]
layout_mode = 2
icon = ExtResource("7_is72i")

View file

@ -0,0 +1,4 @@
[gd_scene format=3 uid="uid://bh0d4n3rlnltu"]
[node name="LocalizationRemapDialogFile" type="FileDialog"]
size = Vector2i(800, 600)

View file

@ -0,0 +1,10 @@
[gd_scene format=3 uid="uid://cig7xmo5hp6hv"]
[node name="LocalizationRemapVideoDialog" type="Window"]
visible = false
[node name="Texture" type="TextureRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
stretch_mode = 6

View file

@ -0,0 +1,8 @@
[gd_scene format=3 uid="uid://b3vp2dngpmd0f"]
[node name="LocalizationRemapVideoDialog" type="Window"]
[node name="VideoPlayer" type="VideoStreamPlayer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0

View file

@ -0,0 +1,136 @@
# Remap UI LineEdit for LocalizationEditor : MIT License
# @author Vladimir Petrenko
# Drag and drop not work just now, see Workaround -> LocalizationRemapPut
# https://github.com/godotengine/godot/issues/30480
@tool
extends LineEdit
var _key
var _remap
var _data: LocalizationData
var _remap_ui_style_empty: StyleBoxFlat
var _remap_ui_style_resource: StyleBoxFlat
var _remap_ui_style_resource_diff: StyleBoxFlat
var _remap_ui_style_resource_double: StyleBoxFlat
const LocalizationRemapDialogFile = preload("res://addons/localization_editor/scenes/remaps/LocalizationRemapDialogFile.tscn")
func set_data(key, remap, data: LocalizationData) -> void:
_key = key
_remap = remap
_data = data
_init_styles()
_init_connections()
_draw_view()
func _init_styles() -> void:
var style_box = get_theme_stylebox("normal", "LineEdit")
_remap_ui_style_empty = style_box.duplicate()
_remap_ui_style_empty.set_bg_color(Color("#661c1c"))
_remap_ui_style_resource = style_box.duplicate()
_remap_ui_style_resource.set_bg_color(Color("#192e59"))
_remap_ui_style_resource_diff = style_box.duplicate()
_remap_ui_style_resource_diff.set_bg_color(Color("#514200"))
_remap_ui_style_resource_double = style_box.duplicate()
_remap_ui_style_resource_double.set_bg_color(Color("#174044"))
func _init_connections() -> void:
if not _data.is_connected("data_remapkey_value_changed", _draw_view):
assert(_data.data_remapkey_value_changed.connect(_draw_view) == OK)
if not is_connected("focus_entered", _on_focus_entered):
assert(focus_entered.connect(_on_focus_entered) == OK)
if not is_connected("focus_exited", _on_focus_exited):
assert(focus_exited.connect(_on_focus_exited) == OK)
if not is_connected("text_changed", _remap_value_changed):
assert(text_changed.connect(_remap_value_changed) == OK)
if not is_connected("gui_input", _on_gui_input):
assert(gui_input.connect(_on_gui_input) == OK)
func _draw_view() -> void:
if has_focus():
text = _remap.value
else:
text = _data.filename(_remap.value)
_check_remap_ui()
func _input(event) -> void:
if (event is InputEventMouseButton) and event.pressed:
if not get_global_rect().has_point(event.position):
release_focus()
func _on_focus_entered() -> void:
text = _remap.value
func _on_focus_exited() -> void:
text = _data.filename(_remap.value)
func _remap_value_changed(remap_value) -> void:
_data.remapkey_value_change(_remap, remap_value)
func _on_gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_MIDDLE:
if event.pressed:
grab_focus()
var file_dialog = LocalizationRemapDialogFile.instantiate()
if _resource_exists():
file_dialog.current_dir = _data.file_path(_remap.value)
file_dialog.current_file = _data.filename(_remap.value)
for extension in _data.supported_file_extensions():
file_dialog.add_filter("*." + extension)
var root = get_tree().get_root()
root.add_child(file_dialog)
file_dialog.connect("file_selected", _remap_value_changed)
file_dialog.popup_centered()
func _can_drop_data(position, data) -> bool:
var remap_value = data["files"][0]
var remap_extension = _data.file_extension(remap_value)
for extension in _data.supported_file_extensions():
if remap_extension == extension:
return true
return false
func _drop_data(position, data) -> void:
var remap_value = data["files"][0]
_remap_value_changed(remap_value)
func _check_remap_ui() -> void:
if text.length() <= 0:
set("custom_styles/normal", _remap_ui_style_empty)
tooltip_text = "Please set remap resource"
elif not _resource_exists():
set("custom_styles/normal", _remap_ui_style_resource)
tooltip_text = "Your resource path: \"" + _remap.value + "\" does not exists"
elif _resource_different_type():
set("custom_styles/normal", _remap_ui_style_resource_diff)
tooltip_text = "Your remaps have different types"
elif _resource_double():
set("custom_styles/normal", _remap_ui_style_resource_double)
tooltip_text = "Your have double resources in your remaps"
else:
set("custom_styles/normal", null)
tooltip_text = ""
func _resource_exists() -> bool:
if _data.remap_type(_remap) == "undefined":
return false
return FileAccess.file_exists(_remap.value)
func _resource_different_type() -> bool:
var type = _data.remap_type(_remap)
for remap in _key.remaps:
if remap.value.length() > 0 and type != _data.remap_type(remap):
return true
return false
func _resource_double() -> bool:
var first
for remap in _key.remaps:
if first == null:
first = remap
continue
if remap.value.length() > 0 and first.value == remap.value:
return true
return false

View file

@ -0,0 +1 @@
uid://caetu5nx0gjo4

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=3 uid="uid://cconuf5kyyt8x"]
[ext_resource type="Script" path="res://addons/localization_editor/scenes/remaps/LocalizationRemapPath.gd" id="1"]
[node name="LocalizationRemapPath" type="LineEdit"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("1")

View file

@ -0,0 +1,78 @@
# Remaps UI for LocalizationEditor : MIT License
# @author Vladimir Petrenko
@tool
extends Panel
var _data: LocalizationData
@onready var _remaps_ui = $Scroll/Remaps
const LocalizationRemapsList = preload("res://addons/localization_editor/scenes/remaps/LocalizationRemapsList.tscn")
func set_data(data: LocalizationData) -> void:
_data = data
_init_connections()
_update_view()
func _init_connections() -> void:
if not _data.is_connected("data_changed", _update_view):
assert(_data.data_changed.connect(_update_view) == OK)
func _update_view() -> void:
_clear_ui_remaps()
_add_ui_remaps()
_view_ui_remaps()
_update_ui_remaps()
func _clear_ui_remaps() -> void:
var remaps_ui = _remaps_ui.get_children()
for remap_ui in remaps_ui:
if remap_ui.has_method("get_locale"):
var locale = remap_ui.get_locale()
if _data.find_locale(locale) == null:
remaps_ui.erase(remap_ui)
remap_ui.queue_free()
func _add_ui_remaps() -> void:
var locales = _data.locales()
for locale in locales:
if not _ui_remap_exists(locale):
_add_ui_remap(locale)
func _ui_remap_exists(locale) -> bool:
for remap_ui in _remaps_ui.get_children():
if remap_ui.has_method("get_locale"):
if remap_ui.get_locale() == locale:
return true
return false
func _add_ui_remap(locale: String) -> void:
var ui_remap = LocalizationRemapsList.instantiate()
_remaps_ui.add_child(ui_remap)
ui_remap.set_data(locale, _data)
func _view_ui_remaps() -> void:
for remap_ui in _remaps_ui.get_children():
if remap_ui.has_method("get_locale"):
var locale = remap_ui.get_locale()
var serarator_ui = _separator_after_remap_ui(remap_ui)
if _data.is_locale_visible(locale):
remap_ui.show()
if serarator_ui != null:
serarator_ui.show()
else:
remap_ui.hide()
if serarator_ui != null:
serarator_ui.hide()
func _separator_after_remap_ui(remap_ui: Node) -> Node:
var index = remap_ui.get_index()
var count = _remaps_ui.get_child_count()
if index + 1 < count:
return _remaps_ui.get_child(index + 1)
return null
func _update_ui_remaps() -> void:
for remap_ui in _remaps_ui.get_children():
if remap_ui.has_method("update_view"):
remap_ui.update_view()

View file

@ -0,0 +1 @@
uid://bygtup048vkg4

View file

@ -0,0 +1,29 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/localization_editor/scenes/remaps/LocalizationRemaps.gd" type="Script" id=2]
[node name="LocalizationRemaps" type="Panel"]
margin_left = 518.0
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Scroll" type="ScrollContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Remaps" type="HBoxContainer" parent="Scroll"]
margin_right = 506.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3

View file

@ -0,0 +1,27 @@
# Remaps view for LocalizationEditor : MIT License
# @author Vladimir Petrenko
@tool
extends HBoxContainer
var _data: LocalizationData
var _split_viewport_size = 0
@onready var _split_ui = $Split
@onready var _keys_ui = $Split/Keys
@onready var _remaps_ui = $Split/Remaps
const LocalizationRemaps = preload("res://addons/localization_editor/scenes/remaps/LocalizationRemaps.tscn")
func set_data(data: LocalizationData):
_data = data
_keys_ui.set_data(data)
_remaps_ui.set_data(data)
func _process(delta):
if _split_viewport_size != size.x:
_split_viewport_size = size.x
_init_split_offset()
func _init_split_offset() -> void:
var offset = 70
_split_ui.set_split_offset(-size.x / 2 + offset)

View file

@ -0,0 +1 @@
uid://bn300pfj06p2u

View file

@ -0,0 +1,31 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsEditorView.gd" type="Script" id=1]
[ext_resource path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsKeys.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/localization_editor/scenes/remaps/LocalizationRemaps.tscn" type="PackedScene" id=3]
[node name="Remaps" type="HBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_vertical = 3
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Split" type="HSplitContainer" parent="."]
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
split_offset = -442
dragger_visibility = 1
[node name="Keys" parent="Split" instance=ExtResource( 2 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 64.0
margin_bottom = 600.0
[node name="Remaps" parent="Split" instance=ExtResource( 3 )]
margin_left = 76.0

View file

@ -0,0 +1,32 @@
# Head UI for LocalizationEditor : MIT License
# @author Vladimir Petrenko
@tool
extends VBoxContainer
var _type: String
var _filter: String = ""
var _data: LocalizationData
@onready var _title_ui = $TitleMargin/HBox/Title
@onready var _filter_ui = $FilterMargin/HBox/Filter
func set_data(type: String, data: LocalizationData):
_type = type
_data = data
_filter = _data.data_filter_remaps_by_type(_type)
_init_connections()
_draw_view()
func _init_connections() -> void:
if not _filter_ui.is_connected("text_changed", _filter_changed_action):
assert(_filter_ui.text_changed.connect(_filter_changed_action) == OK)
func _draw_view() -> void:
_filter_ui.text = _filter
func _filter_changed_action(filter) -> void:
_filter = filter
_data.data_filter_remaps_put(_type, _filter)
func set_title(text: String) -> void:
_title_ui.text = text

View file

@ -0,0 +1 @@
uid://djked7geg1wks

View file

@ -0,0 +1,61 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsHead.gd" type="Script" id=1]
[node name="RemapsHead" type="VBoxContainer"]
margin_right = 344.0
margin_bottom = 57.0
size_flags_horizontal = 3
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TitleMargin" type="MarginContainer" parent="."]
margin_right = 344.0
margin_bottom = 26.0
rect_min_size = Vector2( 0, 26 )
size_flags_horizontal = 3
size_flags_vertical = 0
custom_constants/margin_right = 3
custom_constants/margin_top = 3
custom_constants/margin_left = 3
custom_constants/margin_bottom = 0
[node name="HBox" type="HBoxContainer" parent="TitleMargin"]
margin_left = 3.0
margin_top = 3.0
margin_right = 341.0
margin_bottom = 26.0
[node name="Title" type="Label" parent="TitleMargin/HBox"]
margin_top = 4.0
margin_right = 338.0
margin_bottom = 18.0
size_flags_horizontal = 3
text = "REMAP"
align = 1
[node name="FilterMargin" type="MarginContainer" parent="."]
margin_top = 30.0
margin_right = 344.0
margin_bottom = 57.0
rect_min_size = Vector2( 0, 26 )
size_flags_horizontal = 3
size_flags_vertical = 0
custom_constants/margin_right = 3
custom_constants/margin_top = 3
custom_constants/margin_left = 3
custom_constants/margin_bottom = 0
[node name="HBox" type="HBoxContainer" parent="FilterMargin"]
margin_left = 3.0
margin_top = 3.0
margin_right = 341.0
margin_bottom = 27.0
[node name="Filter" type="LineEdit" parent="FilterMargin/HBox"]
margin_right = 338.0
margin_bottom = 24.0
size_flags_horizontal = 3
placeholder_text = "Filter"

View file

@ -0,0 +1,33 @@
# Remaps key UI for LocalizationEditor : MIT License
# @author Vladimir Petrenko
@tool
extends MarginContainer
var _key
var _data: LocalizationData
@onready var _add_ui = $HBoxContainer/Add
@onready var _del_ui = $HBoxContainer/Del
func set_data(key, data: LocalizationData):
_key = key
_data = data
_draw_view()
func _ready() -> void:
_init_connections()
func _init_connections() -> void:
if not _add_ui.is_connected("pressed", _on_add_pressed):
assert(_add_ui.connect("pressed", _on_add_pressed) == OK)
if not _del_ui.is_connected("pressed", _on_del_pressed):
assert(_del_ui.connect("pressed", _on_del_pressed) == OK)
func _draw_view() -> void:
_del_ui.disabled = _data.remaps().size() == 1
func _on_add_pressed() -> void:
_data._add_remapkey_new_after_uuid_remap(_key.uuid)
func _on_del_pressed() -> void:
_data.del_remapkey(_key.uuid)

View file

@ -0,0 +1 @@
uid://b5te2xo0ppciy

View file

@ -0,0 +1,38 @@
[gd_scene load_steps=4 format=3 uid="uid://1qs1y7jo8jb5"]
[ext_resource type="Texture2D" uid="uid://cbf54t7aak7dy" path="res://addons/localization_editor/icons/Add.svg" id="2_kn4tc"]
[ext_resource type="Script" path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsKey.gd" id="3"]
[ext_resource type="Texture2D" uid="uid://caiapkr8oaqe6" path="res://addons/localization_editor/icons/Del.svg" id="3_rqcqd"]
[node name="MarginContainer" type="MarginContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 0
theme_override_constants/margin_right = 3
theme_override_constants/margin_left = 3
theme_override_constants/margin_bottom = 3
script = ExtResource( "3" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
offset_left = 3.0
offset_right = 1021.0
offset_bottom = 29.0
size_flags_horizontal = 3
size_flags_vertical = 0
[node name="Add" type="Button" parent="HBoxContainer"]
offset_right = 28.0
offset_bottom = 29.0
hint_tooltip = "Add remap"
icon = ExtResource( "2_kn4tc" )
[node name="Del" type="Button" parent="HBoxContainer"]
offset_left = 32.0
offset_right = 60.0
offset_bottom = 29.0
hint_tooltip = "Del remap"
icon = ExtResource( "3_rqcqd" )

View file

@ -0,0 +1,46 @@
# Remaps keys UI for LocalizationEditor : MIT License
# @author Vladimir Petrenko
@tool
extends Panel
var _data: LocalizationData
@onready var _head_ui = $VBox/Head
@onready var _scroll_ui = $VBox/Scroll
@onready var _keys_ui = $VBox/Scroll/Keys
const LocalizationRemapsKey = preload("res://addons/localization_editor/scenes/remaps/LocalizationRemapsKey.tscn")
func get_v_scroll() -> int:
return _scroll_ui.get_v_scroll()
func set_v_scroll(value: int) -> void:
_scroll_ui.set_v_scroll(value)
func set_data(data: LocalizationData) -> void:
_data = data
_head_ui.set_data(_data)
_init_connections()
_update_view()
func _init_connections() -> void:
if not _data.is_connected("data_changed", _update_view):
assert(_data.data_changed.connect(_update_view) == OK)
func _update_view() -> void:
_clear_view()
_draw_view()
func _clear_view() -> void:
for key_ui in _keys_ui.get_children():
_keys_ui.remove_child(key_ui)
key_ui.queue_free()
func _draw_view() -> void:
for key in _data.remapkeys_filtered():
_draw_key(key)
func _draw_key(key) -> void:
var key_ui = LocalizationRemapsKey.instantiate()
_keys_ui.add_child(key_ui)
key_ui.set_data(key, _data)

View file

@ -0,0 +1 @@
uid://dgcbl3ua7u5sp

View file

@ -0,0 +1,38 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsKeysHead.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsKeys.gd" type="Script" id=3]
[node name="LocalizationRemapsKeys" type="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBox" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Head" parent="VBox" instance=ExtResource( 2 )]
[node name="Scroll" type="ScrollContainer" parent="VBox"]
margin_top = 61.0
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Keys" type="VBoxContainer" parent="VBox/Scroll"]
margin_right = 1024.0
margin_bottom = 539.0
size_flags_horizontal = 3
size_flags_vertical = 3

View file

@ -0,0 +1,46 @@
# Remaps head keys UI for LocalizationEditor : MIT License
# @author Vladimir Petrenko
@tool
extends MarginContainer
var _type: String = "remapkeys"
var _filter: String = ""
var _data: LocalizationData
@onready var _music_ui = $VBox/HBoxTop/Music
@onready var _image_ui = $VBox/HBoxTop/Image
@onready var _video_ui = $VBox/HBoxBottom/Video
@onready var _reset_ui = $VBox/HBoxBottom/Reset
func set_data(data: LocalizationData):
_data = data
_filter = _data.data_filter_remaps_by_type(_type)
_init_connections()
func _init_connections() -> void:
if not _music_ui.is_connected("button_up", _filter_changed_action):
assert(_music_ui.button_up.connect(_filter_changed_action) == OK)
if not _image_ui.is_connected("button_up", _filter_changed_action):
assert(_image_ui.button_up.connect(_filter_changed_action) == OK)
if not _video_ui.is_connected("button_up", _filter_changed_action):
assert(_video_ui.button_up.connect(_filter_changed_action) == OK)
if not _reset_ui.is_connected("button_up", _filter_reset_action):
assert(_reset_ui.button_up.connect(_filter_reset_action) == OK)
func _filter_changed_action() -> void:
var new_filter = ""
if _music_ui.is_pressed():
new_filter = new_filter + "audio"
if _image_ui.is_pressed():
new_filter = new_filter + ",image"
if _video_ui.is_pressed():
new_filter = new_filter + ",video"
_filter = new_filter
_data.data_filter_remaps_put(_type, _filter)
func _filter_reset_action() -> void:
_music_ui.set_pressed(false)
_image_ui.set_pressed(false)
_video_ui.set_pressed(false)
_filter = ""
_data.data_filter_remaps_put(_type, _filter)

View file

@ -0,0 +1 @@
uid://cxu4x8lxt0nvs

View file

@ -0,0 +1,68 @@
[gd_scene load_steps=6 format=3 uid="uid://b7dpjrokji2pg"]
[ext_resource type="Texture2D" uid="uid://dgp35gsev3h0u" path="res://addons/localization_editor/icons/Audio.svg" id="2_6uq4h"]
[ext_resource type="Texture2D" uid="uid://0737j0gpu23r" path="res://addons/localization_editor/icons/Image.svg" id="3_aivuy"]
[ext_resource type="Texture2D" uid="uid://djtpd7stomej7" path="res://addons/localization_editor/icons/Video.svg" id="4_mrycj"]
[ext_resource type="Script" path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsKeysHead.gd" id="5"]
[ext_resource type="Texture2D" uid="uid://dyxcie626p7lk" path="res://addons/localization_editor/icons/Cancel.svg" id="5_ydycg"]
[node name="Head" type="MarginContainer"]
rect_min_size = Vector2(0, 57)
theme_override_constants/margin_right = 3
theme_override_constants/margin_top = 3
theme_override_constants/margin_left = 3
theme_override_constants/margin_bottom = 0
script = ExtResource( "5" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBox" type="VBoxContainer" parent="."]
offset_left = 3.0
offset_top = 3.0
offset_right = 63.0
offset_bottom = 65.0
[node name="HBoxTop" type="HBoxContainer" parent="VBox"]
offset_right = 60.0
offset_bottom = 29.0
rect_min_size = Vector2(0, 24)
[node name="Music" type="Button" parent="VBox/HBoxTop"]
offset_right = 28.0
offset_bottom = 29.0
rect_min_size = Vector2(20, 20)
hint_tooltip = "Audio filter"
toggle_mode = true
icon = ExtResource( "2_6uq4h" )
[node name="Image" type="Button" parent="VBox/HBoxTop"]
offset_left = 32.0
offset_right = 60.0
offset_bottom = 29.0
rect_min_size = Vector2(20, 20)
hint_tooltip = "Texture filter"
toggle_mode = true
icon = ExtResource( "3_aivuy" )
[node name="HBoxBottom" type="HBoxContainer" parent="VBox"]
offset_top = 33.0
offset_right = 60.0
offset_bottom = 62.0
rect_min_size = Vector2(0, 24)
[node name="Video" type="Button" parent="VBox/HBoxBottom"]
offset_right = 28.0
offset_bottom = 29.0
rect_min_size = Vector2(20, 20)
hint_tooltip = "Video filter"
toggle_mode = true
icon = ExtResource( "4_mrycj" )
[node name="Reset" type="Button" parent="VBox/HBoxBottom"]
offset_left = 32.0
offset_right = 60.0
offset_bottom = 29.0
rect_min_size = Vector2(20, 20)
hint_tooltip = "Reset filters"
icon = ExtResource( "5_ydycg" )

View file

@ -0,0 +1,54 @@
# RemapsList UI for LocalizationEditor : MIT License
# @author Vladimir Petrenko
@tool
extends HBoxContainer
var _locale: String
var _data: LocalizationData
@onready var _separator_ui = $Separator
@onready var _head_ui = $VBox/Head
@onready var _scroll_ui = $VBox/Scroll
@onready var _remaps_ui = $VBox/Scroll/RemapsList
const LocalizationRemap = preload("res://addons/localization_editor/scenes/remaps/LocalizationRemap.tscn")
func set_data(locale: String, data: LocalizationData) -> void:
_locale = locale
_data = data
_head_ui.set_data(_locale, _data)
update_view()
func get_locale() -> String:
return _locale
func get_v_scroll() -> int:
if _scroll_ui == null:
return 0
return _scroll_ui.get_v_scroll()
func set_v_scroll(value: int) -> void:
_scroll_ui.set_v_scroll(value)
func update_view() -> void:
if get_index() == 0:
_separator_ui.hide()
_head_ui.set_title(LocalizationLocalesList.label_by_code(_locale))
_add_remaps()
func _add_remaps() -> void:
_clear_remaps()
for key in _data.remapkeys_filtered():
for remap in key.remaps:
if remap.locale == _locale:
_add_remap(key, remap)
func _clear_remaps() -> void:
for remap_ui in _remaps_ui.get_children():
_remaps_ui.remove_child(remap_ui)
remap_ui.queue_free()
func _add_remap(key, remap) -> void:
var remap_ui = LocalizationRemap.instantiate()
_remaps_ui.add_child(remap_ui)
remap_ui.set_data(key, remap, _data)

View file

@ -0,0 +1 @@
uid://d3xv5mt01uv0l

View file

@ -0,0 +1,42 @@
[gd_scene load_steps=3 format=3 uid="uid://bqdplxampikmo"]
[ext_resource type="Script" path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsList.gd" id="1"]
[ext_resource type="PackedScene" path="res://addons/localization_editor/scenes/remaps/LocalizationRemapsHead.tscn" id="2"]
[node name="RemapsVBox" type="HBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( "1" )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Separator" type="VSeparator" parent="."]
offset_right = 4.0
offset_bottom = 600.0
[node name="VBox" type="VBoxContainer" parent="."]
offset_left = 8.0
offset_right = 1024.0
offset_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Head" parent="VBox" instance=ExtResource( "2" )]
offset_right = 1016.0
offset_bottom = 69.0
[node name="Scroll" type="ScrollContainer" parent="VBox"]
offset_top = 73.0
offset_right = 1016.0
offset_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="RemapsList" type="VBoxContainer" parent="VBox/Scroll"]
offset_right = 1016.0
offset_bottom = 527.0
size_flags_horizontal = 3
size_flags_vertical = 3