示例#1
0
CreateDialog::CreateDialog() {

	set_resizable(true);

	HSplitContainer *hbc = memnew(HSplitContainer);

	add_child(hbc);

	VBoxContainer *lvbc = memnew(VBoxContainer);
	hbc->add_child(lvbc);
	lvbc->set_custom_minimum_size(Size2(150, 0) * EDSCALE);

	favorites = memnew(Tree);
	lvbc->add_margin_child(TTR("Favorites:"), favorites, true);
	favorites->set_hide_root(true);
	favorites->set_hide_folding(true);
	favorites->connect("cell_selected", this, "_favorite_selected");
	favorites->connect("item_activated", this, "_favorite_activated");
	favorites->set_drag_forwarding(this);

	recent = memnew(Tree);
	lvbc->add_margin_child(TTR("Recent:"), recent, true);
	recent->set_hide_root(true);
	recent->set_hide_folding(true);
	recent->connect("cell_selected", this, "_history_selected");
	recent->connect("item_activated", this, "_history_activated");

	VBoxContainer *vbc = memnew(VBoxContainer);
	hbc->add_child(vbc);
	vbc->set_h_size_flags(SIZE_EXPAND_FILL);
	HBoxContainer *search_hb = memnew(HBoxContainer);
	search_box = memnew(LineEdit);
	search_box->set_h_size_flags(SIZE_EXPAND_FILL);
	search_hb->add_child(search_box);
	favorite = memnew(Button);
	favorite->set_toggle_mode(true);
	search_hb->add_child(favorite);
	favorite->connect("pressed", this, "_favorite_toggled");
	vbc->add_margin_child(TTR("Search:"), search_hb);
	search_box->connect("text_changed", this, "_text_changed");
	search_box->connect("gui_input", this, "_sbox_input");
	search_options = memnew(Tree);
	vbc->add_margin_child(TTR("Matches:"), search_options, true);
	get_ok()->set_text(TTR("Create"));
	get_ok()->set_disabled(true);
	register_text_enter(search_box);
	set_hide_on_ok(false);
	search_options->connect("item_activated", this, "_confirmed");
	search_options->connect("cell_selected", this, "_item_selected");
	//search_options->set_hide_root(true);
	base_type = "Object";

	help_bit = memnew(EditorHelpBit);
	vbc->add_margin_child(TTR("Description:"), help_bit);
	help_bit->connect("request_hide", this, "_closed");
}
示例#2
0
CreateDialog::CreateDialog() {

	is_replace_mode = false;

	set_resizable(true);

	HSplitContainer *hsc = memnew(HSplitContainer);
	add_child(hsc);

	VSplitContainer *vsc = memnew(VSplitContainer);
	hsc->add_child(vsc);

	VBoxContainer *fav_vb = memnew(VBoxContainer);
	vsc->add_child(fav_vb);
	fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
	fav_vb->set_v_size_flags(SIZE_EXPAND_FILL);

	favorites = memnew(Tree);
	fav_vb->add_margin_child(TTR("Favorites:"), favorites, true);
	favorites->set_hide_root(true);
	favorites->set_hide_folding(true);
	favorites->connect("cell_selected", this, "_favorite_selected");
	favorites->connect("item_activated", this, "_favorite_activated");
	favorites->set_drag_forwarding(this);

	VBoxContainer *rec_vb = memnew(VBoxContainer);
	vsc->add_child(rec_vb);
	rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
	rec_vb->set_v_size_flags(SIZE_EXPAND_FILL);

	recent = memnew(Tree);
	rec_vb->add_margin_child(TTR("Recent:"), recent, true);
	recent->set_hide_root(true);
	recent->set_hide_folding(true);
	recent->connect("cell_selected", this, "_history_selected");
	recent->connect("item_activated", this, "_history_activated");

	VBoxContainer *vbc = memnew(VBoxContainer);
	hsc->add_child(vbc);
	vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
	vbc->set_h_size_flags(SIZE_EXPAND_FILL);
	HBoxContainer *search_hb = memnew(HBoxContainer);
	search_box = memnew(LineEdit);
	search_box->set_h_size_flags(SIZE_EXPAND_FILL);
	search_hb->add_child(search_box);
	favorite = memnew(Button);
	favorite->set_flat(true);
	favorite->set_toggle_mode(true);
	search_hb->add_child(favorite);
	favorite->connect("pressed", this, "_favorite_toggled");
	vbc->add_margin_child(TTR("Search:"), search_hb);
	search_box->connect("text_changed", this, "_text_changed");
	search_box->connect("gui_input", this, "_sbox_input");
	search_options = memnew(Tree);
	vbc->add_margin_child(TTR("Matches:"), search_options, true);
	get_ok()->set_disabled(true);
	register_text_enter(search_box);
	set_hide_on_ok(false);
	search_options->connect("item_activated", this, "_confirmed");
	search_options->connect("cell_selected", this, "_item_selected");
	base_type = "Object";
	preferred_search_result_type = "";

	help_bit = memnew(EditorHelpBit);
	vbc->add_margin_child(TTR("Description:"), help_bit);
	help_bit->connect("request_hide", this, "_closed");

	type_blacklist.insert("PluginScript"); // PluginScript must be initialized before use, which is not possible here
	type_blacklist.insert("ScriptCreateDialog"); // This is an exposed editor Node that doesn't have an Editor prefix.

	EDITOR_DEF("interface/editors/derive_script_globals_by_name", true);
}
ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){



	ppeer = Ref<PacketPeerStream>( memnew( PacketPeerStream ) );
	editor=p_editor;

	tabs = memnew( TabContainer );
	tabs->set_v_size_flags(SIZE_EXPAND_FILL);
	tabs->set_area_as_parent_rect();
	add_child(tabs);


	{ //debugger
		VBoxContainer *vbc = memnew( VBoxContainer );
		vbc->set_name(TTR("Debugger"));
		//tabs->add_child(vbc);
		Control *dbg=vbc;

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


		reason = memnew( LineEdit );
		reason->set_text("");
		reason->set_editable(false);
		hbc->add_child(reason);
		reason->add_color_override("font_color",Color(1,0.4,0.0,0.8));
		reason->set_h_size_flags(SIZE_EXPAND_FILL);
		//reason->set_clip_text(true);

		hbc->add_child( memnew( VSeparator) );

		step = memnew( Button );
		hbc->add_child(step);
		step->set_tooltip(TTR("Step Into"));
		step->connect("pressed",this,"debug_step");

		next = memnew( Button );
		hbc->add_child(next);
		next->set_tooltip(TTR("Step Over"));
		next->connect("pressed",this,"debug_next");

		hbc->add_child( memnew( VSeparator) );

		dobreak = memnew( Button );
		hbc->add_child(dobreak);
		dobreak->set_tooltip(TTR("Break"));
		dobreak->connect("pressed",this,"debug_break");

		docontinue = memnew( Button );
		hbc->add_child(docontinue);
		docontinue->set_tooltip(TTR("Continue"));
		docontinue->connect("pressed",this,"debug_continue");

		//hbc->add_child( memnew( VSeparator) );

		back = memnew( Button );
		hbc->add_child(back);
		back->set_tooltip(TTR("Inspect Previous Instance"));
		back->hide();

		forward = memnew( Button );
		hbc->add_child(forward);
		forward->set_tooltip(TTR("Inspect Next Instance"));
		forward->hide();


		HSplitContainer *sc = memnew( HSplitContainer );
		vbc->add_child(sc);
		sc->set_v_size_flags(SIZE_EXPAND_FILL);

		stack_dump = memnew( Tree );
		stack_dump->set_columns(1);
		stack_dump->set_column_titles_visible(true);
		stack_dump->set_column_title(0,TTR("Stack Frames"));
		stack_dump->set_h_size_flags(SIZE_EXPAND_FILL);
		stack_dump->set_hide_root(true);
		stack_dump->connect("cell_selected",this,"_stack_dump_frame_selected");
		sc->add_child(stack_dump);

		inspector = memnew( PropertyEditor );
		inspector->set_h_size_flags(SIZE_EXPAND_FILL);
		inspector->hide_top_label();
		inspector->get_scene_tree()->set_column_title(0,TTR("Variable"));
		inspector->set_capitalize_paths(false);
		inspector->set_read_only(true);
		sc->add_child(inspector);

		server = TCP_Server::create_ref();

		pending_in_queue=0;

		variables = memnew( ScriptEditorDebuggerVariables );

		breaked=false;

		tabs->add_child(dbg);
		//tabs->move_child(vbc,0);

		hbc = memnew( HBoxContainer );
		vbc->add_child(hbc);

	}

	{  //errors


		error_split = memnew( HSplitContainer );
		VBoxContainer *errvb = memnew( VBoxContainer );
		errvb->set_h_size_flags(SIZE_EXPAND_FILL);
		error_list = memnew( ItemList );
		errvb->add_margin_child(TTR("Errors:"),error_list,true);
		error_split->add_child(errvb);

		errvb = memnew( VBoxContainer );
		errvb->set_h_size_flags(SIZE_EXPAND_FILL);
		error_stack = memnew( ItemList );
		errvb->add_margin_child(TTR("Stack Trace (if applicable):"),error_stack,true);
		error_split->add_child(errvb);

		error_split->set_name(TTR("Errors"));
		tabs->add_child(error_split);
	}


	{ // inquire


		inspect_info = memnew( HSplitContainer );
		inspect_info->set_name(TTR("Remote Inspector"));
		tabs->add_child(inspect_info);

		VBoxContainer *info_left = memnew(VBoxContainer);
		info_left->set_h_size_flags(SIZE_EXPAND_FILL);
		inspect_info->add_child(info_left);

		inspect_scene_tree = memnew( Tree );
		info_left->add_margin_child(TTR("Live Scene Tree:"),inspect_scene_tree,true);
		inspect_scene_tree->connect("cell_selected",this,"_scene_tree_selected");
		inspect_scene_tree->connect("item_collapsed",this,"_scene_tree_folded");

		//

		VBoxContainer *info_right = memnew(VBoxContainer);
		info_right->set_h_size_flags(SIZE_EXPAND_FILL);
		inspect_info->add_child(info_right);

		inspect_properties = memnew( PropertyEditor );
		inspect_properties->hide_top_label();
		inspect_properties->set_show_categories(true);
		inspect_properties->connect("object_id_selected",this,"_scene_tree_property_select_object");

		info_right->add_margin_child(TTR("Remote Object Properties: "),inspect_properties,true);

		inspect_scene_tree_timeout=EDITOR_DEF("debugger/scene_tree_refresh_interval",1.0);
		inspect_edited_object_timeout=EDITOR_DEF("debugger/remote_inspect_refresh_interval",0.2);
		inspected_object_id=0;
		updating_scene_tree=false;

		inspected_object = memnew( ScriptEditorDebuggerInspectedObject );
		inspected_object->connect("value_edited",this,"_scene_tree_property_value_edited");
	}

	{ //profiler
		profiler = memnew( EditorProfiler );
		profiler->set_name(TTR("Profiler"));
		tabs->add_child(profiler);
		profiler->connect("enable_profiling",this,"_profiler_activate");
		profiler->connect("break_request",this,"_profiler_seeked");
	}


	{ //monitors

		HSplitContainer *hsp = memnew( HSplitContainer );

		perf_monitors = memnew(Tree);
		perf_monitors->set_columns(2);
		perf_monitors->set_column_title(0,TTR("Monitor"));
		perf_monitors->set_column_title(1,TTR("Value"));
		perf_monitors->set_column_titles_visible(true);
		hsp->add_child(perf_monitors);
		perf_monitors->set_select_mode(Tree::SELECT_MULTI);
		perf_monitors->connect("multi_selected",this,"_performance_select");
		perf_draw = memnew( Control );
		perf_draw->connect("draw",this,"_performance_draw");
		hsp->add_child(perf_draw);
		hsp->set_name(TTR("Monitors"));
		hsp->set_split_offset(300);
		tabs->add_child(hsp);
		perf_max.resize(Performance::MONITOR_MAX);

		Map<String,TreeItem*> bases;
		TreeItem *root=perf_monitors->create_item();
		perf_monitors->set_hide_root(true);
		for(int i=0;i<Performance::MONITOR_MAX;i++) {

			String n = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i));
			String base = n.get_slice("/",0);
			String name = n.get_slice("/",1);
			if (!bases.has(base)) {
				TreeItem *b = perf_monitors->create_item(root);
				b->set_text(0,base.capitalize());
				b->set_editable(0,false);
				b->set_selectable(0,false);
				bases[base]=b;
			}

			TreeItem *it = perf_monitors->create_item(bases[base]);
			it->set_editable(0,false);
			it->set_selectable(0,true);
			it->set_text(0,name.capitalize());
			perf_items.push_back(it);
			perf_max[i]=0;

		}
	}

	{ //vmem inspect
		VBoxContainer *vmem_vb = memnew( VBoxContainer );
		HBoxContainer *vmem_hb = memnew( HBoxContainer );
		Label *vmlb = memnew(Label(TTR("List of Video Memory Usage by Resource:")+" ") );
		vmlb->set_h_size_flags(SIZE_EXPAND_FILL);
		vmem_hb->add_child( vmlb );
		vmem_hb->add_child( memnew(Label(TTR("Total:")+" ")) );
		vmem_total = memnew( LineEdit );
		vmem_total->set_editable(false);
		vmem_total->set_custom_minimum_size(Size2(100,1)*EDSCALE);
		vmem_hb->add_child(vmem_total);
		vmem_refresh = memnew( Button );
		vmem_hb->add_child(vmem_refresh);
		vmem_vb->add_child(vmem_hb);
		vmem_refresh->connect("pressed",this,"_video_mem_request");

		MarginContainer *vmmc = memnew( MarginContainer );
		vmem_tree = memnew( Tree );
		vmem_tree->set_v_size_flags(SIZE_EXPAND_FILL);
		vmem_tree->set_h_size_flags(SIZE_EXPAND_FILL);
		vmmc->add_child(vmem_tree);
		vmmc->set_v_size_flags(SIZE_EXPAND_FILL);
		vmem_vb->add_child(vmmc);

		vmem_vb->set_name(TTR("Video Mem"));
		vmem_tree->set_columns(4);
		vmem_tree->set_column_titles_visible(true);
		vmem_tree->set_column_title(0,TTR("Resource Path"));
		vmem_tree->set_column_expand(0,true);
		vmem_tree->set_column_expand(1,false);
		vmem_tree->set_column_title(1,TTR("Type"));
		vmem_tree->set_column_min_width(1,100);
		vmem_tree->set_column_expand(2,false);
		vmem_tree->set_column_title(2,TTR("Format"));
		vmem_tree->set_column_min_width(2,150);
		vmem_tree->set_column_expand(3,false);
		vmem_tree->set_column_title(3,TTR("Usage"));
		vmem_tree->set_column_min_width(3,80);
		vmem_tree->set_hide_root(true);

		tabs->add_child(vmem_vb);
	}

	{ // misc
		VBoxContainer *info_left = memnew( VBoxContainer );
		info_left->set_h_size_flags(SIZE_EXPAND_FILL);
		info_left->set_name(TTR("Misc"));
		tabs->add_child(info_left);
		clicked_ctrl = memnew( LineEdit );
		info_left->add_margin_child(TTR("Clicked Control:"),clicked_ctrl);
		clicked_ctrl_type = memnew( LineEdit );
		info_left->add_margin_child(TTR("Clicked Control Type:"),clicked_ctrl_type);

		live_edit_root = memnew( LineEdit );

		{
			HBoxContainer *lehb = memnew( HBoxContainer );
			Label *l = memnew( Label(TTR("Live Edit Root:")) );
			lehb->add_child(l);
			l->set_h_size_flags(SIZE_EXPAND_FILL);
			le_set = memnew( Button(TTR("Set From Tree")) );
			lehb->add_child(le_set);
			le_clear = memnew( Button(TTR("Clear")) );
			lehb->add_child(le_clear);
			info_left->add_child(lehb);
			MarginContainer *mc = memnew( MarginContainer );
			mc->add_child(live_edit_root);
			info_left->add_child(mc);
			le_set->set_disabled(true);
			le_clear->set_disabled(true);
		}

	}



	msgdialog = memnew( AcceptDialog );
	add_child(msgdialog);

	log_forced_visible=false;

	p_editor->get_undo_redo()->set_method_notify_callback(_method_changeds,this);
	p_editor->get_undo_redo()->set_property_notify_callback(_property_changeds,this);
	live_debug=false;
	last_path_id=false;
	error_count=0;
	hide_on_stop=true;
	last_error_count=0;

	EditorNode::get_singleton()->get_pause_button()->connect("pressed",this,"_paused");


}
示例#4
0
ProjectExportDialog::ProjectExportDialog() {

	set_title(TTR("Export"));
	set_resizable(true);

	VBoxContainer *main_vb = memnew(VBoxContainer);
	add_child(main_vb);
	HSplitContainer *hbox = memnew(HSplitContainer);
	main_vb->add_child(hbox);
	hbox->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *preset_vb = memnew(VBoxContainer);
	preset_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbox->add_child(preset_vb);

	HBoxContainer *preset_hb = memnew(HBoxContainer);
	preset_hb->add_child(memnew(Label(TTR("Presets"))));
	preset_hb->add_spacer();
	preset_vb->add_child(preset_hb);

	add_preset = memnew(MenuButton);
	add_preset->set_text(TTR("Add..."));
	add_preset->get_popup()->connect("index_pressed", this, "_add_preset");
	preset_hb->add_child(add_preset);
	MarginContainer *mc = memnew(MarginContainer);
	preset_vb->add_child(mc);
	mc->set_v_size_flags(SIZE_EXPAND_FILL);
	presets = memnew(ItemList);
	presets->set_drag_forwarding(this);
	mc->add_child(presets);
	presets->connect("item_selected", this, "_edit_preset");
	duplicate_preset = memnew(ToolButton);
	preset_hb->add_child(duplicate_preset);
	duplicate_preset->connect("pressed", this, "_duplicate_preset");
	delete_preset = memnew(ToolButton);
	preset_hb->add_child(delete_preset);
	delete_preset->connect("pressed", this, "_delete_preset");

	VBoxContainer *settings_vb = memnew(VBoxContainer);
	settings_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbox->add_child(settings_vb);

	name = memnew(LineEdit);
	settings_vb->add_margin_child(TTR("Name:"), name);
	name->connect("text_changed", this, "_name_changed");
	runnable = memnew(CheckButton);
	runnable->set_text(TTR("Runnable"));
	runnable->connect("pressed", this, "_runnable_pressed");
	settings_vb->add_child(runnable);

	export_path = memnew(EditorPropertyPath);
	settings_vb->add_child(export_path);
	export_path->set_label(TTR("Export Path"));
	export_path->set_object_and_property(this, "export_path");
	export_path->set_save_mode();
	export_path->connect("property_changed", this, "_export_path_changed");

	sections = memnew(TabContainer);
	sections->set_tab_align(TabContainer::ALIGN_LEFT);
	settings_vb->add_child(sections);
	sections->set_v_size_flags(SIZE_EXPAND_FILL);

	parameters = memnew(EditorInspector);
	sections->add_child(parameters);
	parameters->set_name(TTR("Options"));
	parameters->set_v_size_flags(SIZE_EXPAND_FILL);
	parameters->connect("property_edited", this, "_update_parameters");

	VBoxContainer *resources_vb = memnew(VBoxContainer);
	sections->add_child(resources_vb);
	resources_vb->set_name(TTR("Resources"));

	export_filter = memnew(OptionButton);
	export_filter->add_item(TTR("Export all resources in the project"));
	export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
	export_filter->add_item(TTR("Export selected resources (and dependencies)"));
	resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
	export_filter->connect("item_selected", this, "_export_type_changed");

	include_label = memnew(Label);
	include_label->set_text(TTR("Resources to export:"));
	resources_vb->add_child(include_label);
	include_margin = memnew(MarginContainer);
	include_margin->set_v_size_flags(SIZE_EXPAND_FILL);
	resources_vb->add_child(include_margin);

	include_files = memnew(Tree);
	include_margin->add_child(include_files);
	include_files->connect("item_edited", this, "_tree_changed");

	include_filters = memnew(LineEdit);
	resources_vb->add_margin_child(TTR("Filters to export non-resource files (comma separated, e.g: *.json, *.txt)"), include_filters);
	include_filters->connect("text_changed", this, "_filter_changed");

	exclude_filters = memnew(LineEdit);
	resources_vb->add_margin_child(TTR("Filters to exclude files from project (comma separated, e.g: *.json, *.txt)"), exclude_filters);
	exclude_filters->connect("text_changed", this, "_filter_changed");

	VBoxContainer *patch_vb = memnew(VBoxContainer);
	sections->add_child(patch_vb);
	patch_vb->set_name(TTR("Patches"));

	patches = memnew(Tree);
	patch_vb->add_child(patches);
	patches->set_v_size_flags(SIZE_EXPAND_FILL);
	patches->set_hide_root(true);
	patches->connect("button_pressed", this, "_patch_button_pressed");
	patches->connect("item_edited", this, "_patch_edited");
	patches->set_drag_forwarding(this);
	patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);

	HBoxContainer *patches_hb = memnew(HBoxContainer);
	patch_vb->add_child(patches_hb);
	patches_hb->add_spacer();
	patch_export = memnew(Button);
	patch_export->set_text(TTR("Make Patch"));
	patches_hb->add_child(patch_export);
	patches_hb->add_spacer();

	patch_dialog = memnew(FileDialog);
	patch_dialog->add_filter("*.pck ; Pack File");
	patch_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
	patch_dialog->connect("file_selected", this, "_patch_selected");
	add_child(patch_dialog);

	patch_erase = memnew(ConfirmationDialog);
	patch_erase->get_ok()->set_text(TTR("Delete"));
	patch_erase->connect("confirmed", this, "_patch_deleted");
	add_child(patch_erase);

	VBoxContainer *feature_vb = memnew(VBoxContainer);
	feature_vb->set_name(TTR("Features"));
	custom_features = memnew(LineEdit);
	custom_features->connect("text_changed", this, "_custom_features_changed");
	feature_vb->add_margin_child(TTR("Custom (comma-separated):"), custom_features);
	Panel *features_panel = memnew(Panel);
	custom_feature_display = memnew(RichTextLabel);
	features_panel->add_child(custom_feature_display);
	custom_feature_display->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 10 * EDSCALE);
	custom_feature_display->set_v_size_flags(SIZE_EXPAND_FILL);
	feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true);
	sections->add_child(feature_vb);

	updating_script_key = false;

	VBoxContainer *script_vb = memnew(VBoxContainer);
	script_vb->set_name(TTR("Script"));
	script_mode = memnew(OptionButton);
	script_vb->add_margin_child(TTR("Script Export Mode:"), script_mode);
	script_mode->add_item(TTR("Text"), (int)EditorExportPreset::MODE_SCRIPT_TEXT);
	script_mode->add_item(TTR("Compiled"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED);
	script_mode->add_item(TTR("Encrypted (Provide Key Below)"), (int)EditorExportPreset::MODE_SCRIPT_ENCRYPTED);
	script_mode->connect("item_selected", this, "_script_export_mode_changed");
	script_key = memnew(LineEdit);
	script_key->connect("text_changed", this, "_script_encryption_key_changed");
	script_key_error = memnew(Label);
	script_key_error->set_text("- " + TTR("Invalid Encryption Key (must be 64 characters long)"));
	script_key_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
	script_vb->add_margin_child(TTR("Script Encryption Key (256-bits as hex):"), script_key);
	script_vb->add_child(script_key_error);
	sections->add_child(script_vb);

	sections->connect("tab_changed", this, "_tab_changed");

	//disable by default
	name->set_editable(false);
	export_path->hide();
	runnable->set_disabled(true);
	duplicate_preset->set_disabled(true);
	delete_preset->set_disabled(true);
	script_key_error->hide();
	sections->hide();
	parameters->edit(NULL);

	delete_confirm = memnew(ConfirmationDialog);
	add_child(delete_confirm);
	delete_confirm->get_ok()->set_text(TTR("Delete"));
	delete_confirm->connect("confirmed", this, "_delete_preset_confirm");

	updating = false;

	get_cancel()->set_text(TTR("Close"));
	get_ok()->set_text(TTR("Export PCK/Zip"));
	export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
	export_button->connect("pressed", this, "_export_project");
	// Disable initially before we select a valid preset
	export_button->set_disabled(true);

	export_all_dialog = memnew(ConfirmationDialog);
	add_child(export_all_dialog);
	export_all_dialog->set_title("Export All");
	export_all_dialog->set_text(TTR("Export mode?"));
	export_all_dialog->get_ok()->hide();
	export_all_dialog->add_button(TTR("Debug"), true, "debug");
	export_all_dialog->add_button(TTR("Release"), true, "release");
	export_all_dialog->connect("custom_action", this, "_export_all_dialog_action");

	export_all_button = add_button(TTR("Export All"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
	export_all_button->connect("pressed", this, "_export_all_dialog");
	export_all_button->set_disabled(true);

	export_pck_zip = memnew(FileDialog);
	export_pck_zip->add_filter("*.zip ; ZIP File");
	export_pck_zip->add_filter("*.pck ; Godot Game Pack");
	export_pck_zip->set_access(FileDialog::ACCESS_FILESYSTEM);
	export_pck_zip->set_mode(FileDialog::MODE_SAVE_FILE);
	add_child(export_pck_zip);
	export_pck_zip->connect("file_selected", this, "_export_pck_zip_selected");

	export_error = memnew(Label);
	main_vb->add_child(export_error);
	export_error->hide();
	export_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));

	export_templates_error = memnew(HBoxContainer);
	main_vb->add_child(export_templates_error);
	export_templates_error->hide();

	Label *export_error2 = memnew(Label);
	export_templates_error->add_child(export_error2);
	export_error2->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
	export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " ");

	error_dialog = memnew(AcceptDialog);
	error_dialog->set_title("Error");
	error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted:") + " ");
	main_vb->add_child(error_dialog);
	error_dialog->hide();

	LinkButton *download_templates = memnew(LinkButton);
	download_templates->set_text(TTR("Manage Export Templates"));
	download_templates->set_v_size_flags(SIZE_SHRINK_CENTER);
	export_templates_error->add_child(download_templates);
	download_templates->connect("pressed", this, "_open_export_template_manager");

	export_project = memnew(FileDialog);
	export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
	add_child(export_project);
	export_project->connect("file_selected", this, "_export_project_to_path");
	export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path");

	export_debug = memnew(CheckBox);
	export_debug->set_text(TTR("Export With Debug"));
	export_debug->set_pressed(true);
	export_project->get_vbox()->add_child(export_debug);

	export_pck_zip_debug = memnew(CheckBox);
	export_pck_zip_debug->set_text(TTR("Export With Debug"));
	export_pck_zip_debug->set_pressed(true);
	export_pck_zip->get_vbox()->add_child(export_pck_zip_debug);

	set_hide_on_ok(false);

	editor_icons = "EditorIcons";

	default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", "");
	// If no default set, use project name
	if (default_filename == "") {
		// If no project name defined, use a sane default
		default_filename = ProjectSettings::get_singleton()->get("application/config/name");
		if (default_filename == "") {
			default_filename = "UnnamedProject";
		}
	}

	_update_export_all();
}
示例#5
0
MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) {

	singleton = this;

	editor = p_editor;

	set_v_size_flags(SIZE_EXPAND_FILL);
	set_anchors_and_margins_preset(Control::PRESET_WIDE);

	panel_tabs = memnew(TabContainer);
	panel_tabs->set_tab_align(TabContainer::ALIGN_LEFT);
	panel_tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles"));
	panel_tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles"));
	panel_tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles"));
	panel_tabs->set_custom_minimum_size(Size2(0, 228) * EDSCALE);
	panel_tabs->set_v_size_flags(SIZE_EXPAND_FILL);
	add_child(panel_tabs);

	{ // Builds
		panel_builds_tab = memnew(VBoxContainer);
		panel_builds_tab->set_name(TTR("Builds"));
		panel_builds_tab->set_h_size_flags(SIZE_EXPAND_FILL);
		panel_tabs->add_child(panel_builds_tab);

		HBoxContainer *toolbar_hbc = memnew(HBoxContainer);
		toolbar_hbc->set_h_size_flags(SIZE_EXPAND_FILL);
		panel_builds_tab->add_child(toolbar_hbc);

		toolbar_hbc->add_spacer();

		warnings_btn = memnew(ToolButton);
		warnings_btn->set_text("Warnings");
		warnings_btn->set_toggle_mode(true);
		warnings_btn->set_pressed(true);
		warnings_btn->set_visible(false);
		warnings_btn->set_focus_mode(FOCUS_NONE);
		warnings_btn->connect("toggled", this, "_warnings_toggled");
		toolbar_hbc->add_child(warnings_btn);

		errors_btn = memnew(ToolButton);
		errors_btn->set_text("Errors");
		errors_btn->set_toggle_mode(true);
		errors_btn->set_pressed(true);
		errors_btn->set_visible(false);
		errors_btn->set_focus_mode(FOCUS_NONE);
		errors_btn->connect("toggled", this, "_errors_toggled");
		toolbar_hbc->add_child(errors_btn);

		HSplitContainer *hsc = memnew(HSplitContainer);
		hsc->set_h_size_flags(SIZE_EXPAND_FILL);
		hsc->set_v_size_flags(SIZE_EXPAND_FILL);
		panel_builds_tab->add_child(hsc);

		build_tabs_list = memnew(ItemList);
		build_tabs_list->set_h_size_flags(SIZE_EXPAND_FILL);
		build_tabs_list->connect("item_selected", this, "_build_tab_item_selected");
		hsc->add_child(build_tabs_list);

		build_tabs = memnew(TabContainer);
		build_tabs->set_tab_align(TabContainer::ALIGN_LEFT);
		build_tabs->set_h_size_flags(SIZE_EXPAND_FILL);
		build_tabs->set_tabs_visible(false);
		build_tabs->connect("tab_changed", this, "_build_tab_changed");
		hsc->add_child(build_tabs);
	}
}