Fix undo/redo for bone painting in Polygon2D UV Editor
Fix to ensure that undo/redo works when painting bones in the Polygon2D
UV editor. Previously, bone painting would continue silently in the
background, because a mouse click signalling the end of an edit would
not be appropriately dealt with.
(cherry picked from commit 6e60aa3876
)
This commit is contained in:
parent
9890189155
commit
68526da5f2
1 changed files with 27 additions and 27 deletions
|
@ -758,9 +758,8 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
bone_painting_bone = bone_selected;
|
bone_painting_bone = bone_selected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
} else if (uv_drag && !uv_create) {
|
if (uv_drag && !uv_create) {
|
||||||
|
|
||||||
if (uv_edit_mode[0]->is_pressed()) { // Edit UV.
|
if (uv_edit_mode[0]->is_pressed()) { // Edit UV.
|
||||||
undo_redo->create_action(TTR("Transform UV Map"));
|
undo_redo->create_action(TTR("Transform UV Map"));
|
||||||
undo_redo->add_do_method(node, "set_uv", node->get_uv());
|
undo_redo->add_do_method(node, "set_uv", node->get_uv());
|
||||||
|
@ -778,8 +777,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uv_drag = false;
|
uv_drag = false;
|
||||||
} else if (bone_painting) {
|
}
|
||||||
|
|
||||||
|
if (bone_painting) {
|
||||||
undo_redo->create_action(TTR("Paint Bone Weights"));
|
undo_redo->create_action(TTR("Paint Bone Weights"));
|
||||||
undo_redo->add_do_method(node, "set_bone_weights", bone_painting_bone, node->get_bone_weights(bone_painting_bone));
|
undo_redo->add_do_method(node, "set_bone_weights", bone_painting_bone, node->get_bone_weights(bone_painting_bone));
|
||||||
undo_redo->add_undo_method(node, "set_bone_weights", bone_painting_bone, prev_weights);
|
undo_redo->add_undo_method(node, "set_bone_weights", bone_painting_bone, prev_weights);
|
||||||
|
@ -788,7 +788,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
bone_painting = false;
|
bone_painting = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
|
|
||||||
_cancel_editing();
|
_cancel_editing();
|
||||||
|
|
Loading…
Reference in a new issue