Merge pull request #28323 from homer666/animationplayer-imported-anim-warning
Warn when opening imported anim in Animation editor
This commit is contained in:
commit
e98ccaefe8
2 changed files with 30 additions and 0 deletions
|
@ -2547,6 +2547,15 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim) {
|
|||
step->set_read_only(false);
|
||||
snap->set_disabled(false);
|
||||
snap_mode->set_disabled(false);
|
||||
|
||||
imported_anim_warning->hide();
|
||||
for (int i = 0; i < animation->get_track_count(); i++) {
|
||||
if (animation->track_is_imported(i)) {
|
||||
imported_anim_warning->show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
hscroll->hide();
|
||||
edit->set_disabled(true);
|
||||
|
@ -3616,6 +3625,7 @@ void AnimationTrackEditor::_notification(int p_what) {
|
|||
snap->set_icon(get_icon("Snap", "EditorIcons"));
|
||||
view_group->set_icon(get_icon(view_group->is_pressed() ? "AnimationTrackList" : "AnimationTrackGroup", "EditorIcons"));
|
||||
selected_filter->set_icon(get_icon("AnimationFilter", "EditorIcons"));
|
||||
imported_anim_warning->set_icon(get_icon("NodeWarning", "EditorIcons"));
|
||||
main_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
}
|
||||
|
||||
|
@ -4909,6 +4919,15 @@ float AnimationTrackEditor::snap_time(float p_value) {
|
|||
return p_value;
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_show_imported_anim_warning() const {
|
||||
|
||||
EditorNode::get_singleton()->show_warning(TTR("This animation belongs to an imported scene, so changes to imported tracks will not be saved.\n\n"
|
||||
"To enable the ability to add custom tracks, navigate to the scene's import settings and set\n"
|
||||
"\"Animation > Storage\" to \"Files\", enable \"Animation > Keep Custom Tracks\", then re-import.\n"
|
||||
"Alternatively, use an import preset that imports animations to separate files."),
|
||||
TTR("Warning: Editing imported animation"));
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method("_animation_changed", &AnimationTrackEditor::_animation_changed);
|
||||
|
@ -4947,6 +4966,7 @@ void AnimationTrackEditor::_bind_methods() {
|
|||
ClassDB::bind_method("_view_group_toggle", &AnimationTrackEditor::_view_group_toggle);
|
||||
ClassDB::bind_method("_selection_changed", &AnimationTrackEditor::_selection_changed);
|
||||
ClassDB::bind_method("_snap_mode_changed", &AnimationTrackEditor::_snap_mode_changed);
|
||||
ClassDB::bind_method("_show_imported_anim_warning", &AnimationTrackEditor::_show_imported_anim_warning);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
|
||||
ADD_SIGNAL(MethodInfo("keying_changed"));
|
||||
|
@ -5017,6 +5037,13 @@ AnimationTrackEditor::AnimationTrackEditor() {
|
|||
//timeline_vbox->add_child(memnew(HSeparator));
|
||||
HBoxContainer *bottom_hb = memnew(HBoxContainer);
|
||||
add_child(bottom_hb);
|
||||
|
||||
imported_anim_warning = memnew(Button);
|
||||
imported_anim_warning->hide();
|
||||
imported_anim_warning->set_tooltip(TTR("Warning: Editing imported animation"));
|
||||
imported_anim_warning->connect("pressed", this, "_show_imported_anim_warning");
|
||||
bottom_hb->add_child(imported_anim_warning);
|
||||
|
||||
bottom_hb->add_spacer();
|
||||
|
||||
selected_filter = memnew(ToolButton);
|
||||
|
|
|
@ -309,6 +309,9 @@ class AnimationTrackEditor : public VBoxContainer {
|
|||
ToolButton *snap;
|
||||
OptionButton *snap_mode;
|
||||
|
||||
Button *imported_anim_warning;
|
||||
void _show_imported_anim_warning() const;
|
||||
|
||||
void _snap_mode_changed(int p_mode);
|
||||
Vector<AnimationTrackEdit *> track_edits;
|
||||
Vector<AnimationTrackEditGroup *> groups;
|
||||
|
|
Loading…
Reference in a new issue