GroupsEditor::GroupsEditor() { node=NULL; VBoxContainer *vbc = this; HBoxContainer *hbc = memnew( HBoxContainer ); vbc->add_child(hbc); group_name = memnew( LineEdit ); group_name->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(group_name); group_name->connect("text_entered",this,"_add_group"); add = memnew( Button ); add->set_text(TTR("Add")); hbc->add_child(add); add->connect("pressed", this,"_add_group", varray(String())); tree = memnew( Tree ); tree->set_hide_root(true); tree->set_v_size_flags(SIZE_EXPAND_FILL); vbc->add_child(tree); tree->connect("button_pressed",this,"_remove_group"); add_constant_override("separation",3*EDSCALE); }
EditorLog::EditorLog() { VBoxContainer *vb = this; add_constant_override("separation",get_constant("separation","VBoxContainer")); HBoxContainer *hb = memnew( HBoxContainer ); vb->add_child(hb); title = memnew( Label ); title->set_text(" Output:"); title->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(title); //pd = memnew( PaneDrag ); //hb->add_child(pd); //pd->connect("dragged",this,"_dragged"); //pd->set_default_cursor_shape(Control::CURSOR_MOVE); clearbutton = memnew( Button ); hb->add_child(clearbutton); clearbutton->set_text(TTR("Clear")); clearbutton->connect("pressed", this,"_clear_request"); ec = memnew( Control); vb->add_child(ec); ec->set_custom_minimum_size(Size2(0,180)); ec->set_v_size_flags(SIZE_EXPAND_FILL); PanelContainer *pc = memnew( PanelContainer ); pc->add_style_override("panel",get_stylebox("normal","TextEdit")); ec->add_child(pc); pc->set_area_as_parent_rect(); log = memnew( RichTextLabel ); log->set_scroll_follow(true); log->set_selection_enabled(true); log->set_focus_mode(FOCUS_CLICK); pc->add_child(log); add_message(VERSION_FULL_NAME" (c) 2008-2016 Juan Linietsky, Ariel Manzur."); //log->add_text("Initialization Complete.\n"); //because it looks cool. eh.errfunc=_error_handler; eh.userdata=this; add_error_handler(&eh); current=Thread::get_caller_ID(); EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk,this); }
ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { editor=p_editor; set_name(TTR("Signals")); VBoxContainer *vbc = this; tree = memnew( Tree ); tree->set_columns(1); tree->set_select_mode(Tree::SELECT_ROW); tree->set_hide_root(true); vbc->add_child(tree); tree->set_v_size_flags(SIZE_EXPAND_FILL); connect_button = memnew( Button ); connect_button->set_text("Connect"); HBoxContainer *hb = memnew( HBoxContainer); vbc->add_child(hb); hb->add_spacer(); hb->add_child(connect_button); connect_button->connect("pressed",this,"_connect_pressed"); //add_child(tree); connect_dialog = memnew( ConnectDialog ); connect_dialog->set_as_toplevel(true); add_child(connect_dialog); remove_confirm = memnew( ConfirmationDialog ); remove_confirm->set_as_toplevel(true); add_child(remove_confirm); /* node_only->set_anchor( MARGIN_TOP, ANCHOR_END ); node_only->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); node_only->set_anchor( MARGIN_RIGHT, ANCHOR_END ); node_only->set_begin( Point2( 20,51) ); node_only->set_end( Point2( 10,44) ); */ remove_confirm->connect("confirmed", this,"_remove_confirm"); connect_dialog->connect("connected", this,"_connect"); tree->connect("item_selected", this,"_something_selected"); tree->connect("item_activated", this,"_something_activated"); add_constant_override("separation",3*EDSCALE); }
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(TTR("Animation Player:")); add_child(l);*/ HBoxContainer *hb = memnew( HBoxContainer ); add_child(hb); play_bw_from = memnew( ToolButton ); play_bw_from->set_tooltip(TTR("Play backwards selected animation from current pos. (A)")); hb->add_child(play_bw_from); play_bw = memnew( ToolButton ); play_bw->set_tooltip(TTR("Play backwards selected animation 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 ); add_anim->set_tooltip(TTR("Create new animation in player.")); hb->add_child(add_anim); load_anim = memnew( ToolButton ); 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_item(TTR("Save"), ANIM_SAVE); save_anim->get_popup()->add_item(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); duplicate_anim->set_tooltip(TTR("Duplicate Animation")); rename_anim = memnew( ToolButton ); hb->add_child(rename_anim); rename_anim->set_tooltip(TTR("Rename Animation")); remove_anim = memnew( ToolButton ); hb->add_child(remove_anim); 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.")); 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_item(TTR("Copy Animation"),TOOL_COPY_ANIM); tool_anim->get_popup()->add_item(TTR("Paste Animation"),TOOL_PASTE_ANIM); //tool_anim->get_popup()->add_separator(); //tool_anim->get_popup()->add_item(TTR("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(TTR("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(); }
ScenesDock::ScenesDock(EditorNode *p_editor) { editor=p_editor; HBoxContainer *toolbar_hbc = memnew( HBoxContainer ); add_child(toolbar_hbc); button_hist_prev = memnew( ToolButton ); toolbar_hbc->add_child(button_hist_prev); button_hist_prev->set_disabled(true); button_hist_prev->set_tooltip(TTR("Previous Directory")); button_hist_next = memnew( ToolButton ); toolbar_hbc->add_child(button_hist_next); button_hist_next->set_disabled(true); button_hist_prev->set_focus_mode(FOCUS_NONE); button_hist_next->set_focus_mode(FOCUS_NONE); button_hist_next->set_tooltip(TTR("Next Directory")); current_path=memnew( LineEdit ); current_path->set_h_size_flags(SIZE_EXPAND_FILL); toolbar_hbc->add_child(current_path); button_reload = memnew( Button ); button_reload->set_flat(true); button_reload->connect("pressed",this,"_rescan"); toolbar_hbc->add_child(button_reload); button_reload->set_focus_mode(FOCUS_NONE); button_reload->set_tooltip(TTR("Re-Scan Filesystem")); button_reload->hide(); //toolbar_hbc->add_spacer(); button_favorite = memnew( Button ); button_favorite->set_flat(true); button_favorite->set_toggle_mode(true); button_favorite->connect("pressed",this,"_favorites_pressed"); toolbar_hbc->add_child(button_favorite); button_favorite->set_tooltip(TTR("Toggle folder status as Favorite")); button_favorite->set_focus_mode(FOCUS_NONE); Control *spacer = memnew( Control); /* button_open = memnew( Button ); button_open->set_flat(true); button_open->connect("pressed",this,"_open_pressed"); toolbar_hbc->add_child(button_open); button_open->hide(); button_open->set_focus_mode(FOCUS_NONE); button_open->set_tooltip("Open the selected file.\nOpen as scene if a scene, or as resource otherwise."); button_instance = memnew( Button ); button_instance->set_flat(true); button_instance->connect("pressed",this,"_instance_pressed"); toolbar_hbc->add_child(button_instance); button_instance->hide(); button_instance->set_focus_mode(FOCUS_NONE); button_instance->set_tooltip(TTR("Instance the selected scene(s) as child of the selected node.")); */ file_options = memnew( PopupMenu ); add_child(file_options); split_box = memnew( VSplitContainer ); add_child(split_box); split_box->set_v_size_flags(SIZE_EXPAND_FILL); tree = memnew( Tree ); tree->set_hide_root(true); split_box->add_child(tree); tree->set_custom_minimum_size(Size2(0,200)); tree->set_drag_forwarding(this); //tree->set_v_size_flags(SIZE_EXPAND_FILL); tree->connect("item_edited",this,"_favorite_toggled"); tree->connect("item_activated",this,"_open_pressed"); tree->connect("cell_selected",this,"_dir_selected"); files = memnew( ItemList ); files->set_v_size_flags(SIZE_EXPAND_FILL); files->set_select_mode(ItemList::SELECT_MULTI); files->set_drag_forwarding(this); files->connect("item_rmb_selected",this,"_files_list_rmb_select"); files->set_allow_rmb_select(true); file_list_vb = memnew( VBoxContainer ); split_box->add_child(file_list_vb); file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL); path_hb = memnew( HBoxContainer ); file_list_vb->add_child(path_hb); button_back = memnew( ToolButton ); path_hb->add_child(button_back); button_back->hide(); search_box = memnew( LineEdit ); search_box->set_h_size_flags(SIZE_EXPAND_FILL); path_hb->add_child(search_box); search_box->connect("text_changed",this,"_search_changed"); search_icon = memnew( TextureFrame ); search_icon->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED); path_hb->add_child(search_icon); display_mode = memnew( ToolButton ); path_hb->add_child(display_mode); display_mode->set_toggle_mode(true); file_list_vb->add_child(files); scanning_vb = memnew( VBoxContainer ); Label *slabel = memnew( Label ); slabel->set_text("Scanning Files,\nPlease Wait.."); slabel->set_align(Label::ALIGN_CENTER); scanning_vb->add_child(slabel); scanning_progress = memnew( ProgressBar ); scanning_vb->add_child(scanning_progress); add_child(scanning_vb); scanning_vb->hide(); deps_editor = memnew( DependencyEditor ); add_child(deps_editor); owners_editor = memnew( DependencyEditorOwners); add_child(owners_editor); remove_dialog = memnew( DependencyRemoveDialog); add_child(remove_dialog); move_dialog = memnew( EditorDirDialog ); add_child(move_dialog); move_dialog->connect("dir_selected",this,"_move_operation"); move_dialog->get_ok()->set_text(TTR("Move")); rename_dialog = memnew( EditorFileDialog ); rename_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); rename_dialog->connect("file_selected",this,"_rename_operation"); add_child(rename_dialog); updating_tree=false; initialized=false; history.push_back("res://"); history_pos=0; split_mode=false; path="res://"; add_constant_override("separation",3); }
ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { editor = p_editor; set_name(TTR("Signals")); VBoxContainer *vbc = this; tree = memnew(Tree); tree->set_columns(1); tree->set_select_mode(Tree::SELECT_ROW); tree->set_hide_root(true); vbc->add_child(tree); tree->set_v_size_flags(SIZE_EXPAND_FILL); tree->set_allow_rmb_select(true); connect_button = memnew(Button); connect_button->set_text(TTR("Connect")); HBoxContainer *hb = memnew(HBoxContainer); vbc->add_child(hb); hb->add_spacer(); hb->add_child(connect_button); connect_button->connect("pressed", this, "_connect_pressed"); connect_dialog = memnew(ConnectDialog); connect_dialog->set_as_toplevel(true); add_child(connect_dialog); disconnect_all_dialog = memnew(ConfirmationDialog); disconnect_all_dialog->set_as_toplevel(true); add_child(disconnect_all_dialog); disconnect_all_dialog->connect("confirmed", this, "_disconnect_all"); disconnect_all_dialog->set_text(TTR("Are you sure you want to remove all connections from this signal?")); signal_menu = memnew(PopupMenu); add_child(signal_menu); signal_menu->connect("id_pressed", this, "_handle_signal_menu_option"); signal_menu->add_item(TTR("Connect..."), CONNECT); signal_menu->add_item(TTR("Disconnect All"), DISCONNECT_ALL); slot_menu = memnew(PopupMenu); add_child(slot_menu); slot_menu->connect("id_pressed", this, "_handle_slot_menu_option"); slot_menu->add_item(TTR("Edit..."), EDIT); slot_menu->add_item(TTR("Go To Method"), GO_TO_SCRIPT); slot_menu->add_item(TTR("Disconnect"), DISCONNECT); /* node_only->set_anchor( MARGIN_TOP, ANCHOR_END ); node_only->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); node_only->set_anchor( MARGIN_RIGHT, ANCHOR_END ); node_only->set_begin( Point2( 20,51) ); node_only->set_end( Point2( 10,44) ); */ connect_dialog->connect("connected", this, "_make_or_edit_connection"); tree->connect("item_selected", this, "_tree_item_selected"); tree->connect("item_activated", this, "_tree_item_activated"); tree->connect("item_rmb_selected", this, "_rmb_pressed"); add_constant_override("separation", 3 * EDSCALE); }