Many, many bug fixes

This commit is contained in:
don-tnowe 2022-09-26 10:54:04 +03:00
parent bd9dd395c8
commit 3c3b16970f
5 changed files with 33 additions and 17 deletions

View File

@ -35,6 +35,7 @@ var edited_cells := []
var edited_cells_text := [] var edited_cells_text := []
var edit_cursor_positions := [] var edit_cursor_positions := []
var inspector_resource : Resource var inspector_resource : Resource
var search_cond : Reference
func _ready(): func _ready():
@ -94,7 +95,11 @@ func display_folder(folderpath : String, sort_by : String = "", sort_reverse : b
get_node(path_folder_path).text = folderpath get_node(path_folder_path).text = folderpath
_create_table(force_rebuild or current_path != folderpath) _create_table(force_rebuild or current_path != folderpath)
_apply_search_cond()
current_path = folderpath current_path = folderpath
yield(get_tree(), "idle_frame")
if get_node(path_table_root).get_child_count() == 0:
display_folder(folderpath, sort_by, sort_reverse, force_rebuild)
func _load_resources_from_folder(folderpath : String, sort_by : String, sort_reverse : bool): func _load_resources_from_folder(folderpath : String, sort_by : String, sort_reverse : bool):
@ -219,6 +224,7 @@ func _update_column_sizes():
column_headers[i].rect_min_size.x = 0 column_headers[i].rect_min_size.x = 0
cell.rect_min_size.x = 0 cell.rect_min_size.x = 0
column_headers[i].rect_size.x = 0 column_headers[i].rect_size.x = 0
get_node(path_columns).queue_sort()
min_width = max(column_headers[i].rect_size.x, cell.rect_size.x) min_width = max(column_headers[i].rect_size.x, cell.rect_size.x)
column_headers[i].rect_min_size.x = min_width column_headers[i].rect_min_size.x = min_width
@ -226,7 +232,6 @@ func _update_column_sizes():
column_headers[i].rect_size.x = min_width column_headers[i].rect_size.x = min_width
get_node(path_columns).queue_sort() get_node(path_columns).queue_sort()
func _update_row(row_index : int, color_rows : bool = true): func _update_row(row_index : int, color_rows : bool = true):
@ -241,11 +246,11 @@ func _update_row(row_index : int, color_rows : bool = true):
else: else:
current_node = root_node.get_child(row_index * columns.size() + i) current_node = root_node.get_child(row_index * columns.size() + i)
current_node.hint_tooltip = columns[i] + "\nOf " + rows[row_index].resource_path.get_file() current_node.hint_tooltip = columns[i] + "\nOf " + rows[row_index].resource_path.get_file().get_basename()
column_editors[i].set_value(current_node, rows[row_index].get(columns[i])) column_editors[i].set_value(current_node, rows[row_index].get(columns[i]))
if columns[i] == "resource_path": if columns[i] == "resource_path":
column_editors[i].set_value(current_node, current_node.text.get_file()) column_editors[i].set_value(current_node, current_node.text.get_file().get_basename())
if color_rows and column_types[i] == TYPE_COLOR: if color_rows and column_types[i] == TYPE_COLOR:
next_color = rows[row_index].get(columns[i]) next_color = rows[row_index].get(columns[i])
@ -253,6 +258,18 @@ func _update_row(row_index : int, color_rows : bool = true):
column_editors[i].set_color(current_node, next_color) column_editors[i].set_color(current_node, next_color)
func _apply_search_cond():
if search_cond == null:
_on_SearchCond_text_entered("true")
var table_elements = get_node(path_table_root).get_children()
for i in rows.size():
var row_visible = search_cond.can_show(rows[i], i)
for j in columns.size():
table_elements[i * columns.size() + j].visible = row_visible
func add_path_to_recent(path : String, is_loading : bool = false): func add_path_to_recent(path : String, is_loading : bool = false):
if path in recent_paths: return if path in recent_paths: return
@ -685,15 +702,14 @@ func _on_SearchCond_text_entered(new_text : String):
new_script.reload() new_script.reload()
var new_script_instance = new_script.new() var new_script_instance = new_script.new()
var table_elements = get_node(path_table_root).get_children() search_cond = new_script_instance
_apply_search_cond()
for i in rows.size():
var row_visible = new_script_instance.can_show(rows[i], i)
for j in columns.size():
table_elements[(i + 1) * columns.size() + j].visible = row_visible
func _on_ProcessExpr_text_entered(new_text : String): func _on_ProcessExpr_text_entered(new_text : String):
if new_text == "":
new_text = "true"
var new_script := GDScript.new() var new_script := GDScript.new()
new_script.source_code = "static func get_result(value, res, row_index, cell_index):\n\treturn " + new_text new_script.source_code = "static func get_result(value, res, row_index, cell_index):\n\treturn " + new_text
new_script.reload() new_script.reload()

View File

@ -607,7 +607,7 @@ margin_top = 84.0
margin_right = 326.0 margin_right = 326.0
margin_bottom = 115.0 margin_bottom = 115.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Clip header text (headers less likely to break but text wont be fully visible)" text = "Clip header text (more compact view but header text wont be fully visible) (restart when switching)"
autowrap = true autowrap = true
[node name="ClipHeaders" type="CheckBox" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"] [node name="ClipHeaders" type="CheckBox" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
@ -615,6 +615,7 @@ margin_left = 330.0
margin_top = 84.0 margin_top = 84.0
margin_right = 404.0 margin_right = 404.0
margin_bottom = 115.0 margin_bottom = 115.0
pressed = true
text = "Enable" text = "Enable"
[node name="Label5" type="Label" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"] [node name="Label5" type="Label" parent="Control/Settings/MarginContainer/RichTextLabel/GridContainer"]
@ -640,7 +641,6 @@ text = "Enable"
[connection signal="item_selected" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/RecentPaths" to="." method="_on_RecentPaths_item_selected"] [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/Info" to="Control/Info" method="popup_centered"]
[connection signal="pressed" from="HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/Settings" to="Control/Settings" 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/SearchCond" to="." method="_on_SearchCond_text_entered"]
[connection signal="text_entered" from="HeaderContentSplit/MarginContainer/FooterContentSplit/Footer/Search/ProcessExpr" to="." method="_on_ProcessExpr_text_entered"] [connection signal="text_entered" from="HeaderContentSplit/MarginContainer/FooterContentSplit/Footer/Search/ProcessExpr" to="." method="_on_ProcessExpr_text_entered"]
[connection signal="dir_selected" from="Control/FileDialog" to="." method="_on_FileDialog_dir_selected"] [connection signal="dir_selected" from="Control/FileDialog" to="." method="_on_FileDialog_dir_selected"]

View File

@ -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." 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" author="Don Tnowe"
version="1.4" version="1.4.1"
script="plugin.gd" script="plugin.gd"

View File

@ -8,7 +8,7 @@ var hint_strings_array := []
# Override to define where the cell should be shown. # Override to define where the cell should be shown.
func can_edit_value(value, type, property_hint) -> bool: func can_edit_value(value, type, property_hint) -> bool:
return true return value != null
# Override to change how the cell is created; preload a scene or create nodes from code. # Override to change how the cell is created; preload a scene or create nodes from code.
# Caller is an instance of `editor_view.tscn`. # Caller is an instance of `editor_view.tscn`.

View File

@ -63,17 +63,17 @@ func _increment_values(by : float, property : int):
# Hue has 360 degrees and loops # Hue has 360 degrees and loops
_stored_value.h += by / 360.0 _stored_value.h += by / 360.0
for i in cell_values.size(): for i in cell_values.size():
cell_values[i].h = fposmod(cell_values[i].h + by / 180.0, 1.0) cell_values[i].h = fposmod(cell_values[i].h + by / 360.0, 1.0)
4: 4:
_stored_value.s += by * 0.005 _stored_value.s += by * 0.005
for i in cell_values.size(): for i in cell_values.size():
cell_values[i].s += by * 0.01 cell_values[i].s += by * 0.005
5: 5:
_stored_value.v += by * 0.005 _stored_value.v += by * 0.005
for i in cell_values.size(): for i in cell_values.size():
cell_values[i].v += by * 0.01 cell_values[i].v += by * 0.005
_set_stored_value(_stored_value) _set_stored_value(_stored_value)
sheet.set_edited_cells_values(cell_values) sheet.set_edited_cells_values(cell_values)
@ -119,4 +119,4 @@ func update_cell_values():
for i in values.size(): for i in values.size():
values[i] = _stored_value values[i] = _stored_value
sheet.set_edited_cells_values(values, true) sheet.set_edited_cells_values(values)