mirror of
https://github.com/Relintai/godot-resources-as-sheets-plugin.git
synced 2025-02-17 03:34:19 +01:00
Add settings menu
This commit is contained in:
parent
e65190c28f
commit
bf15e0d548
@ -7,8 +7,8 @@ export var box_name := "Background" setget _set_box_name
|
||||
|
||||
|
||||
func _ready():
|
||||
_set_box_name(box_class)
|
||||
_set_box_class(box_name)
|
||||
_set_box_name(box_name)
|
||||
_set_box_class(box_class)
|
||||
|
||||
|
||||
func _set_box_name(v):
|
||||
|
@ -189,6 +189,7 @@ func _create_table(columns_changed : bool):
|
||||
new_node = table_header_scene.instance()
|
||||
headers_node.add_child(new_node)
|
||||
new_node.get_node("Button").text = x
|
||||
new_node.get_node("Button").hint_tooltip = x
|
||||
new_node.get_node("Button").connect("pressed", self, "_set_sorting", [x])
|
||||
|
||||
var to_free = root_node.get_child_count() - rows.size() * columns.size()
|
||||
@ -197,7 +198,7 @@ func _create_table(columns_changed : bool):
|
||||
to_free -= 1
|
||||
|
||||
for i in rows.size():
|
||||
_update_row(i)
|
||||
_update_row(i, ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "color_rows"))
|
||||
|
||||
_update_column_sizes()
|
||||
|
||||
@ -206,24 +207,29 @@ func _update_column_sizes():
|
||||
yield(get_tree(), "idle_frame")
|
||||
var column_headers := get_node(path_columns).get_children()
|
||||
var table_root := get_node(path_table_root)
|
||||
var clip_text : bool = ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "clip_headers")
|
||||
var min_width := 0
|
||||
var cell : Control
|
||||
|
||||
get_node(path_columns).get_parent().rect_min_size.y = get_node(path_columns).rect_size.y
|
||||
for i in column_headers.size():
|
||||
cell = table_root.get_child(i)
|
||||
# Skip these 3 and enable header Clip Text to fix misaligned headers
|
||||
|
||||
column_headers[i].get_child(0).clip_text = clip_text
|
||||
column_headers[i].rect_min_size.x = 0
|
||||
cell.rect_min_size.x = 0
|
||||
column_headers[i].rect_size.x = 0
|
||||
|
||||
min_width = max(column_headers[i].get_minimum_size().x, cell.rect_size.x)
|
||||
cell.rect_min_size.x = column_headers[i].get_minimum_size().x
|
||||
min_width = max(column_headers[i].rect_size.x, cell.rect_size.x)
|
||||
column_headers[i].rect_min_size.x = min_width
|
||||
cell.rect_min_size.x = column_headers[i].get_minimum_size().x
|
||||
column_headers[i].rect_size.x = min_width
|
||||
|
||||
get_node(path_columns).queue_sort()
|
||||
|
||||
|
||||
|
||||
func _update_row(row_index : int):
|
||||
func _update_row(row_index : int, color_rows : bool = true):
|
||||
var root_node = get_node(path_table_root)
|
||||
var current_node : Control
|
||||
var next_color := Color.white
|
||||
@ -241,7 +247,7 @@ func _update_row(row_index : int):
|
||||
if columns[i] == "resource_path":
|
||||
column_editors[i].set_value(current_node, current_node.text.get_file())
|
||||
|
||||
if column_types[i] == TYPE_COLOR:
|
||||
if color_rows and column_types[i] == TYPE_COLOR:
|
||||
next_color = rows[row_index].get(columns[i])
|
||||
|
||||
column_editors[i].set_color(current_node, next_color)
|
||||
@ -661,7 +667,7 @@ func _try_convert(value, type):
|
||||
# "off" displayed in lowercase, "ON" in uppercase.
|
||||
return value[0] == "o"
|
||||
|
||||
# If it can't convert, returns null.
|
||||
# If it can't convert, throws exception and returns null.
|
||||
return convert(value, type)
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=16 format=2]
|
||||
[gd_scene load_steps=17 format=2]
|
||||
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/editor_view.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_cells/cell_editor_string.gd" type="Script" id=2]
|
||||
@ -13,6 +13,7 @@
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_cells/cell_editor_array.gd" type="Script" id=11]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_editors/dock_array.tscn" type="PackedScene" id=12]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/typed_cells/cell_editor_enum.gd" type="Script" id=13]
|
||||
[ext_resource path="res://addons/resources_speadsheet_view/settings_grid.gd" type="Script" id=14]
|
||||
|
||||
[sub_resource type="Image" id=3]
|
||||
data = {
|
||||
@ -52,7 +53,7 @@ __meta__ = {
|
||||
table_header_scene = ExtResource( 6 )
|
||||
cell_editor_classes = [ ExtResource( 13 ), ExtResource( 11 ), ExtResource( 3 ), ExtResource( 5 ), ExtResource( 9 ), ExtResource( 2 ) ]
|
||||
path_folder_path = NodePath("HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/Path")
|
||||
path_recent_paths = NodePath("HeaderContentSplit/VBoxContainer/HBoxContainer/RecentPaths")
|
||||
path_recent_paths = NodePath("HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/RecentPaths")
|
||||
path_table_root = NodePath("HeaderContentSplit/MarginContainer/FooterContentSplit/Panel/Scroll/MarginContainer/TableGrid")
|
||||
path_property_editors = NodePath("HeaderContentSplit/MarginContainer/FooterContentSplit/Footer/PropertyEditors")
|
||||
path_columns = NodePath("HeaderContentSplit/VBoxContainer/Columns/Columns")
|
||||
@ -89,23 +90,17 @@ margin_right = 1020.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="HeaderContentSplit/VBoxContainer"]
|
||||
[node name="HBoxContainer" type="HSplitContainer" parent="HeaderContentSplit/VBoxContainer"]
|
||||
margin_top = 16.0
|
||||
margin_right = 1020.0
|
||||
margin_bottom = 40.0
|
||||
split_offset = -249
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="HeaderContentSplit/VBoxContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 107.0
|
||||
margin_bottom = 19.0
|
||||
text = "Resource Folder:"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="HeaderContentSplit/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 111.0
|
||||
margin_right = 491.0
|
||||
margin_right = 553.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/separation = 0
|
||||
@ -113,9 +108,16 @@ __meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 107.0
|
||||
margin_bottom = 19.0
|
||||
text = "Resource Folder:"
|
||||
|
||||
[node name="Path" type="LineEdit" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 296.0
|
||||
margin_left = 107.0
|
||||
margin_right = 469.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
caret_blink = true
|
||||
@ -125,8 +127,8 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="SelectDir" type="Button" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
margin_left = 296.0
|
||||
margin_right = 324.0
|
||||
margin_left = 469.0
|
||||
margin_right = 497.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Open Folder"
|
||||
icon = SubResource( 2 )
|
||||
@ -137,8 +139,8 @@ __meta__ = {
|
||||
icon_name = "Folder"
|
||||
|
||||
[node name="Refresh" type="Button" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
margin_left = 324.0
|
||||
margin_right = 352.0
|
||||
margin_left = 497.0
|
||||
margin_right = 525.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Refresh"
|
||||
icon = SubResource( 2 )
|
||||
@ -149,8 +151,8 @@ __meta__ = {
|
||||
icon_name = "Refresh"
|
||||
|
||||
[node name="DeletePath" type="Button" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
margin_left = 352.0
|
||||
margin_right = 380.0
|
||||
margin_left = 525.0
|
||||
margin_right = 553.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Remove Path from Recent"
|
||||
icon = SubResource( 2 )
|
||||
@ -160,35 +162,49 @@ __meta__ = {
|
||||
}
|
||||
icon_name = "Remove"
|
||||
|
||||
[node name="Label2" type="Label" parent="HeaderContentSplit/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 495.0
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="HeaderContentSplit/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 565.0
|
||||
margin_right = 1020.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="Label2" type="Label" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2"]
|
||||
margin_top = 5.0
|
||||
margin_right = 582.0
|
||||
margin_right = 87.0
|
||||
margin_bottom = 19.0
|
||||
text = "Open Recent:"
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="RecentPaths" type="OptionButton" parent="HeaderContentSplit/VBoxContainer/HBoxContainer"]
|
||||
[node name="RecentPaths" type="OptionButton" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 586.0
|
||||
margin_right = 966.0
|
||||
margin_left = 91.0
|
||||
margin_right = 369.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
clip_text = true
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="Info" type="Button" parent="HeaderContentSplit/VBoxContainer/HBoxContainer"]
|
||||
margin_left = 970.0
|
||||
margin_right = 1020.0
|
||||
[node name="Info" type="Button" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2"]
|
||||
margin_left = 373.0
|
||||
margin_right = 423.0
|
||||
margin_bottom = 24.0
|
||||
text = "About"
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="Settings" type="Button" parent="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2"]
|
||||
margin_left = 427.0
|
||||
margin_right = 455.0
|
||||
margin_bottom = 24.0
|
||||
hint_tooltip = "Settings"
|
||||
icon = SubResource( 2 )
|
||||
script = ExtResource( 4 )
|
||||
icon_name = "GDScript"
|
||||
|
||||
[node name="Sep" type="Control" parent="HeaderContentSplit/VBoxContainer"]
|
||||
margin_top = 42.0
|
||||
margin_right = 1020.0
|
||||
@ -506,12 +522,124 @@ https://twitter.com/don_tnowe
|
||||
Issues and contribution:
|
||||
https://github.com/don-tnowe/godot-resources-as-sheets-plugin"
|
||||
|
||||
[node name="Settings" type="AcceptDialog" parent="Control"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -235.0
|
||||
margin_top = -123.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 88.0
|
||||
window_title = "Settings"
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="ScrollContainer" parent="Control/Settings"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = -8.0
|
||||
margin_bottom = -36.0
|
||||
scroll_horizontal_enabled = false
|
||||
|
||||
[node name="RichTextLabel" type="VBoxContainer" parent="Control/Settings/MarginContainer"]
|
||||
margin_right = 404.0
|
||||
margin_bottom = 167.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="Control/Settings/MarginContainer/RichTextLabel"]
|
||||
margin_right = 404.0
|
||||
margin_bottom = 150.0
|
||||
columns = 2
|
||||
script = ExtResource( 14 )
|
||||
|
||||
[node name="Label" type="Label" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 19.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Color-type cells style rows"
|
||||
|
||||
[node name="ColorRows" type="CheckBox" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_left = 330.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 24.0
|
||||
pressed = true
|
||||
text = "Enable"
|
||||
|
||||
[node name="Label2" type="Label" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_top = 33.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 47.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Colored array elements"
|
||||
|
||||
[node name="ColorArrays" type="CheckBox" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_left = 330.0
|
||||
margin_top = 28.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 52.0
|
||||
pressed = true
|
||||
text = "Enable"
|
||||
|
||||
[node name="Label3" type="Label" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_top = 61.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 75.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Array cell min width"
|
||||
|
||||
[node name="ArrayMinWidth" type="SpinBox" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_left = 330.0
|
||||
margin_top = 56.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 80.0
|
||||
min_value = 32.0
|
||||
max_value = 512.0
|
||||
value = 128.0
|
||||
|
||||
[node name="Label4" type="Label" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_top = 84.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 115.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Clip header text (headers less likely to break but text wont be fully visible)"
|
||||
autowrap = true
|
||||
|
||||
[node name="ClipHeaders" type="CheckBox" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_left = 330.0
|
||||
margin_top = 84.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 115.0
|
||||
text = "Enable"
|
||||
|
||||
[node name="Label5" type="Label" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_top = 119.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 150.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Duplicate arrays on edit (slower, but can be undone)"
|
||||
autowrap = true
|
||||
|
||||
[node name="DupeArrays" type="CheckBox" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
|
||||
margin_left = 330.0
|
||||
margin_top = 119.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 150.0
|
||||
pressed = true
|
||||
text = "Enable"
|
||||
|
||||
[connection signal="text_entered" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/Path" to="." method="_on_Path_text_entered"]
|
||||
[connection signal="pressed" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/SelectDir" to="Control/FileDialog" method="popup_centered"]
|
||||
[connection signal="pressed" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/Refresh" to="." method="_on_Path_text_entered"]
|
||||
[connection signal="pressed" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/DeletePath" to="." method="remove_selected_path_from_recent"]
|
||||
[connection signal="item_selected" from="HeaderContentSplit/VBoxContainer/HBoxContainer/RecentPaths" to="." method="_on_RecentPaths_item_selected"]
|
||||
[connection signal="pressed" from="HeaderContentSplit/VBoxContainer/HBoxContainer/Info" to="Control/Info" method="popup_centered"]
|
||||
[connection signal="item_selected" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/RecentPaths" to="." method="_on_RecentPaths_item_selected"]
|
||||
[connection signal="pressed" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/Info" to="Control/Info" method="popup_centered"]
|
||||
[connection signal="pressed" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/Settings" to="Control/Settings" method="popup_centered"]
|
||||
[connection signal="scroll_started" from="HeaderContentSplit/MarginContainer/FooterContentSplit/Panel/Scroll" to="." method="_on_Scroll_scroll_ended"]
|
||||
[connection signal="text_entered" from="HeaderContentSplit/MarginContainer/FooterContentSplit/Footer/Search/SearchCond" to="." method="_on_SearchCond_text_entered"]
|
||||
[connection signal="text_entered" from="HeaderContentSplit/MarginContainer/FooterContentSplit/Footer/Search/ProcessExpr" to="." method="_on_ProcessExpr_text_entered"]
|
||||
|
@ -5,5 +5,5 @@ description="Edit Many Resources from one Folder as a table.
|
||||
|
||||
Heavily inspired by Multi-Cursor-Editing in text editors, so after selecting multiple cells (in the same column!) using Ctrl+Click or Shift+Click, most Basic-to-Intermediate movements should be available."
|
||||
author="Don Tnowe"
|
||||
version="1.3"
|
||||
version="1.4"
|
||||
script="plugin.gd"
|
||||
|
41
addons/resources_speadsheet_view/settings_grid.gd
Normal file
41
addons/resources_speadsheet_view/settings_grid.gd
Normal file
@ -0,0 +1,41 @@
|
||||
tool
|
||||
class_name SettingsGrid
|
||||
extends GridContainer
|
||||
|
||||
const SETTING_PREFIX = "addons/resources_spreadsheet_view/"
|
||||
|
||||
|
||||
func _ready():
|
||||
for x in get_children():
|
||||
var setting = SETTING_PREFIX + camel_case_to_snake_case(x.name)
|
||||
if x is BaseButton:
|
||||
x.connect("toggled", self, "_set_setting", [setting])
|
||||
if !ProjectSettings.has_setting(setting):
|
||||
call("_set_setting", x.pressed, setting)
|
||||
|
||||
else:
|
||||
x.pressed = ProjectSettings.get_setting(setting)
|
||||
|
||||
elif x is Range:
|
||||
x.connect("value_changed", self, "_set_setting", [setting])
|
||||
if !ProjectSettings.has_setting(setting):
|
||||
call("_set_setting", x.value, setting)
|
||||
|
||||
else:
|
||||
x.value = ProjectSettings.get_setting(setting)
|
||||
|
||||
|
||||
static func camel_case_to_snake_case(string : String) -> String:
|
||||
var i = 0
|
||||
while i < string.length():
|
||||
if string.ord_at(i) < 97:
|
||||
string = string.left(i) + ("_" if i > 0 else "") + string[i].to_lower() + string.substr(i + 1)
|
||||
i += 1
|
||||
|
||||
i += 1
|
||||
|
||||
return string
|
||||
|
||||
|
||||
func _set_setting(new_value, setting):
|
||||
ProjectSettings.set_setting(setting, new_value)
|
@ -9,14 +9,15 @@ size_flags_horizontal = 3
|
||||
custom_constants/separation = 0
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
margin_right = 110.0
|
||||
margin_right = 102.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
text = "resource_name"
|
||||
clip_text = true
|
||||
|
||||
[node name="Label" type="Button" parent="."]
|
||||
margin_left = 110.0
|
||||
margin_right = 140.0
|
||||
margin_left = 102.0
|
||||
margin_right = 132.0
|
||||
margin_bottom = 20.0
|
||||
text = "|| "
|
||||
|
@ -6,7 +6,7 @@ size = 8
|
||||
[node name="Label" type="MarginContainer"]
|
||||
margin_right = 58.0
|
||||
margin_bottom = 14.0
|
||||
rect_min_size = Vector2( 58, 0 )
|
||||
rect_min_size = Vector2( 128, 0 )
|
||||
size_flags_vertical = 9
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
@ -15,7 +15,6 @@ __meta__ = {
|
||||
[node name="Box" type="HFlowContainer" parent="."]
|
||||
margin_right = 128.0
|
||||
margin_bottom = 14.0
|
||||
rect_min_size = Vector2( 128, 0 )
|
||||
mouse_filter = 2
|
||||
custom_constants/vseparation = 0
|
||||
custom_constants/hseparation = 0
|
||||
|
@ -11,6 +11,8 @@ func create_cell(caller : Control) -> Control:
|
||||
|
||||
func set_value(node : Control, value):
|
||||
var children = node.get_node("Box").get_children()
|
||||
node.rect_min_size.x = ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "array_min_width")
|
||||
var colored = ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "color_arrays")
|
||||
while children.size() < value.size():
|
||||
children.append(Label.new())
|
||||
node.get_node("Box").add_child(children[children.size() - 1])
|
||||
@ -22,7 +24,7 @@ func set_value(node : Control, value):
|
||||
else:
|
||||
children[i].visible = true
|
||||
children[i].text = str(value[i])
|
||||
children[i].self_modulate = Color(str(value[i]).hash()) + Color(0.25, 0.25, 0.25, 1.0)
|
||||
children[i].self_modulate = Color.white if !colored else Color(str(value[i]).hash()) + Color(0.25, 0.25, 0.25, 1.0)
|
||||
|
||||
|
||||
func is_text():
|
||||
|
@ -27,7 +27,4 @@ func set_value(node : Control, value):
|
||||
node.text = value.to_html(true)
|
||||
_cached_color = value
|
||||
|
||||
|
||||
func set_color(node : Control, color : Color):
|
||||
.set_color(node, color)
|
||||
node.get_node("Color").color = color
|
||||
node.get_node("Color").color = value
|
||||
|
@ -42,8 +42,12 @@ func _add_value(value):
|
||||
_stored_value.append(value)
|
||||
var values = sheet.get_edited_cells_values()
|
||||
var cur_value
|
||||
var dupe_array : bool = ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "dupe_arrays")
|
||||
for i in values.size():
|
||||
cur_value = values[i]
|
||||
if dupe_array:
|
||||
cur_value = cur_value.duplicate()
|
||||
|
||||
cur_value.append(value)
|
||||
values[i] = cur_value
|
||||
|
||||
@ -54,8 +58,12 @@ func _remove_value(value):
|
||||
_stored_value.erase(value)
|
||||
var values = sheet.get_edited_cells_values()
|
||||
var cur_value
|
||||
var dupe_array : bool = ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "dupe_arrays")
|
||||
for i in values.size():
|
||||
cur_value = values[i]
|
||||
if dupe_array:
|
||||
cur_value = cur_value.duplicate()
|
||||
|
||||
if cur_value.has(value): # erase() not defined in PoolArrays
|
||||
cur_value.remove(cur_value.find(value))
|
||||
|
||||
|
@ -117,6 +117,7 @@ text = "Add:"
|
||||
margin_left = 33.0
|
||||
margin_right = 61.0
|
||||
margin_bottom = 22.0
|
||||
hint_tooltip = "Add String"
|
||||
icon = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
icon_name = "String"
|
||||
@ -125,6 +126,7 @@ icon_name = "String"
|
||||
margin_left = 65.0
|
||||
margin_right = 93.0
|
||||
margin_bottom = 22.0
|
||||
hint_tooltip = "Add Integer"
|
||||
icon = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
icon_name = "int"
|
||||
@ -133,6 +135,7 @@ icon_name = "int"
|
||||
margin_left = 97.0
|
||||
margin_right = 125.0
|
||||
margin_bottom = 22.0
|
||||
hint_tooltip = "Add Float"
|
||||
icon = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
icon_name = "float"
|
||||
@ -141,6 +144,7 @@ icon_name = "float"
|
||||
margin_left = 129.0
|
||||
margin_right = 157.0
|
||||
margin_bottom = 22.0
|
||||
hint_tooltip = "Guess Type and Add"
|
||||
icon = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
icon_name = "Variant"
|
||||
@ -156,6 +160,7 @@ text = "Erase:"
|
||||
margin_left = 203.0
|
||||
margin_right = 231.0
|
||||
margin_bottom = 22.0
|
||||
hint_tooltip = "Erase Value from Array"
|
||||
icon = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
icon_name = "Remove"
|
||||
|
@ -14,6 +14,11 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/resources_speadsheet_view/typed_cells/cell_editor.gd"
|
||||
}, {
|
||||
"base": "GridContainer",
|
||||
"class": "SettingsGrid",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/resources_speadsheet_view/settings_grid.gd"
|
||||
}, {
|
||||
"base": "Control",
|
||||
"class": "SheetsDockEditor",
|
||||
"language": "GDScript",
|
||||
@ -36,11 +41,22 @@ _global_script_classes=[ {
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"CellEditor": "",
|
||||
"SettingsGrid": "",
|
||||
"SheetsDockEditor": "",
|
||||
"TextEditingUtils": "",
|
||||
"ThemeIconButton": "",
|
||||
"ThemeStylebox": ""
|
||||
}
|
||||
color_rows=false
|
||||
color_arrays=true
|
||||
|
||||
[addons]
|
||||
|
||||
resources_spreadsheet_view/color_rows=true
|
||||
resources_spreadsheet_view/color_arrays=true
|
||||
resources_spreadsheet_view/clip_headers=true
|
||||
resources_spreadsheet_view/dupe_arrays=true
|
||||
resources_spreadsheet_view/array_min_width=128.0
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user