You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.9 KiB

[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/dialogic/Images/Pieces/open-icon.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Images/Pieces/closed-icon.svg" type="Texture" id=2]
[sub_resource type="GDScript" id=1]
script/source = "tool
extends CheckBox
var current_piece
var is_disabled = false
func _ready():
# Gotta love the nodes system some times
# Praise the paths (っ´ω`c)♡
current_piece = get_parent().get_parent().get_parent().get_parent()
connect(\"toggled\", self, \"_on_VisibleToggle_toggled\")
func disabled():
self_modulate = Color(0,0,0,0)
is_disabled = true
func set_visible(visible: bool):
pressed = visible
var current_rect_size = current_piece.get(\"rect_size\")
if visible:
current_piece.get_node(\"PanelContainer/VBoxContainer/Header/Preview\").hide()
var index = 0
for node in current_piece.get_node(\"PanelContainer/VBoxContainer\").get_children():
if index > 0:
node.show()
index += 1
else:
if current_piece.has_node(\"PanelContainer/VBoxContainer/Header/Preview\"):
current_piece.get_node(\"PanelContainer/VBoxContainer/Header/Preview\").show()
var index = 0
for node in current_piece.get_node(\"PanelContainer/VBoxContainer\").get_children():
if index > 0:
node.hide()
index += 1
if \"preview\" in current_piece:
current_piece.get_node(\"PanelContainer/VBoxContainer/Header/Preview\").text = current_piece.preview
current_piece.set(\"rect_size\", Vector2(current_rect_size.x,0))
release_focus()
func _on_VisibleToggle_toggled(button_pressed):
if is_disabled:
return
set_visible(button_pressed)
"
[node name="VisibleToggle" type="CheckBox"]
margin_right = 30.0
margin_bottom = 30.0
custom_icons/checked = ExtResource( 1 )
custom_icons/unchecked = ExtResource( 2 )
pressed = true
flat = true
script = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}