1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Disable Open in Inspector when there is no animation

This commit is contained in:
Haoyu Qiu
2022-04-08 09:31:19 +08:00
parent 5974e1432e
commit 2b97020543

View File

@@ -783,6 +783,7 @@ void AnimationPlayerEditor::_update_player() {
ITEM_CHECK_DISABLED(TOOL_RENAME_ANIM); ITEM_CHECK_DISABLED(TOOL_RENAME_ANIM);
ITEM_CHECK_DISABLED(TOOL_EDIT_TRANSITIONS); ITEM_CHECK_DISABLED(TOOL_EDIT_TRANSITIONS);
ITEM_CHECK_DISABLED(TOOL_REMOVE_ANIM); ITEM_CHECK_DISABLED(TOOL_REMOVE_ANIM);
ITEM_CHECK_DISABLED(TOOL_EDIT_RESOURCE);
#undef ITEM_CHECK_DISABLED #undef ITEM_CHECK_DISABLED
@@ -1079,15 +1080,9 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
_animation_remove(); _animation_remove();
} break; } break;
case TOOL_EDIT_RESOURCE: { case TOOL_EDIT_RESOURCE: {
if (!animation->has_selectable_items()) { if (anim.is_valid()) {
error_dialog->set_text(TTR("No animation to edit!")); EditorNode::get_singleton()->edit_resource(anim);
error_dialog->popup_centered();
return;
} }
String current2 = animation->get_item_text(animation->get_selected());
Ref<Animation> anim2 = player->get_animation(current2);
EditorNode::get_singleton()->edit_resource(anim2);
} break; } break;
} }
} }