diff options
author | Silc Renew <tokage.it.lab@gmail.com> | 2022-06-29 15:35:29 +0900 |
---|---|---|
committer | Silc Renew <tokage.it.lab@gmail.com> | 2022-07-16 21:45:32 +0900 |
commit | 9be288edf9475d4e85b533dd4681bbccd471f6d5 (patch) | |
tree | 4934526266ca53da407e61820e4c1be802bb6f15 /editor/plugins | |
parent | ae5668f81e9ed7ae9e9a13b120d89de884b718be (diff) |
refactor sync in AnimationTree
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_blend_space_1d_editor.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space_1d_editor.h | 2 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space_2d_editor.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/animation_blend_space_2d_editor.h | 1 |
4 files changed, 25 insertions, 2 deletions
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 248ba021ce..d397c6da67 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -314,6 +314,8 @@ void AnimationNodeBlendSpace1DEditor::_update_space() { max_value->set_value(blend_space->get_max_space()); min_value->set_value(blend_space->get_min_space()); + sync->set_pressed(blend_space->is_using_sync()); + label_value->set_text(blend_space->get_value_label()); snap_value->set_value(blend_space->get_snap()); @@ -329,13 +331,15 @@ void AnimationNodeBlendSpace1DEditor::_config_changed(double) { } updating = true; - undo_redo->create_action(TTR("Change BlendSpace1D Limits")); + undo_redo->create_action(TTR("Change BlendSpace1D Config")); undo_redo->add_do_method(blend_space.ptr(), "set_max_space", max_value->get_value()); undo_redo->add_undo_method(blend_space.ptr(), "set_max_space", blend_space->get_max_space()); undo_redo->add_do_method(blend_space.ptr(), "set_min_space", min_value->get_value()); undo_redo->add_undo_method(blend_space.ptr(), "set_min_space", blend_space->get_min_space()); undo_redo->add_do_method(blend_space.ptr(), "set_snap", snap_value->get_value()); undo_redo->add_undo_method(blend_space.ptr(), "set_snap", blend_space->get_snap()); + undo_redo->add_do_method(blend_space.ptr(), "set_use_sync", sync->is_pressed()); + undo_redo->add_undo_method(blend_space.ptr(), "set_use_sync", blend_space->is_using_sync()); undo_redo->add_do_method(this, "_update_space"); undo_redo->add_undo_method(this, "_update_space"); undo_redo->commit_action(); @@ -650,6 +654,12 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { snap_value->set_step(0.01); snap_value->set_max(1000); + top_hb->add_child(memnew(VSeparator)); + top_hb->add_child(memnew(Label(TTR("Sync:")))); + sync = memnew(CheckBox); + top_hb->add_child(sync); + sync->connect("toggled", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_config_changed)); + edit_hb = memnew(HBoxContainer); top_hb->add_child(edit_hb); edit_hb->add_child(memnew(VSeparator)); diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h index 2f7dee65fc..3488b4bf30 100644 --- a/editor/plugins/animation_blend_space_1d_editor.h +++ b/editor/plugins/animation_blend_space_1d_editor.h @@ -61,6 +61,8 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin { SpinBox *max_value = nullptr; SpinBox *min_value = nullptr; + CheckBox *sync = nullptr; + HBoxContainer *edit_hb = nullptr; SpinBox *edit_value = nullptr; Button *open_editor = nullptr; diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index dfde63ecb6..51aaa4f010 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -595,6 +595,7 @@ void AnimationNodeBlendSpace2DEditor::_update_space() { auto_triangles->set_pressed(blend_space->get_auto_triangles()); + sync->set_pressed(blend_space->is_using_sync()); interpolation->select(blend_space->get_blend_mode()); max_x_value->set_value(blend_space->get_max_space().x); @@ -620,13 +621,15 @@ void AnimationNodeBlendSpace2DEditor::_config_changed(double) { } updating = true; - undo_redo->create_action(TTR("Change BlendSpace2D Limits")); + undo_redo->create_action(TTR("Change BlendSpace2D Config")); undo_redo->add_do_method(blend_space.ptr(), "set_max_space", Vector2(max_x_value->get_value(), max_y_value->get_value())); undo_redo->add_undo_method(blend_space.ptr(), "set_max_space", blend_space->get_max_space()); undo_redo->add_do_method(blend_space.ptr(), "set_min_space", Vector2(min_x_value->get_value(), min_y_value->get_value())); undo_redo->add_undo_method(blend_space.ptr(), "set_min_space", blend_space->get_min_space()); undo_redo->add_do_method(blend_space.ptr(), "set_snap", Vector2(snap_x->get_value(), snap_y->get_value())); undo_redo->add_undo_method(blend_space.ptr(), "set_snap", blend_space->get_snap()); + undo_redo->add_do_method(blend_space.ptr(), "set_use_sync", sync->is_pressed()); + undo_redo->add_undo_method(blend_space.ptr(), "set_use_sync", blend_space->is_using_sync()); undo_redo->add_do_method(blend_space.ptr(), "set_blend_mode", interpolation->get_selected()); undo_redo->add_undo_method(blend_space.ptr(), "set_blend_mode", blend_space->get_blend_mode()); undo_redo->add_do_method(this, "_update_space"); @@ -899,6 +902,13 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(memnew(VSeparator)); + top_hb->add_child(memnew(Label(TTR("Sync:")))); + sync = memnew(CheckBox); + top_hb->add_child(sync); + sync->connect("toggled", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_config_changed)); + + top_hb->add_child(memnew(VSeparator)); + top_hb->add_child(memnew(Label(TTR("Blend:")))); interpolation = memnew(OptionButton); top_hb->add_child(interpolation); diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h index db54e84254..88b9072599 100644 --- a/editor/plugins/animation_blend_space_2d_editor.h +++ b/editor/plugins/animation_blend_space_2d_editor.h @@ -55,6 +55,7 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin { Button *snap = nullptr; SpinBox *snap_x = nullptr; SpinBox *snap_y = nullptr; + CheckBox *sync = nullptr; OptionButton *interpolation = nullptr; Button *auto_triangles = nullptr; |