summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-04-12 08:49:35 +0200
committerGitHub <noreply@github.com>2022-04-12 08:49:35 +0200
commit0002af9732062f580898d934549ac09eb3f8725b (patch)
treedde9e6f47d464d75c73be360ec9737ffaa23d4bb
parent35d2efcc5eee8e30d81223f2d4cb39181e53aed2 (diff)
parent2b97020543a53cc904231f32b25f403933b815ac (diff)
Merge pull request #60009 from timothyqiu/disable-item
Disable "Open in Inspector" when there is no animation
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 2081edca25..17a1bd1048 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -783,6 +783,7 @@ void AnimationPlayerEditor::_update_player() {
ITEM_CHECK_DISABLED(TOOL_RENAME_ANIM);
ITEM_CHECK_DISABLED(TOOL_EDIT_TRANSITIONS);
ITEM_CHECK_DISABLED(TOOL_REMOVE_ANIM);
+ ITEM_CHECK_DISABLED(TOOL_EDIT_RESOURCE);
#undef ITEM_CHECK_DISABLED
@@ -1079,15 +1080,9 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
_animation_remove();
} break;
case TOOL_EDIT_RESOURCE: {
- if (!animation->has_selectable_items()) {
- error_dialog->set_text(TTR("No animation to edit!"));
- error_dialog->popup_centered();
- return;
+ if (anim.is_valid()) {
+ EditorNode::get_singleton()->edit_resource(anim);
}
-
- String current2 = animation->get_item_text(animation->get_selected());
- Ref<Animation> anim2 = player->get_animation(current2);
- EditorNode::get_singleton()->edit_resource(anim2);
} break;
}
}