mirror of
https://github.com/Relintai/godot-resources-as-sheets-plugin.git
synced 2024-11-10 10:12:08 +01:00
Fix table breaking when columns added/removed
This commit is contained in:
parent
3c3b16970f
commit
b78a589b67
@ -94,7 +94,11 @@ func display_folder(folderpath : String, sort_by : String = "", sort_reverse : b
|
||||
if columns.size() == 0: return
|
||||
|
||||
get_node(path_folder_path).text = folderpath
|
||||
_create_table(force_rebuild or current_path != folderpath)
|
||||
_create_table(
|
||||
force_rebuild
|
||||
or current_path != folderpath
|
||||
or columns.size() != get_node(path_columns).get_child_count()
|
||||
)
|
||||
_apply_search_cond()
|
||||
current_path = folderpath
|
||||
yield(get_tree(), "idle_frame")
|
||||
@ -185,7 +189,7 @@ func _create_table(columns_changed : bool):
|
||||
if columns_changed:
|
||||
root_node.columns = columns.size()
|
||||
for x in root_node.get_children():
|
||||
x.queue_free()
|
||||
x.free()
|
||||
|
||||
for x in headers_node.get_children():
|
||||
x.queue_free()
|
||||
@ -202,16 +206,23 @@ func _create_table(columns_changed : bool):
|
||||
root_node.get_child(columns.size()).free()
|
||||
to_free -= 1
|
||||
|
||||
var color_rows = ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "color_rows")
|
||||
for i in rows.size():
|
||||
_update_row(i, ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "color_rows"))
|
||||
_update_row(i, color_rows)
|
||||
|
||||
_update_column_sizes()
|
||||
|
||||
|
||||
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 column_headers := get_node(path_columns).get_children()
|
||||
|
||||
if table_root.get_child_count() < column_headers.size(): return
|
||||
if column_headers.size() != columns.size():
|
||||
display_folder(current_path, sorting_by, sorting_reverse, true)
|
||||
return
|
||||
|
||||
var clip_text : bool = ProjectSettings.get_setting(SettingsGrid.SETTING_PREFIX + "clip_headers")
|
||||
var min_width := 0
|
||||
var cell : Control
|
||||
@ -232,6 +243,7 @@ func _update_column_sizes():
|
||||
column_headers[i].rect_size.x = min_width
|
||||
|
||||
get_node(path_columns).queue_sort()
|
||||
table_root.queue_sort()
|
||||
|
||||
|
||||
func _update_row(row_index : int, color_rows : bool = true):
|
||||
@ -651,6 +663,7 @@ func set_cell(cell, value):
|
||||
if columns[column] == "resource_path":
|
||||
return
|
||||
|
||||
print(cell)
|
||||
column_editors[column].set_value(cell, value)
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ color_arrays=true
|
||||
|
||||
resources_spreadsheet_view/color_rows=true
|
||||
resources_spreadsheet_view/color_arrays=true
|
||||
resources_spreadsheet_view/clip_headers=true
|
||||
resources_spreadsheet_view/clip_headers=false
|
||||
resources_spreadsheet_view/dupe_arrays=true
|
||||
resources_spreadsheet_view/array_min_width=128.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user