mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Merge pull request #44892 from KoBeWi/gentle_drag
Commit CanvasItem state only if it changed
This commit is contained in:
commit
0abd7e7b35
@ -963,8 +963,23 @@ void CanvasItemEditor::_restore_canvas_item_state(List<CanvasItem *> p_canvas_it
|
||||
}
|
||||
|
||||
void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_items, String action_name, bool commit_bones) {
|
||||
undo_redo->create_action(action_name);
|
||||
List<CanvasItem *> modified_canvas_items;
|
||||
for (List<CanvasItem *>::Element *E = p_canvas_items.front(); E; E = E->next()) {
|
||||
CanvasItem *canvas_item = E->get();
|
||||
Dictionary old_state = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item)->undo_state;
|
||||
Dictionary new_state = canvas_item->_edit_get_state();
|
||||
|
||||
if (old_state.hash() != new_state.hash()) {
|
||||
modified_canvas_items.push_back(canvas_item);
|
||||
}
|
||||
}
|
||||
|
||||
if (modified_canvas_items.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
undo_redo->create_action(action_name);
|
||||
for (List<CanvasItem *>::Element *E = modified_canvas_items.front(); E; E = E->next()) {
|
||||
CanvasItem *canvas_item = E->get();
|
||||
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
|
||||
undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state());
|
||||
|
Loading…
Reference in New Issue
Block a user