summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-07-04 01:43:29 +0200
committerGitHub <noreply@github.com>2020-07-04 01:43:29 +0200
commitb51418842ae684ea201247c6df32092d784e6db0 (patch)
tree4e69f92d7a46ffa247f383ce433f9202d9bc4429 /editor/plugins
parent73fddc623bdd58b762c8db328ee59055fc2a33ed (diff)
parent6e60aa38763eb3dbed9e319d45eb179b1fb1876f (diff)
Merge pull request #39845 from mrushyendra/bone_painting_undoredo_master
Fix undo/redo for bone painting in Polygon2D UV Editor
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index 633863041f..dd1194d020 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -728,35 +728,37 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
bone_painting_bone = bone_selected;
}
}
+ } else {
+ if (uv_drag && !uv_create) {
+ if (uv_edit_mode[0]->is_pressed()) { // Edit UV.
+ undo_redo->create_action(TTR("Transform UV Map"));
+ undo_redo->add_do_method(node, "set_uv", node->get_uv());
+ undo_redo->add_undo_method(node, "set_uv", points_prev);
+ undo_redo->add_do_method(uv_edit_draw, "update");
+ undo_redo->add_undo_method(uv_edit_draw, "update");
+ undo_redo->commit_action();
+ } else if (uv_edit_mode[1]->is_pressed() && uv_move_current == UV_MODE_EDIT_POINT) { // Edit polygon.
+ undo_redo->create_action(TTR("Transform Polygon"));
+ undo_redo->add_do_method(node, "set_polygon", node->get_polygon());
+ undo_redo->add_undo_method(node, "set_polygon", points_prev);
+ undo_redo->add_do_method(uv_edit_draw, "update");
+ undo_redo->add_undo_method(uv_edit_draw, "update");
+ undo_redo->commit_action();
+ }
- } else if (uv_drag && !uv_create) {
- if (uv_edit_mode[0]->is_pressed()) { // Edit UV.
- undo_redo->create_action(TTR("Transform UV Map"));
- undo_redo->add_do_method(node, "set_uv", node->get_uv());
- undo_redo->add_undo_method(node, "set_uv", points_prev);
- undo_redo->add_do_method(uv_edit_draw, "update");
- undo_redo->add_undo_method(uv_edit_draw, "update");
- undo_redo->commit_action();
- } else if (uv_edit_mode[1]->is_pressed() && uv_move_current == UV_MODE_EDIT_POINT) { // Edit polygon.
- undo_redo->create_action(TTR("Transform Polygon"));
- undo_redo->add_do_method(node, "set_polygon", node->get_polygon());
- undo_redo->add_undo_method(node, "set_polygon", points_prev);
+ uv_drag = false;
+ }
+
+ if (bone_painting) {
+ 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_undo_method(node, "set_bone_weights", bone_painting_bone, prev_weights);
undo_redo->add_do_method(uv_edit_draw, "update");
undo_redo->add_undo_method(uv_edit_draw, "update");
undo_redo->commit_action();
+ bone_painting = false;
}
-
- uv_drag = false;
- } else if (bone_painting) {
- 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_undo_method(node, "set_bone_weights", bone_painting_bone, prev_weights);
- undo_redo->add_do_method(uv_edit_draw, "update");
- undo_redo->add_undo_method(uv_edit_draw, "update");
- undo_redo->commit_action();
- bone_painting = false;
}
-
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
_cancel_editing();