init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
@tool
|
||||
extends PanelContainer
|
||||
|
||||
@onready var _message = $MarginContainer/HBoxContainer/Label
|
||||
|
||||
func _ready():
|
||||
_configure_source_warning()
|
||||
|
||||
|
||||
func _configure_source_warning():
|
||||
var sb = self.get_theme_stylebox("panel")
|
||||
var color = EditorInterface.get_editor_settings().get_setting("interface/theme/accent_color")
|
||||
color.a = 0.2
|
||||
sb.bg_color = color
|
||||
self.get_node("MarginContainer/HBoxContainer/Icon").texture = get_theme_icon("NodeInfo", "EditorIcons")
|
||||
|
||||
|
||||
func set_text(text: String):
|
||||
_message.text = text
|
||||
File diff suppressed because one or more lines are too long
55
addons/AsepriteWizard/interface/shared/tree/resource_tree.gd
Normal file
55
addons/AsepriteWizard/interface/shared/tree/resource_tree.gd
Normal file
@@ -0,0 +1,55 @@
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
signal refresh_triggered
|
||||
signal multi_selected(item: TreeItem, column: int, selected: bool)
|
||||
|
||||
@onready var _tree: Tree = $Tree
|
||||
|
||||
func _on_tree_filter_change_finished(text):
|
||||
var tree_root: TreeItem = _tree.get_root()
|
||||
|
||||
if text == "":
|
||||
tree_root.call_recursive("set", "visible", true)
|
||||
return
|
||||
tree_root.call_recursive("set", "visible", false)
|
||||
|
||||
_make_matching_children_visible(tree_root, text.to_lower())
|
||||
|
||||
|
||||
func _make_matching_children_visible(tree_root: TreeItem, text: String) -> void:
|
||||
for c in tree_root.get_children():
|
||||
if c.get_text(0).to_lower().contains(text):
|
||||
c.visible = true
|
||||
_ensure_parent_visible(c)
|
||||
_make_matching_children_visible(c, text)
|
||||
|
||||
|
||||
func _ensure_parent_visible(tree_item: TreeItem) -> void:
|
||||
var node_parent = tree_item.get_parent()
|
||||
if node_parent != null and not node_parent.visible:
|
||||
node_parent.visible = true
|
||||
_ensure_parent_visible(node_parent)
|
||||
|
||||
|
||||
func _on_expand_all_pressed():
|
||||
var tree_root: TreeItem = _tree.get_root()
|
||||
tree_root.set_collapsed_recursive(false)
|
||||
|
||||
|
||||
func _on_collapse_all_pressed():
|
||||
var tree_root: TreeItem = _tree.get_root()
|
||||
tree_root.set_collapsed_recursive(true)
|
||||
tree_root.collapsed = false
|
||||
|
||||
|
||||
func _on_refresh_tree_pressed():
|
||||
refresh_triggered.emit()
|
||||
|
||||
|
||||
func _on_tree_multi_selected(item: TreeItem, column: int, selected: bool):
|
||||
multi_selected.emit(item, column, selected)
|
||||
|
||||
|
||||
func get_resource_tree() -> Tree:
|
||||
return _tree
|
||||
@@ -0,0 +1,51 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cisgsfvp4nf1g"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/AsepriteWizard/interface/shared/tree/resource_tree.gd" id="1_io4rc"]
|
||||
[ext_resource type="Script" path="res://addons/AsepriteWizard/interface/imports_manager/tree_filter_field.gd" id="1_q7epo"]
|
||||
|
||||
[node name="resource_tree" type="VBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource("1_io4rc")
|
||||
|
||||
[node name="buttons" type="HFlowContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="tree_filter" type="LineEdit" parent="buttons"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "Filter..."
|
||||
clear_button_enabled = true
|
||||
script = ExtResource("1_q7epo")
|
||||
|
||||
[node name="expand_all" type="Button" parent="buttons"]
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
layout_mode = 2
|
||||
text = "Expand All"
|
||||
|
||||
[node name="collapse_all" type="Button" parent="buttons"]
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
layout_mode = 2
|
||||
text = "Collapse All"
|
||||
|
||||
[node name="refresh_tree" type="Button" parent="buttons"]
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
layout_mode = 2
|
||||
text = "Refresh Tree"
|
||||
|
||||
[node name="Tree" type="Tree" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
hide_root = true
|
||||
select_mode = 2
|
||||
|
||||
[connection signal="change_finished" from="buttons/tree_filter" to="." method="_on_tree_filter_change_finished"]
|
||||
[connection signal="text_changed" from="buttons/tree_filter" to="buttons/tree_filter" method="_on_text_changed"]
|
||||
[connection signal="pressed" from="buttons/expand_all" to="." method="_on_expand_all_pressed"]
|
||||
[connection signal="pressed" from="buttons/collapse_all" to="." method="_on_collapse_all_pressed"]
|
||||
[connection signal="pressed" from="buttons/refresh_tree" to="." method="_on_refresh_tree_pressed"]
|
||||
[connection signal="multi_selected" from="Tree" to="." method="_on_tree_multi_selected"]
|
||||
@@ -0,0 +1,18 @@
|
||||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
signal warning_confirmed
|
||||
signal warning_declined
|
||||
|
||||
@onready var _warning_message = $MarginContainer/warning_message
|
||||
|
||||
func set_message(text: String) -> void:
|
||||
_warning_message.text = text
|
||||
|
||||
|
||||
func _on_confirm_button_up():
|
||||
warning_confirmed.emit()
|
||||
|
||||
|
||||
func _on_cancel_button_up():
|
||||
warning_declined.emit()
|
||||
@@ -0,0 +1,34 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://qgmln507kjnm"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/AsepriteWizard/interface/shared/tree/tree_selection_confirmation_warning.gd" id="1_7gtu1"]
|
||||
|
||||
[node name="confirmation_warning" type="VBoxContainer"]
|
||||
script = ExtResource("1_7gtu1")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="warning_message" type="Label" parent="MarginContainer"]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="buttons" type="HFlowContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="confirm" type="Button" parent="buttons"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Confirm"
|
||||
|
||||
[node name="cancel" type="Button" parent="buttons"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Cancel"
|
||||
|
||||
[connection signal="button_up" from="buttons/confirm" to="." method="_on_confirm_button_up"]
|
||||
[connection signal="button_up" from="buttons/cancel" to="." method="_on_cancel_button_up"]
|
||||
Reference in New Issue
Block a user