void ShaderEditor::_make_context_menu(bool p_selection) {

	context_menu->clear();
	if (p_selection) {
		context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"), EDIT_CUT);
		context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"), EDIT_COPY);
	}

	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/paste"), EDIT_PASTE);
	context_menu->add_separator();
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"), EDIT_SELECT_ALL);
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);

	context_menu->add_separator();
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);

	context_menu->set_position(get_global_transform().xform(get_local_mouse_position()));
	context_menu->set_size(Vector2(1, 1));
	context_menu->popup();
}
示例#2
0
ScriptTextEditor::ScriptTextEditor() {

	code_editor = memnew( CodeTextEditor );
	add_child(code_editor);
	code_editor->set_area_as_parent_rect();
	code_editor->connect("validate_script",this,"_validate_script");
	code_editor->connect("load_theme_settings",this,"_load_theme_settings");
	code_editor->set_code_complete_func(_code_complete_scripts,this);
	code_editor->get_text_edit()->connect("breakpoint_toggled", this, "_breakpoint_toggled");

	code_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file"));
	code_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
	code_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size"));
	code_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs"));
	code_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers"));
	code_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting"));
	code_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences"));
	code_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink"));
	code_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed"));
	code_editor->get_text_edit()->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter"));
	code_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret"));
	code_editor->get_text_edit()->set_callhint_settings(
		EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"),
		EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset"));

	edit_hb = memnew (HBoxContainer);

	edit_menu = memnew( MenuButton );
	edit_menu->set_text(TTR("Edit"));
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"), EDIT_CUT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"), EDIT_COPY);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/paste"), EDIT_PASTE);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"), EDIT_SELECT_ALL);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_up"), EDIT_MOVE_LINE_UP);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN);
	edit_menu->get_popup()->add_separator();
#ifdef OSX_ENABLED
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE);
#else
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE);
#endif
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/auto_indent"), EDIT_AUTO_INDENT);
	edit_menu->get_popup()->connect("item_pressed", this,"_edit_option");
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_breakpoint"), DEBUG_TOGGLE_BREAKPOINT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_breakpoints"), DEBUG_REMOVE_ALL_BREAKPOINTS);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_breakpoint"), DEBUG_GOTO_NEXT_BREAKPOINT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_breakpoint"), DEBUG_GOTO_PREV_BREAKPOINT);

	search_menu = memnew( MenuButton );
	edit_hb->add_child(search_menu);
	search_menu->set_text(TTR("Search"));
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
	search_menu->get_popup()->add_separator();
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_function"), SEARCH_LOCATE_FUNCTION);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE);
	search_menu->get_popup()->add_separator();
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/contextual_help"), HELP_CONTEXTUAL);

	search_menu->get_popup()->connect("item_pressed", this,"_edit_option");

	edit_hb->add_child(edit_menu);

	quick_open = memnew( ScriptEditorQuickOpen );
	add_child(quick_open);
	quick_open->connect("goto_line",this,"_goto_line");

	goto_line_dialog = memnew(GotoLineDialog);
	add_child(goto_line_dialog);
}
ShaderEditor::ShaderEditor(EditorNode *p_node) {

	shader_editor = memnew(ShaderTextEditor);
	shader_editor->set_v_size_flags(SIZE_EXPAND_FILL);
	shader_editor->add_constant_override("separation", 0);
	shader_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);

	shader_editor->connect("script_changed", this, "apply_shaders");
	EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed");

	shader_editor->get_text_edit()->set_callhint_settings(
			EditorSettings::get_singleton()->get("text_editor/completion/put_callhint_tooltip_below_current_line"),
			EditorSettings::get_singleton()->get("text_editor/completion/callhint_tooltip_offset"));

	shader_editor->get_text_edit()->set_select_identifiers_on_hover(true);
	shader_editor->get_text_edit()->set_context_menu_enabled(false);
	shader_editor->get_text_edit()->connect("gui_input", this, "_text_edit_gui_input");

	shader_editor->update_editor_settings();

	context_menu = memnew(PopupMenu);
	add_child(context_menu);
	context_menu->connect("id_pressed", this, "_menu_option");
	context_menu->set_hide_on_window_lose_focus(true);

	VBoxContainer *main_container = memnew(VBoxContainer);
	HBoxContainer *hbc = memnew(HBoxContainer);

	edit_menu = memnew(MenuButton);
	edit_menu->set_text(TTR("Edit"));
	edit_menu->set_switch_on_hover(true);
	edit_menu->get_popup()->set_hide_on_window_lose_focus(true);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"), EDIT_CUT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"), EDIT_COPY);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/paste"), EDIT_PASTE);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"), EDIT_SELECT_ALL);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_up"), EDIT_MOVE_LINE_UP);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE);
	edit_menu->get_popup()->connect("id_pressed", this, "_menu_option");

	search_menu = memnew(MenuButton);
	search_menu->set_text(TTR("Search"));
	search_menu->set_switch_on_hover(true);
	search_menu->get_popup()->set_hide_on_window_lose_focus(true);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
	search_menu->get_popup()->add_separator();
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE);
	search_menu->get_popup()->connect("id_pressed", this, "_menu_option");

	add_child(main_container);
	main_container->add_child(hbc);
	hbc->add_child(search_menu);
	hbc->add_child(edit_menu);
	hbc->add_style_override("panel", p_node->get_gui_base()->get_stylebox("ScriptEditorPanel", "EditorStyles"));
	main_container->add_child(shader_editor);

	goto_line_dialog = memnew(GotoLineDialog);
	add_child(goto_line_dialog);

	_editor_settings_changed();
}
示例#4
0
TextEditor::TextEditor() {
	code_editor = memnew(CodeTextEditor);
	add_child(code_editor);
	code_editor->add_constant_override("separation", 0);
	code_editor->connect("load_theme_settings", this, "_load_theme_settings");
	code_editor->connect("validate_script", this, "_validate_script");
	code_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE);
	code_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);

	update_settings();

	code_editor->get_text_edit()->set_context_menu_enabled(false);
	code_editor->get_text_edit()->connect("gui_input", this, "_text_edit_gui_input");

	context_menu = memnew(PopupMenu);
	add_child(context_menu);
	context_menu->connect("id_pressed", this, "_edit_option");

	edit_hb = memnew(HBoxContainer);

	search_menu = memnew(MenuButton);
	edit_hb->add_child(search_menu);
	search_menu->set_text(TTR("Search"));
	search_menu->get_popup()->connect("id_pressed", this, "_edit_option");

	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find"), SEARCH_FIND);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_next"), SEARCH_FIND_NEXT);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/find_previous"), SEARCH_FIND_PREV);
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/replace"), SEARCH_REPLACE);
	search_menu->get_popup()->add_separator();
	search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE);

	goto_line_dialog = memnew(GotoLineDialog);
	add_child(goto_line_dialog);

	edit_menu = memnew(MenuButton);
	edit_menu->set_text(TTR("Edit"));
	edit_menu->get_popup()->connect("id_pressed", this, "_edit_option");

	edit_hb->add_child(edit_menu);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"), EDIT_CUT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"), EDIT_COPY);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/paste"), EDIT_PASTE);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"), EDIT_SELECT_ALL);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_up"), EDIT_MOVE_LINE_UP);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/move_down"), EDIT_MOVE_LINE_DOWN);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/fold_all_lines"), EDIT_FOLD_ALL_LINES);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unfold_all_lines"), EDIT_UNFOLD_ALL_LINES);
	edit_menu->get_popup()->add_separator();
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/clone_down"), EDIT_CLONE_DOWN);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES);
	edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS);

	edit_menu->get_popup()->add_separator();
	PopupMenu *convert_case = memnew(PopupMenu);
	convert_case->set_name("convert_case");
	edit_menu->get_popup()->add_child(convert_case);
	edit_menu->get_popup()->add_submenu_item(TTR("Convert Case"), "convert_case");
	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase")), EDIT_TO_UPPERCASE);
	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase")), EDIT_TO_LOWERCASE);
	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE);
	convert_case->connect("id_pressed", this, "_edit_option");

	highlighters["Standard"] = NULL;
	highlighter_menu = memnew(PopupMenu);
	highlighter_menu->set_name("highlighter_menu");
	edit_menu->get_popup()->add_child(highlighter_menu);
	edit_menu->get_popup()->add_submenu_item(TTR("Syntax Highlighter"), "highlighter_menu");
	highlighter_menu->add_radio_check_item(TTR("Standard"));
	highlighter_menu->connect("id_pressed", this, "_change_syntax_highlighter");

	code_editor->get_text_edit()->set_drag_forwarding(this);
}
示例#5
0
void TextEditor::_make_context_menu(bool p_selection, bool p_can_fold, bool p_is_folded) {

	context_menu->clear();
	if (p_selection) {
		context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"), EDIT_CUT);
		context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"), EDIT_COPY);
	}

	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/paste"), EDIT_PASTE);
	context_menu->add_separator();
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"), EDIT_SELECT_ALL);
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"), EDIT_UNDO);
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/redo"), EDIT_REDO);
	context_menu->add_separator();
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"), EDIT_INDENT_LEFT);
	context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"), EDIT_INDENT_RIGHT);

	if (p_selection) {
		context_menu->add_separator();
		context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_uppercase"), EDIT_TO_UPPERCASE);
		context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_lowercase"), EDIT_TO_LOWERCASE);
	}
	if (p_can_fold || p_is_folded)
		context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_fold_line"), EDIT_TOGGLE_FOLD_LINE);

	context_menu->set_position(get_global_transform().xform(get_local_mouse_position()));
	context_menu->set_size(Vector2(1, 1));
	context_menu->popup();
}
AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
    editor=p_editor;
    singleton=this;

    updating=false;

    set_focus_mode(FOCUS_ALL);

    player=NULL;
    add_style_override("panel", get_stylebox("panel","Panel"));


    Label * l;

    /*l= memnew( Label );
    l->set_text("Animation Player:");
    add_child(l);*/

    HBoxContainer *hb = memnew( HBoxContainer );
    add_child(hb);


    play_bw_from = memnew( ToolButton );
    play_bw_from->set_tooltip(TTR("Play selected animation backwards from current pos. (A)"));
    hb->add_child(play_bw_from);

    play_bw = memnew( ToolButton );
    play_bw->set_tooltip(TTR("Play selected animation backwards from end. (Shift+A)"));
    hb->add_child(play_bw);

    stop = memnew( ToolButton );
    stop->set_toggle_mode(true);
    hb->add_child(stop);
    stop->set_tooltip(TTR("Stop animation playback. (S)"));

    play = memnew( ToolButton );
    play->set_tooltip(TTR("Play selected animation from start. (Shift+D)"));
    hb->add_child(play);


    play_from = memnew( ToolButton );
    play_from->set_tooltip(TTR("Play selected animation from current pos. (D)"));
    hb->add_child(play_from);



    //pause = memnew( Button );
    //pause->set_toggle_mode(true);
    //hb->add_child(pause);

    frame = memnew( SpinBox );
    hb->add_child(frame);
    frame->set_custom_minimum_size(Size2(60,0));
    frame->set_stretch_ratio(2);
    frame->set_tooltip(TTR("Animation position (in seconds)."));

    hb->add_child( memnew( VSeparator));

    scale = memnew( LineEdit );
    hb->add_child(scale);
    scale->set_h_size_flags(SIZE_EXPAND_FILL);
    scale->set_stretch_ratio(1);
    scale->set_tooltip(TTR("Scale animation playback globally for the node."));
    scale->hide();


    add_anim = memnew( ToolButton );
    ED_SHORTCUT("animation_player_editor/add_animation", TTR("Create new animation in player."));
    add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/add_animation"));
    add_anim->set_tooltip(TTR("Create new animation in player."));

    hb->add_child(add_anim);


    load_anim = memnew( ToolButton );
    ED_SHORTCUT("animation_player_editor/load_from_disk", TTR("Load animation from disk."));
    add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/load_from_disk"));
    load_anim->set_tooltip(TTR("Load an animation from disk."));
    hb->add_child(load_anim);

    save_anim = memnew(MenuButton);
    save_anim->set_tooltip(TTR("Save the current animation"));
    save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save", TTR("Save")), ANIM_SAVE);
    save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save_as", TTR("Save As")), ANIM_SAVE_AS);
    save_anim->set_focus_mode(Control::FOCUS_NONE);
    hb->add_child(save_anim);

    accept = memnew(AcceptDialog);
    add_child(accept);
    accept->connect("confirmed", this, "_menu_confirm_current");

    duplicate_anim = memnew( ToolButton );
    hb->add_child(duplicate_anim);
    ED_SHORTCUT("animation_player_editor/duplicate_animation", TTR("Duplicate Animation"));
    duplicate_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/duplicate_animation"));
    duplicate_anim->set_tooltip(TTR("Duplicate Animation"));

    rename_anim = memnew( ToolButton );
    hb->add_child(rename_anim);
    ED_SHORTCUT("animation_player_editor/rename_animation", TTR("Rename Animation"));
    rename_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/rename_animation"));
    rename_anim->set_tooltip(TTR("Rename Animation"));

    remove_anim = memnew( ToolButton );

    hb->add_child(remove_anim);
    ED_SHORTCUT("animation_player_editor/remove_animation", TTR("Remove Animation"));
    remove_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/remove_animation"));
    remove_anim->set_tooltip(TTR("Remove Animation"));


    animation = memnew( OptionButton );
    hb->add_child(animation);
    animation->set_h_size_flags(SIZE_EXPAND_FILL);
    animation->set_tooltip(TTR("Display list of animations in player."));
    animation->set_clip_text(true);

    autoplay = memnew( ToolButton );
    hb->add_child(autoplay);
    autoplay->set_tooltip(TTR("Autoplay on Load"));



    blend_anim = memnew( ToolButton );
    hb->add_child(blend_anim);
    blend_anim->set_tooltip(TTR("Edit Target Blend Times"));

    tool_anim = memnew( MenuButton);
    //tool_anim->set_flat(false);
    tool_anim->set_tooltip(TTR("Animation Tools"));
    tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/copy_animation", TTR("Copy Animation")),TOOL_COPY_ANIM);
    tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/paste_animation", TTR("Paste Animation")),TOOL_PASTE_ANIM);
    //tool_anim->get_popup()->add_separator();
    //tool_anim->get_popup()->add_item("Edit Anim Resource",TOOL_PASTE_ANIM);
    hb->add_child(tool_anim);

    nodename = memnew( Button );
    hb->add_child(nodename);
    pin = memnew( ToolButton );
    pin->set_toggle_mode(true);
    hb->add_child(pin);



    resource_edit_anim= memnew( Button );
    hb->add_child(resource_edit_anim);
    resource_edit_anim->hide();


    file = memnew(EditorFileDialog);
    add_child(file);

    name_dialog = memnew( ConfirmationDialog );
    name_dialog->set_title(TTR("Create New Animation"));
    name_dialog->set_hide_on_ok(false);
    add_child(name_dialog);
    name = memnew( LineEdit );
    name_dialog->add_child(name);
    name->set_pos(Point2(18,30));
    name->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,10);
    name_dialog->register_text_enter(name);


    l = memnew( Label );
    l->set_text(TTR("Animation Name:"));
    l->set_pos( Point2(10,10) );

    name_dialog->add_child(l);
    name_title=l;

    error_dialog = memnew( ConfirmationDialog );
    error_dialog->get_ok()->set_text(TTR("Close"));
    //error_dialog->get_cancel()->set_text("Close");
    error_dialog->set_text(TTR("Error!"));
    add_child(error_dialog);

    name_dialog->connect("confirmed", this,"_animation_name_edited");

    blend_editor.dialog = memnew( AcceptDialog );
    add_child(blend_editor.dialog);
    blend_editor.dialog->get_ok()->set_text(TTR("Close"));
    blend_editor.dialog->set_hide_on_ok(true);
    VBoxContainer *blend_vb = memnew( VBoxContainer);
    blend_editor.dialog->add_child(blend_vb);
    blend_editor.dialog->set_child_rect(blend_vb);
    blend_editor.tree = memnew( Tree );
    blend_editor.tree->set_columns(2);
    blend_vb->add_margin_child(TTR("Blend Times:"),blend_editor.tree,true);
    blend_editor.next = memnew( OptionButton );
    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("item_edited",this,"_blend_edited");


    autoplay->connect("pressed", this,"_autoplay_pressed");
    autoplay->set_toggle_mode(true);
    play->connect("pressed", this,"_play_pressed");
    play_from->connect("pressed", this,"_play_from_pressed");
    play_bw->connect("pressed", this,"_play_bw_pressed");
    play_bw_from->connect("pressed", this,"_play_bw_from_pressed");
    stop->connect("pressed", this,"_stop_pressed");
    //pause->connect("pressed", this,"_pause_pressed");
    add_anim->connect("pressed", this,"_animation_new");
    rename_anim->connect("pressed", this,"_animation_rename");
    load_anim->connect("pressed", this,"_animation_load");
    duplicate_anim->connect("pressed", this,"_animation_duplicate");
    //frame->connect("text_entered", this,"_seek_frame_changed");

    blend_anim->connect("pressed", this,"_animation_blend");
    remove_anim->connect("pressed", this,"_animation_remove");
    animation->connect("item_selected", this,"_animation_selected",Vector<Variant>(),true);
    resource_edit_anim->connect("pressed", this,"_animation_resource_edit");
    file->connect("file_selected", this,"_dialog_action");
    frame->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true);
    scale->connect("text_entered", this, "_scale_changed",Vector<Variant>(),true);



    renaming=false;
    last_active=false;

    set_process_unhandled_key_input(true);

    key_editor = memnew( AnimationKeyEditor);
    add_child(key_editor);
    add_constant_override("separation",get_constant("separation","VBoxContainer"));
    key_editor->set_v_size_flags(SIZE_EXPAND_FILL);
    key_editor->connect("timeline_changed",this,"_animation_key_editor_seek");
    key_editor->connect("animation_len_changed",this,"_animation_key_editor_anim_len_changed");
    key_editor->connect("animation_step_changed",this,"_animation_key_editor_anim_step_changed");

    _update_player();
}