Example #1
0
EditorHelp::EditorHelp() {

	editor=EditorNode::get_singleton();

	VBoxContainer *vbc = this;

	EDITOR_DEF("help/sort_functions_alphabetically",true);

	//class_list->connect("meta_clicked",this,"_class_list_select");
	//class_list->set_selection_enabled(true);

	{
		Panel *pc = memnew( Panel );
		Ref<StyleBoxFlat> style( memnew( StyleBoxFlat ) );
		style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/background_color") );
		pc->set_v_size_flags(SIZE_EXPAND_FILL);
		pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit"));
		vbc->add_child(pc);
		class_desc = memnew( RichTextLabel );
		pc->add_child(class_desc);
		class_desc->set_area_as_parent_rect(8);
		class_desc->connect("meta_clicked",this,"_class_desc_select");
		class_desc->connect("input_event",this,"_class_desc_input");
	}

	class_desc->get_v_scroll()->connect("value_changed",this,"_scroll_changed");
	class_desc->set_selection_enabled(true);

	scroll_locked=false;
	select_locked=false;
	set_process_unhandled_key_input(true);
	class_desc->hide();

	search_dialog = memnew( ConfirmationDialog );
	add_child(search_dialog);
	VBoxContainer *search_vb = memnew( VBoxContainer );
	search_dialog->add_child(search_vb);
	search_dialog->set_child_rect(search_vb);
	search = memnew( LineEdit );
	search_dialog->register_text_enter(search);
	search_vb->add_margin_child(TTR("Search Text"),search);
	search_dialog->get_ok()->set_text(TTR("Find"));
	search_dialog->connect("confirmed",this,"_search_cbk");
	search_dialog->set_hide_on_ok(false);
	search_dialog->set_self_opacity(0.8);


	/*class_search = memnew( EditorHelpSearch(editor) );
	editor->get_gui_base()->add_child(class_search);
	class_search->connect("go_to_help",this,"_help_callback");*/

//	prev_search_page=-1;
}
Example #2
0
MenuButton::MenuButton() {
	

	set_flat(true);
	set_focus_mode(FOCUS_NONE);
	popup = memnew( PopupMenu );
	popup->hide();
	add_child(popup);
	popup->set_as_toplevel(true);
	set_process_unhandled_key_input(true);
	set_click_on_press(true);
}
Example #3
0
MenuButton::MenuButton() {

	set_flat(true);
	set_enabled_focus_mode(FOCUS_NONE);
	popup = memnew(PopupMenu);
	popup->hide();
	add_child(popup);
	popup->set_as_toplevel(true);
	connect("button_up", popup, "call_deferred", make_binds("grab_click_focus"));
	set_process_unhandled_key_input(true);
	set_action_mode(ACTION_MODE_BUTTON_PRESS);
}
Example #4
0
MenuButton::MenuButton() {

	switch_on_hover = false;
	set_flat(true);
	set_toggle_mode(true);
	set_disable_shortcuts(false);
	set_enabled_focus_mode(FOCUS_NONE);
	set_process_unhandled_key_input(true);
	set_action_mode(ACTION_MODE_BUTTON_PRESS);

	popup = memnew(PopupMenu);
	popup->hide();
	add_child(popup);
	popup->set_pass_on_modal_close_click(false);
	popup->connect("about_to_show", this, "set_pressed", varray(true)); // For when switching from another MenuButton.
	popup->connect("popup_hide", this, "set_pressed", varray(false));
}
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);


	add_anim = memnew( ToolButton );
	add_anim->set_tooltip("Create new animation in player.");

	hb->add_child(add_anim);


	load_anim = memnew( ToolButton );
	load_anim->set_tooltip("Load an animation from disk.");
	hb->add_child(load_anim);

	save_anim = memnew(MenuButton);
	save_anim->set_tooltip("Save the current animation");
	save_anim->get_popup()->add_item("Save", ANIM_SAVE);
	save_anim->get_popup()->add_item("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("Duplicate Animation");

	rename_anim = memnew( ToolButton );
	hb->add_child(rename_anim);
	rename_anim->set_tooltip("Rename Animation");

	remove_anim = memnew( ToolButton );

	hb->add_child(remove_anim);
	remove_anim->set_tooltip("Remove Animation");


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

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



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

	tool_anim = memnew( MenuButton);
	//tool_anim->set_flat(false);
	tool_anim->set_tooltip("Animation Tools");
	tool_anim->get_popup()->add_item("Copy Animation",TOOL_COPY_ANIM);
	tool_anim->get_popup()->add_item("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);


	edit_anim = memnew( ToolButton );
	edit_anim->set_toggle_mode(true);
	hb->add_child(edit_anim);
	edit_anim->set_tooltip("Open animation editor.\nProperty editor will displays all editable keys too.");


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

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

	play_bw = memnew( ToolButton );
	play_bw->set_tooltip("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("Stop animation playback. (S)");

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


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



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

	seek = memnew( HSlider );
	seek->set_val(0);
	seek->set_step(0.01);
	hb->add_child(seek);
	seek->set_h_size_flags(SIZE_EXPAND_FILL);
	seek->set_stretch_ratio(8);
	seek->set_tooltip("Seek animation (when stopped).");

	frame = memnew( SpinBox );
	hb->add_child(frame);
	frame->set_h_size_flags(SIZE_EXPAND_FILL);
	frame->set_stretch_ratio(2);
	frame->set_tooltip("Animation position (in seconds).");
	seek->share(frame);



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

	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("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("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("Close");
	//error_dialog->get_cancel()->set_text("Close");
	error_dialog->set_text("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("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("Blend Times: ",blend_editor.tree,true);
	blend_editor.next = memnew( LineEdit );
	blend_vb->add_margin_child("Next (Auto Queue):",blend_editor.next);
	blend_editor.dialog->set_title("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");
	edit_anim->connect("pressed", this,"_animation_edit");
	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");
	 seek->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true);
	 scale->connect("text_entered", this, "_scale_changed",Vector<Variant>(),true);
	 editor->get_animation_editor()->connect("timeline_changed",this,"_animation_key_editor_seek");
	 editor->get_animation_editor()->connect("animation_len_changed",this,"_animation_key_editor_anim_len_changed");

	 HBoxContainer *ahb = editor->get_animation_panel_hb();
	 nodename = memnew( Label );
	 ahb->add_child(nodename);
	 nodename->set_h_size_flags(SIZE_EXPAND_FILL);
	 nodename->set_opacity(0.5);
	 pin = memnew( TextureButton );
	 pin->set_toggle_mode(true);
	 ahb->add_child(pin);

	renaming=false;
	last_active=false;

	set_process_unhandled_key_input(true);
}
Example #6
0
EditorHelp::EditorHelp(EditorNode *p_editor) {

	editor=p_editor;

	VBoxContainer *vbc = this;

	HBoxContainer *panel_hb = memnew( HBoxContainer );

	Button *b = memnew( Button );
	b->set_text("Class List");
	panel_hb->add_child(b);
	vbc->add_child(panel_hb);
	b->set_toggle_mode(true);
	b->set_pressed(true);
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_LIST));
	class_list_button=b;
	class_list_button->hide();

	b = memnew( Button );
	b->set_text("Class");
	panel_hb->add_child(b);
	edited_class=b;
	edited_class->hide();
	b->set_toggle_mode(true);
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_DESC));

	b = memnew( Button );
	b->set_text("Search in Classes");
	panel_hb->add_child(b);
	b->connect("pressed",this,"_button_pressed",make_binds(CLASS_SEARCH));

	Control *expand = memnew( Control );
	expand->set_h_size_flags(SIZE_EXPAND_FILL);
	panel_hb->add_child(expand);

	b = memnew( Button );
	panel_hb->add_child(b);
	back=b;
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_PREV));

	b = memnew( Button );
	panel_hb->add_child(b);
	forward=b;
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_NEXT));

	Separator *hs = memnew( VSeparator );
	panel_hb->add_child(hs);
	EmptyControl *ec = memnew( EmptyControl );
	ec->set_minsize(Size2(200,1));
	panel_hb->add_child(ec);
	search = memnew( LineEdit );
	ec->add_child(search);
	search->set_area_as_parent_rect();
	search->connect("text_entered",this,"_search");

	b = memnew( Button );
	b->set_text("Find");
	panel_hb->add_child(b);
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_SEARCH));

	hs = memnew( VSeparator );
	panel_hb->add_child(hs);

	h_split = memnew( HSplitContainer );
	h_split->set_v_size_flags(SIZE_EXPAND_FILL);


	vbc->add_child(h_split);

	class_list = memnew( Tree );
	h_split->add_child(class_list);
	//class_list->connect("meta_clicked",this,"_class_list_select");
	//class_list->set_selection_enabled(true);

	{
		PanelContainer *pc = memnew( PanelContainer );
		pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
		h_split->add_child(pc);
		class_desc = memnew( RichTextLabel );
		pc->add_child(class_desc);
		class_desc->connect("meta_clicked",this,"_class_desc_select");
	}

	class_desc->get_v_scroll()->connect("value_changed",this,"_scroll_changed");
	class_desc->set_selection_enabled(true);
	editor=p_editor;
	history_pos=0;
	scroll_locked=false;
	select_locked=false;
	set_process_unhandled_key_input(true);
	h_split->set_split_offset(200);
	class_list->connect("cell_selected",this,"_tree_item_selected");
	class_desc->hide();

	class_search = memnew( EditorHelpSearch(editor) );
	editor->get_gui_base()->add_child(class_search);
	class_search->connect("go_to_help",this,"_help_callback");
//	prev_search_page=-1;
}
Example #7
0
SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelection *p_editor_selection,EditorData &p_editor_data)  {

	editor=p_editor;
	edited_scene=NULL;
	editor_data=&p_editor_data;
	editor_selection=p_editor_selection;
	scene_root=p_scene_root;

	VBoxContainer *vbc = this;

	HBoxContainer *hbc_top = memnew( HBoxContainer );
	vbc->add_child(hbc_top);

	ToolButton *tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW, false));
	tb->set_tooltip("Add/Create a New Node\n("+keycode_get_string(KEY_MASK_CMD|KEY_A)+")");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_NEW]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_INSTANCE, false));
	tb->set_tooltip("Instance a Node from scene file.");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_INSTANCE]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPLACE, false));
	tb->set_tooltip("Replace a Node by Another Node Type");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_REPLACE]=tb;

	hbc_top->add_spacer();

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_CONNECT, false));
	tb->set_tooltip("Edit the Node Connections");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_CONNECT]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_GROUP, false));
	tb->set_tooltip("Edit the Node Groups");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_GROUP]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_SCRIPT, false));
	tb->set_tooltip("Edit/Create the Node Script");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_SCRIPT]=tb;


	scene_tree = memnew( SceneTreeEditor(false,true,true ));
	vbc->add_child(scene_tree);
	scene_tree->set_v_size_flags(SIZE_EXPAND|SIZE_FILL);

	scene_tree->connect("node_selected", this,"_node_selected",varray(),CONNECT_DEFERRED);
	scene_tree->connect("node_renamed", this,"_node_renamed",varray(),CONNECT_DEFERRED);
	scene_tree->connect("node_prerename", this,"_node_prerenamed");
	scene_tree->connect("open",this,"_load_request");
	scene_tree->connect("open_script",this,"_script_open_request");
	scene_tree->set_undo_redo(&editor_data->get_undo_redo());
	scene_tree->set_editor_selection(editor_selection);

	HBoxContainer *hbc_bottom = memnew( HBoxContainer );
	vbc->add_child(hbc_bottom);


	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_UP, false));
	tb->set_tooltip("Move Node Up\n("+keycode_get_string(KEY_MASK_CMD|KEY_UP)+")");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_MOVE_UP]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_DOWN, false));
	tb->set_tooltip("Move Node Down\n("+keycode_get_string(KEY_MASK_CMD|KEY_DOWN)+")");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_MOVE_DOWN]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_DUPLICATE, false));
	tb->set_tooltip("Duplicate Selected Node(s)\n("+keycode_get_string(KEY_MASK_CMD|KEY_D)+")");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_DUPLICATE]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPARENT, false));
	tb->set_tooltip("Reparent Selected Node(s)");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_REPARENT]=tb;

	hbc_bottom->add_spacer();

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_ERASE, false));
	tb->set_tooltip("Erase Selected Node(s)");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_ERASE]=tb;

	create_dialog = memnew( CreateDialog );
	create_dialog->set_base_type("Node");
	add_child(create_dialog);
	create_dialog->connect("create",this,"_create");

	groups_editor = memnew( GroupsEditor );
	add_child(groups_editor);
	groups_editor->set_undo_redo(&editor_data->get_undo_redo());
	connect_dialog = memnew( ConnectionsDialog(p_editor) );
	add_child(connect_dialog);
	connect_dialog->set_undoredo(&editor_data->get_undo_redo());
	script_create_dialog = memnew( ScriptCreateDialog );
	add_child(script_create_dialog);
	script_create_dialog->connect("script_created",this,"_script_created");
	reparent_dialog = memnew( ReparentDialog );
	add_child(reparent_dialog);
	reparent_dialog->connect("reparent",this,"_node_reparent");

	accept = memnew( AcceptDialog );
	add_child(accept);

	file = memnew( FileDialog );
	add_child(file);
	file->connect("file_selected",this,"instance");
	set_process_unhandled_key_input(true);

	delete_dialog = memnew( ConfirmationDialog );
	add_child(delete_dialog);
	delete_dialog->connect("confirmed",this,"_delete_confirm");
	import_subscene_dialog = memnew( EditorSubScene );
	add_child(import_subscene_dialog);
	import_subscene_dialog->connect("subscene_selected",this,"_import_subscene");




}