first Prototype
This commit is contained in:
parent
e11825c698
commit
35ce267482
481 changed files with 17315 additions and 1 deletions
|
|
@ -0,0 +1,31 @@
|
|||
# Placeholder UI for LocalizationEditor : MIT License
|
||||
# @author Vladimir Petrenko
|
||||
@tool
|
||||
extends MarginContainer
|
||||
|
||||
var _key
|
||||
var _locale
|
||||
var _data: LocalizationData
|
||||
|
||||
@onready var _placeholder_ui = $HBox/Placeholder
|
||||
|
||||
const Locales = preload("res://addons/localization_editor/model/LocalizationLocalesList.gd")
|
||||
|
||||
func set_data(key, locale, data: LocalizationData) -> void:
|
||||
_key = key
|
||||
_locale = locale
|
||||
_data = data
|
||||
_draw_view()
|
||||
|
||||
func _ready() -> void:
|
||||
_init_connections()
|
||||
|
||||
func _init_connections() -> void:
|
||||
if not _placeholder_ui.is_connected("text_changed", _on_text_changed):
|
||||
assert(_placeholder_ui.text_changed.connect(_on_text_changed) == OK)
|
||||
|
||||
func _draw_view() -> void:
|
||||
_placeholder_ui.text = _data.data_placeholders[_key][_locale]
|
||||
|
||||
func _on_text_changed(new_text) -> void:
|
||||
_data.data_placeholders[_key][_locale] = new_text
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://cnxexngce4bck
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholder.gd" type="Script" id=1]
|
||||
|
||||
[node name="LocalizationPlaceholder" type="MarginContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_min_size = Vector2( 0, 27 )
|
||||
custom_constants/margin_right = 3
|
||||
custom_constants/margin_left = 3
|
||||
custom_constants/margin_bottom = 3
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="."]
|
||||
margin_left = 3.0
|
||||
margin_right = 1021.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 0, 24 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
|
||||
[node name="Placeholder" type="LineEdit" parent="HBox"]
|
||||
margin_right = 1018.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 0, 24 )
|
||||
size_flags_horizontal = 3
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
# Placeholders UI for LocalizationEditor : MIT License
|
||||
# @author Vladimir Petrenko
|
||||
@tool
|
||||
extends Panel
|
||||
|
||||
var _data: LocalizationData
|
||||
|
||||
@onready var _placeholders_ui = $Scroll/Placeholders
|
||||
|
||||
const LocalizationTranslationsList = preload("res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersList.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_placeholders()
|
||||
_add_ui_placeholders()
|
||||
_view_ui_placeholders()
|
||||
_update_ui_placeholders()
|
||||
|
||||
func _clear_ui_placeholders() -> void:
|
||||
var placeholders_ui = _placeholders_ui.get_children()
|
||||
for placeholder_ui in placeholders_ui:
|
||||
if placeholder_ui.has_method("get_locale"):
|
||||
var locale = placeholder_ui.get_locale()
|
||||
if _data.find_locale(locale) == null:
|
||||
placeholders_ui.erase(placeholder_ui)
|
||||
placeholder_ui.queue_free()
|
||||
|
||||
func _add_ui_placeholders() -> void:
|
||||
var locales = _data.locales()
|
||||
for locale in locales:
|
||||
if not _ui_placeholder_exists(locale):
|
||||
_add_ui_placeholder(locale)
|
||||
|
||||
func _ui_placeholder_exists(locale) -> bool:
|
||||
for placeholder_ui in _placeholders_ui.get_children():
|
||||
if placeholder_ui.has_method("get_locale"):
|
||||
if placeholder_ui.get_locale() == locale:
|
||||
return true
|
||||
return false
|
||||
|
||||
func _add_ui_placeholder(locale: String) -> void:
|
||||
var ui_placeholder = LocalizationTranslationsList.instantiate()
|
||||
_placeholders_ui.add_child(ui_placeholder)
|
||||
ui_placeholder.set_data(locale, _data)
|
||||
|
||||
func _view_ui_placeholders() -> void:
|
||||
for placeholder_ui in _placeholders_ui.get_children():
|
||||
if placeholder_ui.has_method("get_locale"):
|
||||
var locale = placeholder_ui.get_locale()
|
||||
var serarator_ui = _separator_after_placeholder_ui(placeholder_ui)
|
||||
if _data.is_locale_visible(locale):
|
||||
placeholder_ui.show()
|
||||
if serarator_ui != null:
|
||||
serarator_ui.show()
|
||||
else:
|
||||
placeholder_ui.hide()
|
||||
if serarator_ui != null:
|
||||
serarator_ui.hide()
|
||||
|
||||
func _separator_after_placeholder_ui(placeholder_ui: Node) -> Node:
|
||||
var index = placeholder_ui.get_index()
|
||||
var count = _placeholders_ui.get_child_count()
|
||||
if index + 1 < count:
|
||||
return _placeholders_ui.get_child(index + 1)
|
||||
return null
|
||||
|
||||
func _update_ui_placeholders() -> void:
|
||||
for placeholder_ui in _placeholders_ui.get_children():
|
||||
if placeholder_ui.has_method("update_view"):
|
||||
placeholder_ui.update_view()
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://b50tncrjb6x5j
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholders.gd" type="Script" id=1]
|
||||
|
||||
[node name="LocalizationPlaceholders" type="Panel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__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="Placeholders" type="HBoxContainer" parent="Scroll"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
# Placeholders view for LocalizationEditor : MIT License
|
||||
# @author Vladimir Petrenko
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
var _data: LocalizationData
|
||||
var _split_viewport_size = 0
|
||||
var _scroll_position = 0
|
||||
|
||||
@onready var _split_ui = $Split
|
||||
@onready var _keys_ui = $Split/Keys
|
||||
@onready var _placeholders_ui = $Split/Placeholders
|
||||
@onready var _placeholders_list_ui = $Split/Placeholders/Scroll/Placeholders
|
||||
|
||||
func set_data(data: LocalizationData) -> void:
|
||||
_data = data
|
||||
_keys_ui.set_data(data)
|
||||
_placeholders_ui.set_data(data)
|
||||
_init_connections()
|
||||
|
||||
func _init_connections() -> void:
|
||||
if not _split_ui.is_connected("dragged", _on_split_dragged):
|
||||
assert(_split_ui.dragged.connect(_on_split_dragged) == OK)
|
||||
|
||||
func _process(delta):
|
||||
if _split_viewport_size != size.x:
|
||||
_split_viewport_size = size.x
|
||||
_init_split_offset()
|
||||
_update_scrolls()
|
||||
|
||||
func _init_split_offset() -> void:
|
||||
var offset = 350
|
||||
if _data:
|
||||
offset = _data.setting_placeholders_split_offset()
|
||||
_split_ui.set_split_offset(-size.x / 2 + offset)
|
||||
|
||||
func _on_split_dragged(offset: int) -> void:
|
||||
if _data != null:
|
||||
var value = -(-size.x / 2 - offset)
|
||||
_data.setting_placeholders_split_offset_put(value)
|
||||
|
||||
# Workaround for https://github.com/godotengine/godot/issues/22936
|
||||
func _update_scrolls() -> void:
|
||||
var sc = _new_scrolls_position()
|
||||
if _scroll_position != sc:
|
||||
_scroll_position = sc
|
||||
_keys_ui.set_v_scroll(_scroll_position)
|
||||
for child in _placeholders_list_ui.get_children():
|
||||
if child.has_method("set_v_scroll"):
|
||||
child.set_v_scroll(_scroll_position)
|
||||
|
||||
func _new_scrolls_position() -> int:
|
||||
if _keys_ui == null:
|
||||
return 0
|
||||
var v_1 = [_keys_ui.get_v_scroll()]
|
||||
var v_2 = []
|
||||
for child in _placeholders_list_ui.get_children():
|
||||
if child.has_method("get_v_scroll"):
|
||||
var v_child = child.get_v_scroll()
|
||||
if v_1[0] == v_child:
|
||||
v_1.append(v_child)
|
||||
else:
|
||||
v_2.append(v_child)
|
||||
if v_2.size() == 0:
|
||||
return v_1[0]
|
||||
if v_1.size() == 1:
|
||||
return v_1[0]
|
||||
return v_2[0]
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://diwy25h5ek0ur
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersEditorView.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersKeys.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholders.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="LocalizationPlaceholdersEditorView" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
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 = -162
|
||||
|
||||
[node name="Keys" parent="Split" instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 344.0
|
||||
margin_bottom = 600.0
|
||||
rect_clip_content = true
|
||||
|
||||
[node name="Placeholders" parent="Split" instance=ExtResource( 3 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 356.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# Placeholders head UI for LocalizationEditor : MIT License
|
||||
# @author Vladimir Petrenko
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
var _type: String
|
||||
var _data: LocalizationData
|
||||
|
||||
var _filter = ""
|
||||
|
||||
@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_placeholders_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_placeholders_put(_type, _filter)
|
||||
|
||||
func set_title(text: String) -> void:
|
||||
_title_ui.text = text
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://c7clt1325spkx
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersHead.gd" type="Script" id=1]
|
||||
|
||||
[node name="LocalizationHead" 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 = "KEYS"
|
||||
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"
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# Translations key UI for LocalizationEditor : MIT License
|
||||
# @author Vladimir Petrenko
|
||||
@tool
|
||||
extends MarginContainer
|
||||
|
||||
var _key
|
||||
var _data: LocalizationData
|
||||
|
||||
@onready var _del_ui = $HBoxContainer/Del as Button
|
||||
@onready var _key_ui = $HBoxContainer/Key as LineEdit
|
||||
|
||||
func _ready() -> void:
|
||||
_del_ui.connect("pressed", _on_del_pressed)
|
||||
|
||||
func _on_del_pressed() -> void:
|
||||
_data.del_placeholder(_key)
|
||||
|
||||
func key():
|
||||
return _key
|
||||
|
||||
func set_data(key, data: LocalizationData):
|
||||
_key = key
|
||||
_data = data
|
||||
_draw_view()
|
||||
|
||||
func _draw_view() -> void:
|
||||
_key_ui.text = _key
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://d6vayujgyix1
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://c0m0p02wuleun"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersKey.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://caiapkr8oaqe6" path="res://addons/localization_editor/icons/Del.svg" id="2_gnca8"]
|
||||
|
||||
[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( "1" )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
offset_left = 3.0
|
||||
offset_right = 1021.0
|
||||
offset_bottom = 597.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Del" type="Button" parent="HBoxContainer"]
|
||||
offset_right = 28.0
|
||||
offset_bottom = 597.0
|
||||
rect_min_size = Vector2(20, 20)
|
||||
icon = ExtResource( "2_gnca8" )
|
||||
|
||||
[node name="Key" type="LineEdit" parent="HBoxContainer"]
|
||||
offset_left = 32.0
|
||||
offset_right = 1018.0
|
||||
offset_bottom = 597.0
|
||||
size_flags_horizontal = 3
|
||||
editable = false
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# Placeholders 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 LocalizationKey = preload("res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersKey.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("placeholderkeys", _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.placeholders_filtered().keys():
|
||||
_draw_key(key)
|
||||
|
||||
func _draw_key(key) -> void:
|
||||
var key_ui = LocalizationKey.instantiate()
|
||||
_keys_ui.add_child(key_ui)
|
||||
key_ui.set_data(key, _data)
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://dogexarhaq31l
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersKeys.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersHead.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="LocalizationPlaceholdersKeys" type="Panel"]
|
||||
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="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 )]
|
||||
margin_right = 1024.0
|
||||
|
||||
[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
|
||||
size_flags_horizontal = 3
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
# Placeholders list 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 _placeholders_ui = $VBox/Scroll/PlaceholdersList
|
||||
|
||||
const Locales = preload("res://addons/localization_editor/model/LocalizationLocalesList.gd")
|
||||
const LocalizationPlaceholder = preload("res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholder.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(Locales.label_by_code(_locale))
|
||||
_add_placeholders()
|
||||
|
||||
func _add_placeholders() -> void:
|
||||
_clear_placeholders()
|
||||
var placeholders_filtered = _data.placeholders_filtered()
|
||||
for key in placeholders_filtered.keys():
|
||||
var placeholder = placeholders_filtered[key]
|
||||
if placeholder.has(_locale):
|
||||
_add_placeholder(key)
|
||||
|
||||
func _clear_placeholders() -> void:
|
||||
for placeholder_ui in _placeholders_ui.get_children():
|
||||
_placeholders_ui.remove_child(placeholder_ui)
|
||||
placeholder_ui.queue_free()
|
||||
|
||||
func _add_placeholder(key) -> void:
|
||||
var placeholder_ui = LocalizationPlaceholder.instantiate()
|
||||
_placeholders_ui.add_child(placeholder_ui)
|
||||
placeholder_ui.set_data(key, _locale, _data)
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://bwbmioxxhe7w1
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersHead.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://addons/localization_editor/scenes/placeholders/LocalizationPlaceholdersList.gd" type="Script" id=2]
|
||||
|
||||
[node name="LocalizationPlaceholdersList" type="HBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_pivot_offset = Vector2( -585.391, 206.877 )
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Separator" type="VSeparator" parent="."]
|
||||
margin_right = 4.0
|
||||
margin_bottom = 600.0
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="."]
|
||||
margin_left = 8.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Head" parent="VBox" instance=ExtResource( 1 )]
|
||||
margin_right = 1016.0
|
||||
|
||||
[node name="Scroll" type="ScrollContainer" parent="VBox"]
|
||||
margin_top = 61.0
|
||||
margin_right = 1016.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="PlaceholdersList" type="VBoxContainer" parent="VBox/Scroll"]
|
||||
margin_right = 1016.0
|
||||
margin_bottom = 539.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
Loading…
Add table
Add a link
Reference in a new issue