|
@@ -653,26 +653,23 @@ void AnimationPlayerEditor::_blend_editor_next_changed(const int p_idx) {
|
|
|
undo_redo->commit_action();
|
|
|
}
|
|
|
|
|
|
-void AnimationPlayerEditor::_animation_blend() {
|
|
|
- if (updating_blends) {
|
|
|
+void AnimationPlayerEditor::_edit_animation_blend() {
|
|
|
+ if (updating_blends || !animation->has_selectable_items()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- blend_editor.tree->clear();
|
|
|
+ blend_editor.dialog->popup_centered(Size2(400, 400) * EDSCALE);
|
|
|
+ _update_animation_blend();
|
|
|
+}
|
|
|
|
|
|
- if (!animation->has_selectable_items()) {
|
|
|
+void AnimationPlayerEditor::_update_animation_blend() {
|
|
|
+ if (updating_blends || !animation->has_selectable_items()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- String current = animation->get_item_text(animation->get_selected());
|
|
|
-
|
|
|
- blend_editor.dialog->popup_centered(Size2(400, 400) * EDSCALE);
|
|
|
+ blend_editor.tree->clear();
|
|
|
|
|
|
- blend_editor.tree->set_hide_root(true);
|
|
|
- blend_editor.tree->set_column_expand_ratio(0, 10);
|
|
|
- blend_editor.tree->set_column_clip_content(0, true);
|
|
|
- blend_editor.tree->set_column_expand_ratio(1, 3);
|
|
|
- blend_editor.tree->set_column_clip_content(1, true);
|
|
|
+ String current = animation->get_item_text(animation->get_selected());
|
|
|
|
|
|
List<StringName> anims;
|
|
|
player->get_animation_list(&anims);
|
|
@@ -711,21 +708,17 @@ void AnimationPlayerEditor::_animation_blend() {
|
|
|
}
|
|
|
|
|
|
void AnimationPlayerEditor::_blend_edited() {
|
|
|
- if (updating_blends) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (!animation->has_selectable_items()) {
|
|
|
+ if (updating_blends || !animation->has_selectable_items()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- String current = animation->get_item_text(animation->get_selected());
|
|
|
-
|
|
|
TreeItem *selected = blend_editor.tree->get_edited();
|
|
|
if (!selected) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ String current = animation->get_item_text(animation->get_selected());
|
|
|
+
|
|
|
updating_blends = true;
|
|
|
String to = selected->get_text(0);
|
|
|
float blend_time = selected->get_range(1);
|
|
@@ -1277,9 +1270,11 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value, bool p_set, bool
|
|
|
|
|
|
void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) {
|
|
|
_update_player();
|
|
|
+
|
|
|
if (blend_editor.dialog->is_visible()) {
|
|
|
- _animation_blend(); // Update.
|
|
|
+ _update_animation_blend(); // Update.
|
|
|
}
|
|
|
+
|
|
|
if (library_editor->is_visible()) {
|
|
|
library_editor->update_tree();
|
|
|
}
|
|
@@ -1366,7 +1361,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
|
|
|
_animation_rename();
|
|
|
} break;
|
|
|
case TOOL_EDIT_TRANSITIONS: {
|
|
|
- _animation_blend();
|
|
|
+ _edit_animation_blend();
|
|
|
} break;
|
|
|
case TOOL_REMOVE_ANIM: {
|
|
|
_animation_remove();
|
|
@@ -1802,17 +1797,8 @@ bool AnimationPlayerEditor::_validate_tracks(const Ref<Animation> p_anim) {
|
|
|
}
|
|
|
|
|
|
void AnimationPlayerEditor::_bind_methods() {
|
|
|
- ClassDB::bind_method(D_METHOD("_animation_new"), &AnimationPlayerEditor::_animation_new);
|
|
|
- ClassDB::bind_method(D_METHOD("_animation_rename"), &AnimationPlayerEditor::_animation_rename);
|
|
|
- ClassDB::bind_method(D_METHOD("_animation_remove"), &AnimationPlayerEditor::_animation_remove);
|
|
|
- ClassDB::bind_method(D_METHOD("_animation_blend"), &AnimationPlayerEditor::_animation_blend);
|
|
|
- ClassDB::bind_method(D_METHOD("_animation_edit"), &AnimationPlayerEditor::_animation_edit);
|
|
|
- ClassDB::bind_method(D_METHOD("_animation_resource_edit"), &AnimationPlayerEditor::_animation_resource_edit);
|
|
|
+ // Needed for UndoRedo.
|
|
|
ClassDB::bind_method(D_METHOD("_animation_player_changed"), &AnimationPlayerEditor::_animation_player_changed);
|
|
|
- ClassDB::bind_method(D_METHOD("_animation_libraries_updated"), &AnimationPlayerEditor::_animation_libraries_updated);
|
|
|
- ClassDB::bind_method(D_METHOD("_list_changed"), &AnimationPlayerEditor::_list_changed);
|
|
|
- ClassDB::bind_method(D_METHOD("_animation_duplicate"), &AnimationPlayerEditor::_animation_duplicate);
|
|
|
-
|
|
|
ClassDB::bind_method(D_METHOD("_start_onion_skinning"), &AnimationPlayerEditor::_start_onion_skinning);
|
|
|
ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning);
|
|
|
|
|
@@ -1833,11 +1819,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
|
|
plugin = p_plugin;
|
|
|
singleton = this;
|
|
|
|
|
|
- updating = false;
|
|
|
-
|
|
|
set_focus_mode(FOCUS_ALL);
|
|
|
-
|
|
|
- player = nullptr;
|
|
|
+ set_process_shortcut_input(true);
|
|
|
|
|
|
HBoxContainer *hb = memnew(HBoxContainer);
|
|
|
add_child(hb);
|
|
@@ -1921,7 +1904,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
|
|
hb->add_child(memnew(VSeparator));
|
|
|
|
|
|
track_editor = memnew(AnimationTrackEditor);
|
|
|
-
|
|
|
hb->add_child(track_editor->get_edit_menu());
|
|
|
|
|
|
hb->add_child(memnew(VSeparator));
|
|
@@ -1992,21 +1974,27 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
|
|
name_dialog->connect(SNAME("confirmed"), callable_mp(this, &AnimationPlayerEditor::_animation_name_edited));
|
|
|
|
|
|
blend_editor.dialog = memnew(AcceptDialog);
|
|
|
- add_child(blend_editor.dialog);
|
|
|
+ blend_editor.dialog->set_title(TTR("Cross-Animation Blend Times"));
|
|
|
blend_editor.dialog->set_ok_button_text(TTR("Close"));
|
|
|
blend_editor.dialog->set_hide_on_ok(true);
|
|
|
+ add_child(blend_editor.dialog);
|
|
|
+
|
|
|
VBoxContainer *blend_vb = memnew(VBoxContainer);
|
|
|
blend_editor.dialog->add_child(blend_vb);
|
|
|
+
|
|
|
blend_editor.tree = memnew(Tree);
|
|
|
+ blend_editor.tree->set_hide_root(true);
|
|
|
blend_editor.tree->set_columns(2);
|
|
|
+ blend_editor.tree->set_column_expand_ratio(0, 10);
|
|
|
+ blend_editor.tree->set_column_clip_content(0, true);
|
|
|
+ blend_editor.tree->set_column_expand_ratio(1, 3);
|
|
|
+ blend_editor.tree->set_column_clip_content(1, true);
|
|
|
blend_vb->add_margin_child(TTR("Blend Times:"), blend_editor.tree, true);
|
|
|
+ blend_editor.tree->connect(SNAME("item_edited"), callable_mp(this, &AnimationPlayerEditor::_blend_edited));
|
|
|
+
|
|
|
blend_editor.next = memnew(OptionButton);
|
|
|
blend_editor.next->set_auto_translate(false);
|
|
|
blend_vb->add_margin_child(TTR("Next (Auto Queue):"), blend_editor.next);
|
|
|
- blend_editor.dialog->set_title(TTR("Cross-Animation Blend Times"));
|
|
|
- updating_blends = false;
|
|
|
-
|
|
|
- blend_editor.tree->connect(SNAME("item_edited"), callable_mp(this, &AnimationPlayerEditor::_blend_edited));
|
|
|
|
|
|
autoplay->connect(SNAME("pressed"), callable_mp(this, &AnimationPlayerEditor::_autoplay_pressed));
|
|
|
autoplay->set_toggle_mode(true);
|
|
@@ -2021,11 +2009,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
|
|
|
frame->connect(SNAME("value_changed"), callable_mp(this, &AnimationPlayerEditor::_seek_value_changed).bind(true, false));
|
|
|
scale->connect(SNAME("text_submitted"), callable_mp(this, &AnimationPlayerEditor::_scale_changed));
|
|
|
|
|
|
- last_active = false;
|
|
|
- timeline_position = 0;
|
|
|
-
|
|
|
- set_process_shortcut_input(true);
|
|
|
-
|
|
|
add_child(track_editor);
|
|
|
track_editor->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
track_editor->connect(SNAME("timeline_changed"), callable_mp(this, &AnimationPlayerEditor::_animation_key_editor_seek));
|