Add addons
This commit is contained in:
parent
2c862b2235
commit
3367bad24f
527 changed files with 36197 additions and 0 deletions
60
Sprout/addons/dialogic/Editor/Common/DCSS.gd
Normal file
60
Sprout/addons/dialogic/Editor/Common/DCSS.gd
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
@tool
|
||||
class_name DCSS
|
||||
|
||||
static func get_editor_scale() -> float:
|
||||
return DialogicUtil.get_editor_scale()
|
||||
|
||||
static func inline(style:Dictionary) -> StyleBoxFlat:
|
||||
var scale:float = get_editor_scale()
|
||||
var s := StyleBoxFlat.new()
|
||||
for property in style.keys():
|
||||
match property:
|
||||
'border-left':
|
||||
s.set('border_width_left', style[property] * scale)
|
||||
'border-radius':
|
||||
var radius:float = style[property] * scale
|
||||
s.set('corner_radius_top_left', radius)
|
||||
s.set('corner_radius_top_right', radius)
|
||||
s.set('corner_radius_bottom_left', radius)
|
||||
s.set('corner_radius_bottom_right', radius)
|
||||
'background':
|
||||
s.set('bg_color', style[property])
|
||||
'border':
|
||||
var width:float = style[property] * scale
|
||||
s.set('border_width_left', width)
|
||||
s.set('border_width_right', width)
|
||||
s.set('border_width_top', width)
|
||||
s.set('border_width_bottom', width)
|
||||
'border-color':
|
||||
s.set('border_color', style[property])
|
||||
'padding':
|
||||
var value_v: float = 0.0
|
||||
var value_h: float = 0.0
|
||||
if style[property] is int:
|
||||
value_v = style[property] * scale
|
||||
value_h = value_v
|
||||
else:
|
||||
value_v = style[property][0] * scale
|
||||
value_h = style[property][1] * scale
|
||||
s.set('content_margin_top', value_v)
|
||||
s.set('content_margin_bottom', value_v)
|
||||
s.set('content_margin_left', value_h)
|
||||
s.set('content_margin_right', value_h)
|
||||
'padding-right':
|
||||
s.set('content_margin_right', style[property] * scale)
|
||||
'padding-left':
|
||||
s.set('content_margin_left', style[property] * scale)
|
||||
return s
|
||||
|
||||
static func style(node, style:Dictionary) -> StyleBoxFlat:
|
||||
var scale:float = get_editor_scale()
|
||||
var s:StyleBoxFlat = inline(style)
|
||||
|
||||
node.set('theme_override_styles/normal', s)
|
||||
node.set('theme_override_styles/focus', s)
|
||||
node.set('theme_override_styles/read_only', s)
|
||||
node.set('theme_override_styles/hover', s)
|
||||
node.set('theme_override_styles/pressed', s)
|
||||
node.set('theme_override_styles/disabled', s)
|
||||
node.set('theme_override_styles/panel', s)
|
||||
return s
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
[gd_resource type="StyleBoxFlat" format=3 uid="uid://dmsjhgv22dns8"]
|
||||
|
||||
[resource]
|
||||
content_margin_left = 5.0
|
||||
content_margin_top = 5.0
|
||||
content_margin_right = 5.0
|
||||
content_margin_bottom = 5.0
|
||||
bg_color = Color(0.545098, 0.545098, 0.545098, 0.211765)
|
||||
121
Sprout/addons/dialogic/Editor/Common/side_bar.tscn
Normal file
121
Sprout/addons/dialogic/Editor/Common/side_bar.tscn
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://cwe3r2tbh2og1"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Common/sidebar.gd" id="1_jnq65"]
|
||||
|
||||
[sub_resource type="Image" id="Image_32i3u"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 131, 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, 93, 93, 131, 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, 93, 93, 131, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 55, 255, 97, 97, 58, 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, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 98, 98, 47, 255, 97, 97, 42, 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, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 94, 94, 46, 255, 93, 93, 236, 255, 93, 93, 233, 255, 97, 97, 42, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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_4kt7t"]
|
||||
image = SubResource("Image_32i3u")
|
||||
|
||||
[sub_resource type="Image" id="Image_u4vxh"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 131, 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, 93, 93, 131, 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, 93, 93, 131, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 55, 255, 97, 97, 58, 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, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 98, 98, 47, 255, 97, 97, 42, 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, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 94, 94, 46, 255, 93, 93, 236, 255, 93, 93, 233, 255, 97, 97, 42, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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_41bcg"]
|
||||
image = SubResource("Image_u4vxh")
|
||||
|
||||
[node name="SideBar" type="VSplitContainer"]
|
||||
custom_minimum_size = Vector2(100, 130)
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
split_offset = 100
|
||||
script = ExtResource("1_jnq65")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="IconButtons" type="HFlowContainer" parent="VBoxContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CurrentResource" type="Label" parent="VBoxContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CustomButtons" type="VBoxContainer" parent="VBoxContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 7
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Panel" type="PanelContainer" parent="VBoxContainer/VBox"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Search" type="LineEdit" parent="VBoxContainer/VBox/Panel"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
placeholder_text = "Filter Resources"
|
||||
right_icon = SubResource("ImageTexture_4kt7t")
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/VBox"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ResourcesList" type="ItemList" parent="VBoxContainer/VBox/PanelContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
item_count = 1
|
||||
same_column_width = true
|
||||
item_0/text = "Chapter1.dtl"
|
||||
item_0/icon = SubResource("ImageTexture_41bcg")
|
||||
|
||||
[node name="VBox2" type="VBoxContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="Panel" type="PanelContainer" parent="VBox2"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBox2/Panel"]
|
||||
layout_mode = 2
|
||||
text = "No resource"
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="VBox2"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ResourcesList" type="ItemList" parent="VBox2/PanelContainer"]
|
||||
layout_mode = 2
|
||||
item_count = 1
|
||||
same_column_width = true
|
||||
item_0/text = "Chapter1.dtl"
|
||||
item_0/icon = SubResource("ImageTexture_41bcg")
|
||||
|
||||
[connection signal="text_changed" from="VBoxContainer/VBox/Panel/Search" to="." method="_on_search_text_changed"]
|
||||
110
Sprout/addons/dialogic/Editor/Common/sidebar.gd
Normal file
110
Sprout/addons/dialogic/Editor/Common/sidebar.gd
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
## Script that handles the editor sidebar.
|
||||
|
||||
signal file_activated(file_path)
|
||||
|
||||
@onready var editors_manager = get_parent().get_parent()
|
||||
|
||||
|
||||
func _ready():
|
||||
%ResourcesList.item_selected.connect(_on_resources_list_item_selected)
|
||||
editors_manager.resource_opened.connect(_on_editors_resource_opened)
|
||||
editors_manager.editor_changed.connect(_on_editors_editor_changed)
|
||||
%Search.right_icon = get_theme_icon("Search", "EditorIcons")
|
||||
|
||||
################################################################################
|
||||
## EDITOR BUTTONS/LABELS
|
||||
################################################################################
|
||||
|
||||
func add_icon_button(icon: Texture, tooltip: String) -> Button:
|
||||
var button := Button.new()
|
||||
button.icon = icon
|
||||
button.tooltip_text = tooltip
|
||||
%IconButtons.add_child(button)
|
||||
return button
|
||||
|
||||
|
||||
func add_custom_button(label:String, icon:Texture) -> Button:
|
||||
var button := Button.new()
|
||||
button.text = label
|
||||
button.icon = icon
|
||||
%CustomButtons.add_child(button)
|
||||
return button
|
||||
|
||||
|
||||
func hide_all_custom_buttons() -> void:
|
||||
for button in %CustomButtons.get_children():
|
||||
button.hide()
|
||||
|
||||
|
||||
func set_current_resource_text(text:String) -> void:
|
||||
%CurrentResource.text = text
|
||||
%CurrentResource.visible = not text.is_empty()
|
||||
|
||||
|
||||
func set_unsaved_indicator(saved:bool = true) -> void:
|
||||
if saved and %CurrentResource.text.ends_with('(*)'):
|
||||
%CurrentResource.text = %CurrentResource.text.trim_suffix('(*)')
|
||||
if not saved and not %CurrentResource.text.ends_with('(*)'):
|
||||
%CurrentResource.text = %CurrentResource.text+"(*)"
|
||||
|
||||
################################################################################
|
||||
## RESOURCE LIST
|
||||
################################################################################
|
||||
|
||||
func _on_editors_resource_opened(resource:Resource) -> void:
|
||||
update_resource_list()
|
||||
|
||||
|
||||
func _on_editors_editor_changed(previous:DialogicEditor, current:DialogicEditor) -> void:
|
||||
update_resource_list()
|
||||
|
||||
|
||||
func update_resource_list() -> void:
|
||||
var filter :String = %Search.text
|
||||
var current_file := ""
|
||||
if editors_manager.current_editor and editors_manager.current_editor.current_resource:
|
||||
current_file = editors_manager.current_editor.current_resource.resource_path
|
||||
|
||||
var character_directory: Dictionary = editors_manager.resource_helper.character_directory
|
||||
var timeline_directory: Dictionary = editors_manager.resource_helper.timeline_directory
|
||||
var latest_resources: Array = DialogicUtil.get_project_setting('dialogic/editor/last_resources', [])
|
||||
for res in latest_resources:
|
||||
if !FileAccess.file_exists(res):
|
||||
latest_resources.erase(res)
|
||||
ProjectSettings.set_setting('dialogic/editor/last_resources', latest_resources)
|
||||
|
||||
%ResourcesList.clear()
|
||||
var idx := 0
|
||||
for character in character_directory.values():
|
||||
if character['full_path'] in latest_resources:
|
||||
if filter.is_empty() or filter.to_lower() in character['unique_short_path'].to_lower():
|
||||
%ResourcesList.add_item(
|
||||
character['unique_short_path'],
|
||||
load("res://addons/dialogic/Editor/Images/Resources/character.svg"))
|
||||
%ResourcesList.set_item_metadata(idx, character['full_path'])
|
||||
%ResourcesList.set_item_tooltip(idx, character['full_path'])
|
||||
if character['full_path'] == current_file:
|
||||
%ResourcesList.select(idx)
|
||||
%ResourcesList.set_item_custom_fg_color(idx, get_theme_color("accent_color", "Editor"))
|
||||
idx += 1
|
||||
for timeline_name in timeline_directory:
|
||||
if timeline_directory[timeline_name] in latest_resources:
|
||||
if filter.is_empty() or filter.to_lower() in timeline_name.to_lower():
|
||||
%ResourcesList.add_item(timeline_name, get_theme_icon("TripleBar", "EditorIcons"))
|
||||
%ResourcesList.set_item_metadata(idx, timeline_directory[timeline_name])
|
||||
if timeline_directory[timeline_name] == current_file:
|
||||
%ResourcesList.select(idx)
|
||||
%ResourcesList.set_item_custom_fg_color(idx, get_theme_color("accent_color", "Editor"))
|
||||
idx += 1
|
||||
%ResourcesList.sort_items_by_text()
|
||||
|
||||
|
||||
func _on_resources_list_item_selected(index:int) -> void:
|
||||
editors_manager.edit_resource(load(%ResourcesList.get_item_metadata(index)))
|
||||
|
||||
|
||||
func _on_search_text_changed(new_text:String) -> void:
|
||||
update_resource_list()
|
||||
Loading…
Add table
Add a link
Reference in a new issue