You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
refactor sync in AnimationTree
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user