diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/animation_blend_space_2d_editor.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space_2d_editor.h | 2 | ||||
-rw-r--r-- | editor/plugins/polygon_2d_editor_plugin.cpp | 21 |
3 files changed, 23 insertions, 9 deletions
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 664e3e8b7f..038e2d0b3e 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -47,11 +47,19 @@ bool AnimationNodeBlendSpace2DEditor::can_edit(const Ref<AnimationNode> &p_node) return bs2d.is_valid(); } +void AnimationNodeBlendSpace2DEditor::_blend_space_changed() { + blend_space_draw->update(); +} + void AnimationNodeBlendSpace2DEditor::edit(const Ref<AnimationNode> &p_node) { + if (blend_space.is_valid()) { + blend_space->disconnect("triangles_updated", this, "_blend_space_changed"); + } blend_space = p_node; if (!blend_space.is_null()) { + blend_space->connect("triangles_updated", this, "_blend_space_changed"); _update_space(); } } @@ -837,6 +845,7 @@ void AnimationNodeBlendSpace2DEditor::_bind_methods() { ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpace2DEditor::_removed_from_graph); ClassDB::bind_method("_auto_triangles_toggled", &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled); + ClassDB::bind_method("_blend_space_changed", &AnimationNodeBlendSpace2DEditor::_blend_space_changed); ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace2DEditor::_file_opened); } diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h index 3c128a6ef9..74186791e1 100644 --- a/editor/plugins/animation_blend_space_2d_editor.h +++ b/editor/plugins/animation_blend_space_2d_editor.h @@ -138,6 +138,8 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin { MENU_LOAD_FILE_CONFIRM = 1002 }; + void _blend_space_changed(); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index a2873fe7d7..93d262f874 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -665,9 +665,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { //todo, could check whether it already exists? polygons.push_back(polygon_create); - undo_redo->create_action(TTR("Add Polygon")); + undo_redo->create_action(TTR("Add Custom Polygon")); undo_redo->add_do_method(node, "set_polygons", polygons); - undo_redo->add_undo_method(node, "set_polygons", polygons_prev); + undo_redo->add_undo_method(node, "set_polygons", node->get_polygons()); undo_redo->add_do_method(uv_edit_draw, "update"); undo_redo->add_undo_method(uv_edit_draw, "update"); undo_redo->commit_action(); @@ -705,9 +705,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { if (erase_index != -1) { polygons.remove(erase_index); - undo_redo->create_action(TTR("Remove Polygon")); + undo_redo->create_action(TTR("Remove Custom Polygon")); undo_redo->add_do_method(node, "set_polygons", polygons); - undo_redo->add_undo_method(node, "set_polygons", polygons_prev); + undo_redo->add_undo_method(node, "set_polygons", node->get_polygons()); undo_redo->add_do_method(uv_edit_draw, "update"); undo_redo->add_undo_method(uv_edit_draw, "update"); undo_redo->commit_action(); @@ -735,18 +735,21 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) { } else 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->add_do_method(node, "set_uv", node->get_uv()); undo_redo->add_undo_method(node, "set_uv", points_prev); - } else if (uv_edit_mode[1]->is_pressed()) { //edit polygon + 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(); } - undo_redo->add_do_method(uv_edit_draw, "update"); - undo_redo->add_undo_method(uv_edit_draw, "update"); - undo_redo->commit_action(); uv_drag = false; } else if (bone_painting) { |