First commit 🎉
This commit is contained in:
commit
43ea213f9b
728 changed files with 37080 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
|
||||
<g id="PopochiuGroup" transform="matrix(0.5,0,0,0.5,0,0)">
|
||||
<rect x="0" y="0" width="32" height="32" style="fill:none;"/>
|
||||
<g transform="matrix(3.25,0,0,3.25,-32.75,-39.25)">
|
||||
<path d="M19,13.615C19,13.276 18.724,13 18.385,13L11.615,13C11.276,13 11,13.276 11,13.615L11,20.385C11,20.724 11.276,21 11.615,21L18.385,21C18.724,21 19,20.724 19,20.385L19,13.615Z" style="fill:none;stroke:rgb(112,109,235);stroke-width:1.23px;"/>
|
||||
</g>
|
||||
<g transform="matrix(0.673999,0,0,0.570028,13,-2.18068)">
|
||||
<path d="M0,24L8.902,31.902L-0,39.789" style="fill:none;stroke:rgb(112,109,235);stroke-width:6.41px;"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://uwjkfsrpfx3e"
|
||||
path="res://.godot/imported/popochiu_group.svg-55d153202c16f767328f8314e84a5c37.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/popochiu/editor/main_dock/popochiu_group/images/popochiu_group.svg"
|
||||
dest_files=["res://.godot/imported/popochiu_group.svg-55d153202c16f767328f8314e84a5c37.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
|
@ -0,0 +1,199 @@
|
|||
@tool
|
||||
@icon("res://addons/popochiu/editor/main_dock/popochiu_group/images/popochiu_group.svg")
|
||||
class_name PopochiuGroup
|
||||
extends PanelContainer
|
||||
|
||||
signal create_clicked
|
||||
|
||||
const PopochiuRow := preload("res://addons/popochiu/editor/main_dock/popochiu_row/popochiu_row.gd")
|
||||
|
||||
@export var icon: Texture2D : set = set_icon
|
||||
@export var is_open := true : set = set_is_open
|
||||
@export var color: Color = Color("999999") : set = set_color
|
||||
@export var title := "Group" : set = set_title
|
||||
@export var can_create := true
|
||||
@export var create_text := ""
|
||||
@export var target_list: NodePath = ""
|
||||
@export var custom_title_count := false
|
||||
|
||||
var _external_list: VBoxContainer = null
|
||||
|
||||
@onready var header: PanelContainer = %Header
|
||||
@onready var arrow: TextureRect = %Arrow
|
||||
@onready var trt_icon: TextureRect = %Icon
|
||||
@onready var lbl_title: Label = %Title
|
||||
@onready var body: Container = %Body
|
||||
@onready var btn_create: Button = %BtnCreate
|
||||
@onready var list: VBoxContainer = %List
|
||||
|
||||
|
||||
#region Godot ######################################################################################
|
||||
func _ready() -> void:
|
||||
# Establecer estado inicial
|
||||
add_theme_stylebox_override("panel", get_theme_stylebox("panel").duplicate())
|
||||
(get_theme_stylebox("panel") as StyleBoxFlat).border_color = color
|
||||
|
||||
if is_instance_valid(icon):
|
||||
trt_icon.texture = icon
|
||||
|
||||
lbl_title.text = title
|
||||
btn_create.icon = get_theme_icon("Add", "EditorIcons")
|
||||
btn_create.text = create_text
|
||||
self.is_open = list.get_child_count() > 0
|
||||
|
||||
if not can_create:
|
||||
btn_create.hide()
|
||||
|
||||
header.gui_input.connect(_on_input)
|
||||
list.resized.connect(_update_child_count)
|
||||
btn_create.pressed.connect(emit_signal.bind("create_clicked"))
|
||||
|
||||
if target_list:
|
||||
_external_list = get_node(target_list) as VBoxContainer
|
||||
self.is_open = _external_list.get_child_count() > 0
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public #####################################################################################
|
||||
func clear_list() -> void:
|
||||
for c in list.get_children():
|
||||
# Fix #216: Delete the row immediately so that it does not interfere with the creation of
|
||||
# other rows that may have the same name as it
|
||||
c.free()
|
||||
|
||||
|
||||
func add(node: Node, sort := false) -> void:
|
||||
if sort:
|
||||
node.ready.connect(_order_list.bind(node))
|
||||
|
||||
list.add_child(node)
|
||||
|
||||
btn_create.disabled = false
|
||||
|
||||
if not is_open:
|
||||
self.is_open = true
|
||||
|
||||
|
||||
func clear_favs() -> void:
|
||||
for popochiu_row: PopochiuRow in list.get_children():
|
||||
popochiu_row.clear_tag()
|
||||
|
||||
|
||||
func disable_create() -> void:
|
||||
btn_create.disabled = true
|
||||
|
||||
|
||||
func enable_create() -> void:
|
||||
btn_create.disabled = false
|
||||
|
||||
|
||||
func get_elements() -> Array:
|
||||
return list.get_children()
|
||||
|
||||
|
||||
func remove_by_name(node_name: String) -> void:
|
||||
if list.has_node(node_name):
|
||||
var node: HBoxContainer = list.get_node(node_name)
|
||||
|
||||
list.remove_child(node)
|
||||
node.free()
|
||||
|
||||
|
||||
func add_header_button(btn: Button) -> void:
|
||||
btn_create.add_sibling(btn)
|
||||
|
||||
|
||||
func set_title_count(count: int, max_count := 0) -> void:
|
||||
if max_count > 0:
|
||||
lbl_title.text = "%s (%d/%d)" % [title, count, max_count]
|
||||
else:
|
||||
lbl_title.text = "%s (%d)" % [title, count]
|
||||
|
||||
|
||||
func get_by_name(node_name: String) -> HBoxContainer:
|
||||
if list.has_node(node_name):
|
||||
return list.get_node(node_name)
|
||||
return null
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetGet #####################################################################################
|
||||
func set_icon(value: Texture2D) -> void:
|
||||
icon = value
|
||||
|
||||
if is_instance_valid(trt_icon):
|
||||
trt_icon.texture = value
|
||||
|
||||
|
||||
func set_is_open(value: bool) -> void:
|
||||
is_open = value
|
||||
|
||||
_toggled(value)
|
||||
|
||||
|
||||
func set_color(value: Color) -> void:
|
||||
color = value
|
||||
|
||||
if is_instance_valid(header):
|
||||
(get_theme_stylebox("panel") as StyleBoxFlat).border_color = value
|
||||
|
||||
|
||||
func set_title(value: String) -> void:
|
||||
title = value
|
||||
|
||||
if is_instance_valid(lbl_title):
|
||||
lbl_title.text = value
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private ####################################################################################
|
||||
func _on_input(event: InputEvent) -> void:
|
||||
var mouse_event: = event as InputEventMouseButton
|
||||
if mouse_event and mouse_event.button_index == MOUSE_BUTTON_LEFT \
|
||||
and mouse_event.pressed:
|
||||
is_open = !is_open
|
||||
_toggled(is_open)
|
||||
|
||||
|
||||
func _toggled(button_pressed: bool) -> void:
|
||||
if is_instance_valid(arrow):
|
||||
arrow.texture = (
|
||||
get_theme_icon("GuiTreeArrowDown", "EditorIcons") if button_pressed
|
||||
else get_theme_icon("GuiTreeArrowRight", "EditorIcons")
|
||||
)
|
||||
|
||||
if is_instance_valid(body):
|
||||
if button_pressed: body.show()
|
||||
else: body.hide()
|
||||
|
||||
if is_instance_valid(_external_list):
|
||||
_external_list.visible = button_pressed
|
||||
|
||||
|
||||
func _update_child_count() -> void:
|
||||
if custom_title_count: return
|
||||
|
||||
if is_instance_valid(lbl_title):
|
||||
var children := list.get_child_count()
|
||||
lbl_title.text = title + (" (%d)" % children) if children > 1 else title
|
||||
|
||||
|
||||
func _order_list(node: Node) -> void:
|
||||
node.ready.disconnect(_order_list)
|
||||
|
||||
# Place the new row in its place alphabetically
|
||||
var place_before: Node = null
|
||||
for row in list.get_children():
|
||||
if str(node.name) < str(row.name):
|
||||
place_before = row
|
||||
break
|
||||
|
||||
if not place_before: return
|
||||
|
||||
list.move_child(node, place_before.get_index())
|
||||
|
||||
|
||||
#endregion
|
|
@ -0,0 +1 @@
|
|||
uid://dfejejptym3da
|
|
@ -0,0 +1,91 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://b55ialbvpilxv"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/popochiu/editor/main_dock/popochiu_group/popochiu_group.gd" id="1_lumyt"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qhsn2"]
|
||||
content_margin_left = 8.0
|
||||
content_margin_right = 8.0
|
||||
draw_center = false
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.6, 0.6, 0.6, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_t8mu1"]
|
||||
content_margin_left = 0.0
|
||||
content_margin_top = 0.0
|
||||
content_margin_right = 0.0
|
||||
content_margin_bottom = 0.0
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0.211765)
|
||||
draw_center = false
|
||||
corner_detail = 5
|
||||
expand_margin_left = 4.0
|
||||
expand_margin_right = 4.0
|
||||
|
||||
[sub_resource type="Image" id="Image_e0ep0"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
|
||||
"format": "RGBA8",
|
||||
"height": 16,
|
||||
"mipmaps": false,
|
||||
"width": 16
|
||||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_uhpk4"]
|
||||
image = SubResource("Image_e0ep0")
|
||||
|
||||
[node name="PopochiuGroup" type="PanelContainer"]
|
||||
offset_right = 320.0
|
||||
offset_bottom = 24.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_qhsn2")
|
||||
script = ExtResource("1_lumyt")
|
||||
is_open = false
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Header" type="PanelContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_t8mu1")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Header"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Arrow" type="TextureRect" parent="VBoxContainer/Header/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
texture = SubResource("ImageTexture_uhpk4")
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="VBoxContainer/Header/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="Title" type="Label" parent="VBoxContainer/Header/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Group"
|
||||
|
||||
[node name="Body" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="BtnCreate" type="Button" parent="VBoxContainer/Body"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
icon = SubResource("ImageTexture_uhpk4")
|
||||
|
||||
[node name="List" type="VBoxContainer" parent="VBoxContainer/Body"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
Loading…
Add table
Add a link
Reference in a new issue