mirror of
https://github.com/Relintai/godot-resources-as-sheets-plugin.git
synced 2024-11-10 10:12:08 +01:00
Change Inspector edits to be undoable
This commit is contained in:
parent
ae3c71e52d
commit
07eb43b836
@ -292,9 +292,7 @@ func deselect_cell(cell : Control):
|
|||||||
func select_cell(cell : Control):
|
func select_cell(cell : Control):
|
||||||
var column_index := _get_cell_column(cell)
|
var column_index := _get_cell_column(cell)
|
||||||
if _can_select_cell(cell):
|
if _can_select_cell(cell):
|
||||||
column_editors[column_index].set_selected(cell, true)
|
_add_cell_to_selection(cell)
|
||||||
edited_cells.append(cell)
|
|
||||||
edit_cursor_positions.append(column_editors[column_index].get_text_length(cell))
|
|
||||||
_try_open_docks(cell)
|
_try_open_docks(cell)
|
||||||
inspector_resource = rows[_get_cell_row(cell)].duplicate()
|
inspector_resource = rows[_get_cell_row(cell)].duplicate()
|
||||||
editor_plugin.get_editor_interface().edit_resource(inspector_resource)
|
editor_plugin.get_editor_interface().edit_resource(inspector_resource)
|
||||||
@ -321,6 +319,12 @@ func select_cell(cell : Control):
|
|||||||
edit_cursor_positions.append(column_editors[column_index].get_text_length(cur_cell))
|
edit_cursor_positions.append(column_editors[column_index].get_text_length(cur_cell))
|
||||||
|
|
||||||
|
|
||||||
|
func _add_cell_to_selection(cell : Control):
|
||||||
|
column_editors[_get_cell_column(cell)].set_selected(cell, true)
|
||||||
|
edited_cells.append(cell)
|
||||||
|
edit_cursor_positions.append(column_editors[_get_cell_column(cell)].get_text_length(cell))
|
||||||
|
|
||||||
|
|
||||||
func _try_open_docks(cell : Control):
|
func _try_open_docks(cell : Control):
|
||||||
var column_index = _get_cell_column(cell)
|
var column_index = _get_cell_column(cell)
|
||||||
for x in get_node(path_property_editors).get_children():
|
for x in get_node(path_property_editors).get_children():
|
||||||
@ -613,9 +617,20 @@ func _on_inspector_property_edited(property : String):
|
|||||||
if inspector_resource == null: return
|
if inspector_resource == null: return
|
||||||
|
|
||||||
var value = inspector_resource.get(property)
|
var value = inspector_resource.get(property)
|
||||||
for x in edited_cells:
|
var values = []
|
||||||
rows[_get_cell_row(x)].set(property, value)
|
values.resize(edited_cells.size())
|
||||||
_update_row(_get_cell_row(x))
|
for i in edited_cells.size():
|
||||||
|
values[i] = value
|
||||||
|
|
||||||
# Resources could stop being null, sooooo...
|
var previously_edited = edited_cells
|
||||||
|
if columns[_get_cell_column(edited_cells[0])] != property:
|
||||||
|
previously_edited = previously_edited.duplicate()
|
||||||
|
var new_column := columns.find(property)
|
||||||
|
deselect_all_cells()
|
||||||
|
var index := 0
|
||||||
|
for i in previously_edited.size():
|
||||||
|
index = (_get_cell_row(previously_edited[i]) + 1) * columns.size() + new_column
|
||||||
|
_add_cell_to_selection(get_node(path_table_root).get_child(index))
|
||||||
|
|
||||||
|
set_edited_cells_values(values)
|
||||||
_try_open_docks(edited_cells[0])
|
_try_open_docks(edited_cells[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user