void _import() {


		if (items.size()==0) {
			error_dialog->set_text(TTR("No items to import!"));
			error_dialog->popup_centered(Size2(200,100));
		}

		if (!save_path->get_text().begins_with("res://")) {
			error_dialog->set_text(TTR("No target path!"));
			error_dialog->popup_centered(Size2(200,100));
		}

		EditorProgress progress("import_xl",TTR("Import Translations"),items.size());
		for(int i=0;i<items.size();i++) {

			progress.step(items[i]->get_metadata(1),i);
			if (!items[i]->is_checked(0))
				continue;

			String locale = TranslationServer::get_all_locales()[items[i]->get_range(1)];
			Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
			imd->add_source(EditorImportPlugin::validate_source_path(import_path->get_text()));
			imd->set_option("locale",locale);
			imd->set_option("index",i);
			imd->set_option("skip_first",ignore_first->is_pressed());
			imd->set_option("compress",compress->is_pressed());

			String savefile = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+"."+locale+".xl");
			Error err = plugin->import(savefile,imd);
			if (err!=OK) {
				error_dialog->set_text(TTR("Couldn't import!"));
				error_dialog->popup_centered(Size2(200,100));
			} else if (add_to_project->is_pressed()) {

				ProjectSettings::get_singleton()->add_translation(savefile);
			}
		}
		hide();

	}
void EditorTextureImportDialog::_import() {


//	ImportMonitorBlock imb;

	Vector<String> files=import_path->get_text().split(",");

	if (!files.size()) {

		error_dialog->set_text("Please specify some files!");
		error_dialog->popup_centered(Size2(200,100));
		return;
	}

	String dst_path=save_path->get_text();

	if (save_path->get_text().strip_edges()=="") {
		error_dialog->set_text("Target path is empty.");
		error_dialog->popup_centered_minsize();
		return;
	}

	if (!save_path->get_text().begins_with("res://")) {
		error_dialog->set_text("Target path must be full resource path.");
		error_dialog->popup_centered_minsize();
		return;
	}


	if (!atlas && !large && !DirAccess::exists(save_path->get_text())) {
		error_dialog->set_text("Target path must exist.");
		error_dialog->popup_centered_minsize();
		return;
	}

	if (atlas) { //atlas

		if (files.size()==0) {

			error_dialog->set_text("At least one file needed for Atlas.");
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
		String dst_file = dst_path;
		//dst_file=dst_file.basename()+".tex";
		Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
		//imd->set_editor();
		for(int i=0;i<files.size();i++) {
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
		}
		imd->set_option("format",texture_options->get_format());
		imd->set_option("flags",texture_options->get_flags());
		imd->set_option("quality",texture_options->get_quality());
		imd->set_option("atlas",true);
		imd->set_option("atlas_size",int(size->get_val()));
		imd->set_option("large",false);
		imd->set_option("crop",crop_source->is_pressed());

		Error err = plugin->import(dst_file,imd);
		if (err) {

			error_dialog->set_text("Error importing: "+dst_file.get_file());
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
	} else if (large) { //atlas

		if (files.size()!=1) {

			error_dialog->set_text("Only one file is required for large texture");
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
		String dst_file = dst_path;
		//dst_file=dst_file.basename()+".tex";
		Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
		//imd->set_editor();
		for(int i=0;i<files.size();i++) {
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
		}
		imd->set_option("format",texture_options->get_format());
		imd->set_option("flags",texture_options->get_flags());
		imd->set_option("quality",texture_options->get_quality());
		imd->set_option("atlas",false);
		imd->set_option("large",true);
		imd->set_option("large_cell_size",int(size->get_val()));
		imd->set_option("crop",crop_source->is_pressed());

		Error err = plugin->import(dst_file,imd);
		if (err) {

			error_dialog->set_text("Error importing: "+dst_file.get_file());
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
	} else {


		for(int i=0;i<files.size();i++) {

			String dst_file = dst_path.plus_file(files[i].get_file());
			dst_file=dst_file.basename()+".tex";
			Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
			//imd->set_editor();
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
			imd->set_option("format",texture_options->get_format());
			imd->set_option("flags",texture_options->get_flags());
			imd->set_option("quality",texture_options->get_quality());
			imd->set_option("atlas",false);
			imd->set_option("large",false);

			Error err = plugin->import(dst_file,imd);
			if (err) {

				error_dialog->set_text("Error importing: "+dst_file.get_file());
				error_dialog->popup_centered(Size2(200,100));
				return;

			}
		}
	}

	hide();
}
void EditorTextureImportDialog::_import() {


//	ImportMonitorBlock imb;

	Vector<String> files=import_path->get_text().split(",");

	if (!files.size()) {

		error_dialog->set_text("Please specify some files!");
		error_dialog->popup_centered(Size2(200,100));
		return;
	}

	String dst_path=save_path->get_text();

	if (dst_path.empty()) {

		error_dialog->set_text("Please specify a valid target import path!");
		error_dialog->popup_centered(Size2(200,100));
		return;

	}

	if (atlas) { //atlas

		if (files.size()==0) {

			error_dialog->set_text("At least one file needed for Atlas.");
			error_dialog->popup_centered(Size2(200,100));
			return;

		}
		String dst_file = dst_path;
		//dst_file=dst_file.basename()+".tex";
		Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
		//imd->set_editor();
		for(int i=0;i<files.size();i++) {
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
		}
		imd->set_option("format",texture_options->get_format());
		imd->set_option("flags",texture_options->get_flags());
		imd->set_option("quality",texture_options->get_quality());
		imd->set_option("atlas",true);
		imd->set_option("crop",crop_source->is_pressed());

		Error err = plugin->import(dst_file,imd);
		if (err) {

			error_dialog->set_text("Error importing: "+dst_file.get_file());
			error_dialog->popup_centered(Size2(200,100));
			return;

		}

	} else {


		for(int i=0;i<files.size();i++) {

			String dst_file = dst_path.plus_file(files[i].get_file());
			dst_file=dst_file.basename()+".tex";
			Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
			//imd->set_editor();
			imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
			imd->set_option("format",texture_options->get_format());
			imd->set_option("flags",texture_options->get_flags());
			imd->set_option("quality",texture_options->get_quality());
			imd->set_option("atlas",false);
			Error err = plugin->import(dst_file,imd);
			if (err) {

				error_dialog->set_text("Error importing: "+dst_file.get_file());
				error_dialog->popup_centered(Size2(200,100));
				return;

			}
		}
	}

	hide();
}