This commit is contained in:
Gerard Gascón 2025-04-24 17:23:34 +02:00
commit b99855351d
434 changed files with 50357 additions and 0 deletions

View file

@ -0,0 +1,57 @@
@tool
# ############################################################################ #
# Copyright © 2019-2022 Frédéric Maquin <fred@ephread.com>
# Licensed under the MIT License.
# See LICENSE in the project root for license information.
# ############################################################################ #
extends Popup
# A custom dialog showing a progress bar.
# Hiding this type to prevent registration of "private" nodes.
# See https://github.com/godotengine/godot-proposals/issues/1047
# class_name InkProgressDialog
# ############################################################################ #
# Nodes
# ############################################################################ #
@onready var _margin_container = $MarginContainer
@onready var _vbox_container = $MarginContainer/VBoxContainer
@onready var _title_label = $MarginContainer/VBoxContainer/TitleLabel
@onready var _progress_bar = $MarginContainer/VBoxContainer/ProgressBar
@onready var _current_step_label = $MarginContainer/VBoxContainer/CurrentStepLabel
# ############################################################################ #
# Properties
# ############################################################################ #
## The title of the progress.
var progress_title: String: get = get_progress_title, set = set_progress_title
func set_progress_title(text: String):
_title_label.text = text
func get_progress_title() -> String:
return _title_label.text
## The name of the current step.
var current_step_name: String: get = get_current_step_name, set = set_current_step_name
func set_current_step_name(text: String):
_current_step_label.text = text
func get_current_step_name() -> String:
return _current_step_label.text
## The current progress.
var progress: float:
get:
return _progress_bar.value
set(value):
_progress_bar.value = value
func update_layout(scale: float) -> void:
_margin_container.add_theme_constant_override("offset_right", 10 * scale)
_margin_container.add_theme_constant_override("offset_top", 10 * scale)
_margin_container.add_theme_constant_override("offset_left", 10 * scale)
_margin_container.add_theme_constant_override("offset_bottom", 10 * scale)
_vbox_container.add_theme_constant_override("separation", 5 * scale)

View file

@ -0,0 +1,63 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/inkgd/editor/panel/common/ink_progress_dialog.gd" type="Script" id=1]
[node name="InkProgressDialog" type="Popup"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -250.0
offset_top = -42.5
offset_right = 250.0
offset_bottom = 42.5
custom_minimum_size = Vector2( 500, 85 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
theme_override_constants/margin_right = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_left = 10
theme_override_constants/margin_bottom = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
offset_left = 10.0
offset_top = 10.0
offset_right = 490.0
offset_bottom = 75.0
theme_override_constants/separation = 5
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TitleLabel" type="Label" parent="MarginContainer/VBoxContainer"]
offset_top = 1.0
offset_right = 480.0
offset_bottom = 15.0
text = "Compiling..."
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ProgressBar" type="ProgressBar" parent="MarginContainer/VBoxContainer"]
offset_top = 25.0
offset_right = 480.0
offset_bottom = 39.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CurrentStepLabel" type="Label" parent="MarginContainer/VBoxContainer"]
offset_top = 49.0
offset_right = 480.0
offset_bottom = 63.0
text = "the_intercept.ink"

View file

@ -0,0 +1,103 @@
@tool
# ############################################################################ #
# Copyright © 2019-2022 Frédéric Maquin <fred@ephread.com>
# Licensed under the MIT License.
# See LICENSE in the project root for license information.
# ############################################################################ #
extends Window
# A custom dialog showing a message and, optionally, a command output.
# Hiding this type to prevent registration of "private" nodes.
# See https://github.com/godotengine/godot-proposals/issues/1047
# class_name InkRichDialog
# ############################################################################ #
# Nodes
# ############################################################################ #
@onready var _margin_container = $MarginContainer
@onready var _vbox_container = $MarginContainer/VBoxContainer
@onready var _message_label = $MarginContainer/VBoxContainer/MessageLabel
@onready var _accept_button = $MarginContainer/VBoxContainer/AcceptButton
@onready var _output_panel = $MarginContainer/VBoxContainer/OutputPanel
@onready var _output_label = find_child("OutputLabel")
# ############################################################################ #
# Properties
# ############################################################################ #
## The message displayed in the dialog.
var message_text: String: get = get_message_text, set = set_message_text
func set_message_text(text: String):
_message_label.text = text
func get_message_text() -> String:
return _message_label.text
## An output, often the result of a command, than can optionally be displayed
## in the dialog.
##
## Setting this property to null hides the corresponding panel in the dialog.
var output_text: String: get = get_output_text, set = set_output_text
func set_output_text(text: String):
_output_label.text = text
_output_label.visible = !(text == null || text.length() == 0)
func get_output_text() -> String:
return _output_label.text
# ############################################################################ #
# Overriden Methods
# ############################################################################ #
func _ready():
_accept_button.connect("pressed", Callable(self, "_accept_button_pressed"))
var font = _get_source_font()
if font != null:
_output_panel.add_theme_font_override("font", font)
# ############################################################################ #
# Methods
# ############################################################################ #
func update_layout(scale: float) -> void:
_margin_container.add_theme_constant_override("offset_right", 10 * scale)
_margin_container.add_theme_constant_override("offset_top", 10 * scale)
_margin_container.add_theme_constant_override("offset_left", 10 * scale)
_margin_container.add_theme_constant_override("offset_bottom", 10 * scale)
_vbox_container.add_theme_constant_override("separation", 10 * scale)
# ############################################################################ #
# Signal Receivers
# ############################################################################ #
func _accept_button_pressed():
self.get_parent().remove_child(self)
self.queue_free()
# ############################################################################ #
# Private helpers
# ############################################################################ #
## Gets the monospaced font used by the editor.
func _get_source_font():
var base_theme = _retrieve_base_theme()
if base_theme:
return base_theme.get_font("output_source", "EditorFonts")
else:
return null
## Gets the theme currently used by the editor.
func _retrieve_base_theme():
var parent = self
while(parent != null && parent.theme == null):
var older_parent = parent.get_parent()
if older_parent is Control:
parent = older_parent
else:
break
return parent.theme

View file

@ -0,0 +1,89 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/inkgd/editor/panel/common/ink_rich_dialog.gd" type="Script" id=1]
[node name="Window" type="Window"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -250.0
offset_top = -150.0
offset_right = 250.0
offset_bottom = 150.0
custom_minimum_size = Vector2( 500, 300 )
window_title = "Error"
resizable = true
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/margin_right = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_left = 10
theme_override_constants/margin_bottom = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
offset_left = 10.0
offset_top = 10.0
offset_right = 490.0
offset_bottom = 290.0
theme_override_constants/separation = 10
[node name="MessageLabel" type="Label" parent="MarginContainer/VBoxContainer"]
offset_right = 480.0
offset_bottom = 31.0
text = "Something went wrong while testing inklecate's setup. Please see the output below."
autowrap = true
[node name="OutputPanel" type="Panel" parent="MarginContainer/VBoxContainer"]
offset_top = 41.0
offset_right = 480.0
offset_bottom = 250.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="OutputScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer/OutputPanel"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="OutputMarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/OutputPanel/OutputScrollContainer"]
offset_right = 480.0
offset_bottom = 136.0
size_flags_horizontal = 3
theme_override_constants/margin_right = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_left = 10
theme_override_constants/margin_bottom = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="OutputLabel" type="Label" parent="MarginContainer/VBoxContainer/OutputPanel/OutputScrollContainer/OutputMarginContainer"]
offset_left = 10.0
offset_top = 10.0
offset_right = 470.0
offset_bottom = 126.0
size_flags_vertical = 0
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
autowrap = true
[node name="AcceptButton" type="Button" parent="MarginContainer/VBoxContainer"]
offset_left = 224.0
offset_top = 260.0
offset_right = 255.0
offset_bottom = 280.0
size_flags_horizontal = 4
text = "OK"