浏览代码

Disable code to add patches menu

Ev1lbl0w 4 年之前
父节点
当前提交
395cb57256
共有 4 个文件被更改,包括 0 次插入259 次删除
  1. 0 36
      editor/editor_export.cpp
  2. 0 8
      editor/editor_export.h
  3. 0 203
      editor/project_export.cpp
  4. 0 12
      editor/project_export.h

+ 0 - 36
editor/editor_export.cpp

@@ -185,35 +185,6 @@ bool EditorExportPreset::has_export_file(const String &p_path) {
 	return selected_files.has(p_path);
 }
 
-void EditorExportPreset::add_patch(const String &p_path, int p_at_pos) {
-	if (p_at_pos < 0) {
-		patches.push_back(p_path);
-	} else {
-		patches.insert(p_at_pos, p_path);
-	}
-	EditorExport::singleton->save_presets();
-}
-
-void EditorExportPreset::remove_patch(int p_idx) {
-	patches.remove(p_idx);
-	EditorExport::singleton->save_presets();
-}
-
-void EditorExportPreset::set_patch(int p_index, const String &p_path) {
-	ERR_FAIL_INDEX(p_index, patches.size());
-	patches.write[p_index] = p_path;
-	EditorExport::singleton->save_presets();
-}
-
-String EditorExportPreset::get_patch(int p_index) {
-	ERR_FAIL_INDEX_V(p_index, patches.size(), String());
-	return patches[p_index];
-}
-
-Vector<String> EditorExportPreset::get_patches() const {
-	return patches;
-}
-
 void EditorExportPreset::set_custom_features(const String &p_custom_features) {
 	custom_features = p_custom_features;
 	EditorExport::singleton->save_presets();
@@ -1341,7 +1312,6 @@ void EditorExport::_save() {
 		config->set_value(section, "include_filter", preset->get_include_filter());
 		config->set_value(section, "exclude_filter", preset->get_exclude_filter());
 		config->set_value(section, "export_path", preset->get_export_path());
-		config->set_value(section, "patch_list", preset->get_patches());
 		config->set_value(section, "encryption_include_filters", preset->get_enc_in_filter());
 		config->set_value(section, "encryption_exclude_filters", preset->get_enc_ex_filter());
 		config->set_value(section, "encrypt_pck", preset->get_enc_pck());
@@ -1529,12 +1499,6 @@ void EditorExport::load_config() {
 		preset->set_exclude_filter(config->get_value(section, "exclude_filter"));
 		preset->set_export_path(config->get_value(section, "export_path", ""));
 
-		Vector<String> patch_list = config->get_value(section, "patch_list");
-
-		for (int i = 0; i < patch_list.size(); i++) {
-			preset->add_patch(patch_list[i]);
-		}
-
 		if (config->has_section_key(section, "encrypt_pck")) {
 			preset->set_enc_pck(config->get_value(section, "encrypt_pck"));
 		}

+ 0 - 8
editor/editor_export.h

@@ -68,8 +68,6 @@ private:
 	Set<String> selected_files;
 	bool runnable = false;
 
-	Vector<String> patches;
-
 	friend class EditorExport;
 	friend class EditorExportPlatform;
 
@@ -121,12 +119,6 @@ public:
 	void set_exclude_filter(const String &p_exclude);
 	String get_exclude_filter() const;
 
-	void add_patch(const String &p_path, int p_at_pos = -1);
-	void set_patch(int p_index, const String &p_path);
-	String get_patch(int p_index);
-	void remove_patch(int p_idx);
-	Vector<String> get_patches() const;
-
 	void set_custom_features(const String &p_custom_features);
 	String get_custom_features() const;
 

+ 0 - 203
editor/project_export.cpp

@@ -51,10 +51,6 @@
 void ProjectExportDialog::_theme_changed() {
 	duplicate_preset->set_icon(presets->get_theme_icon("Duplicate", "EditorIcons"));
 	delete_preset->set_icon(presets->get_theme_icon("Remove", "EditorIcons"));
-	Control *panel = custom_feature_display->get_parent_control();
-	if (panel) {
-		panel->add_theme_style_override("panel", patches->get_theme_stylebox("bg", "Tree"));
-	}
 }
 
 void ProjectExportDialog::_notification(int p_what) {
@@ -68,7 +64,6 @@ void ProjectExportDialog::_notification(int p_what) {
 			duplicate_preset->set_icon(presets->get_theme_icon("Duplicate", "EditorIcons"));
 			delete_preset->set_icon(presets->get_theme_icon("Remove", "EditorIcons"));
 			connect("confirmed", callable_mp(this, &ProjectExportDialog::_export_pck_zip));
-			custom_feature_display->get_parent_control()->add_theme_style_override("panel", patches->get_theme_stylebox("bg", "Tree"));
 		} break;
 	}
 }
@@ -205,7 +200,6 @@ void ProjectExportDialog::_edit_preset(int p_index) {
 		duplicate_preset->set_disabled(true);
 		delete_preset->set_disabled(true);
 		sections->hide();
-		patches->clear();
 		export_error->hide();
 		export_templates_error->hide();
 		return;
@@ -241,34 +235,6 @@ void ProjectExportDialog::_edit_preset(int p_index) {
 	include_filters->set_text(current->get_include_filter());
 	exclude_filters->set_text(current->get_exclude_filter());
 
-	patches->clear();
-	TreeItem *patch_root = patches->create_item();
-	Vector<String> patchlist = current->get_patches();
-	for (int i = 0; i < patchlist.size(); i++) {
-		TreeItem *patch = patches->create_item(patch_root);
-		patch->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
-		String file = patchlist[i].get_file();
-		patch->set_editable(0, true);
-		patch->set_text(0, file.get_file().replace("*", ""));
-		if (file.ends_with("*")) {
-			patch->set_checked(0, true);
-		}
-		patch->set_tooltip(0, patchlist[i]);
-		patch->set_metadata(0, i);
-		patch->add_button(0, presets->get_theme_icon("Remove", "EditorIcons"), 0);
-		patch->add_button(0, presets->get_theme_icon("folder", "FileDialog"), 1);
-	}
-
-	TreeItem *patch_add = patches->create_item(patch_root);
-	patch_add->set_metadata(0, patchlist.size());
-	if (patchlist.size() == 0) {
-		patch_add->set_text(0, TTR("Add initial export..."));
-	} else {
-		patch_add->set_text(0, TTR("Add previous patches..."));
-	}
-
-	patch_add->add_button(0, presets->get_theme_icon("folder", "FileDialog"), 1);
-
 	_fill_resource_tree();
 
 	bool needs_templates;
@@ -401,74 +367,6 @@ void ProjectExportDialog::_tab_changed(int) {
 	_update_feature_list();
 }
 
-void ProjectExportDialog::_patch_button_pressed(Object *p_item, int p_column, int p_id) {
-	TreeItem *ti = (TreeItem *)p_item;
-
-	patch_index = ti->get_metadata(0);
-
-	Ref<EditorExportPreset> current = get_current_preset();
-	ERR_FAIL_COND(current.is_null());
-
-	if (p_id == 0) {
-		Vector<String> patches = current->get_patches();
-		ERR_FAIL_INDEX(patch_index, patches.size());
-		patch_erase->set_text(vformat(TTR("Delete patch '%s' from list?"), patches[patch_index].get_file()));
-		patch_erase->popup_centered();
-	} else {
-		patch_dialog->popup_file_dialog();
-	}
-}
-
-void ProjectExportDialog::_patch_edited() {
-	TreeItem *item = patches->get_edited();
-	if (!item) {
-		return;
-	}
-	int index = item->get_metadata(0);
-
-	Ref<EditorExportPreset> current = get_current_preset();
-	ERR_FAIL_COND(current.is_null());
-
-	Vector<String> patches = current->get_patches();
-
-	ERR_FAIL_INDEX(index, patches.size());
-
-	String patch = patches[index].replace("*", "");
-
-	if (item->is_checked(0)) {
-		patch += "*";
-	}
-
-	current->set_patch(index, patch);
-}
-
-void ProjectExportDialog::_patch_selected(const String &p_path) {
-	Ref<EditorExportPreset> current = get_current_preset();
-	ERR_FAIL_COND(current.is_null());
-
-	Vector<String> patches = current->get_patches();
-
-	if (patch_index >= patches.size()) {
-		current->add_patch(ProjectSettings::get_singleton()->get_resource_path().path_to(p_path) + "*");
-	} else {
-		String enabled = patches[patch_index].ends_with("*") ? String("*") : String();
-		current->set_patch(patch_index, ProjectSettings::get_singleton()->get_resource_path().path_to(p_path) + enabled);
-	}
-
-	_update_current_preset();
-}
-
-void ProjectExportDialog::_patch_deleted() {
-	Ref<EditorExportPreset> current = get_current_preset();
-	ERR_FAIL_COND(current.is_null());
-
-	Vector<String> patches = current->get_patches();
-	if (patch_index < patches.size()) {
-		current->remove_patch(patch_index);
-		_update_current_preset();
-	}
-}
-
 void ProjectExportDialog::_update_parameters(const String &p_edited_property) {
 	_update_current_preset();
 }
@@ -663,10 +561,6 @@ void ProjectExportDialog::_duplicate_preset() {
 	preset->set_export_filter(current->get_export_filter());
 	preset->set_include_filter(current->get_include_filter());
 	preset->set_exclude_filter(current->get_exclude_filter());
-	Vector<String> list = current->get_patches();
-	for (int i = 0; i < list.size(); i++) {
-		preset->add_patch(list[i]);
-	}
 	preset->set_custom_features(current->get_custom_features());
 
 	for (const List<PropertyInfo>::Element *E = current->get_properties().front(); E; E = E->next()) {
@@ -716,21 +610,6 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
 
 			presets->set_drag_preview(drag);
 
-			return d;
-		}
-	} else if (p_from == patches) {
-		TreeItem *item = patches->get_item_at_position(p_point);
-
-		if (item && item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK) {
-			int metadata = item->get_metadata(0);
-			Dictionary d;
-			d["type"] = "export_patch";
-			d["patch"] = metadata;
-
-			Label *label = memnew(Label);
-			label->set_text(item->get_text(0));
-			patches->set_drag_preview(label);
-
 			return d;
 		}
 	}
@@ -748,19 +627,6 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant
 		if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point)) {
 			return false;
 		}
-	} else if (p_from == patches) {
-		Dictionary d = p_data;
-		if (!d.has("type") || String(d["type"]) != "export_patch") {
-			return false;
-		}
-
-		patches->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM);
-
-		TreeItem *item = patches->get_item_at_position(p_point);
-
-		if (!item) {
-			return false;
-		}
 	}
 
 	return true;
@@ -797,33 +663,6 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
 		} else {
 			_edit_preset(presets->get_item_count() - 1);
 		}
-	} else if (p_from == patches) {
-		Dictionary d = p_data;
-		if (!d.has("type") || String(d["type"]) != "export_patch") {
-			return;
-		}
-
-		int from_pos = d["patch"];
-
-		TreeItem *item = patches->get_item_at_position(p_point);
-		if (!item) {
-			return;
-		}
-
-		int to_pos = item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK ? int(item->get_metadata(0)) : -1;
-
-		if (to_pos == from_pos) {
-			return;
-		} else if (to_pos > from_pos) {
-			to_pos--;
-		}
-
-		Ref<EditorExportPreset> preset = get_current_preset();
-		String patch = preset->get_patch(from_pos);
-		preset->remove_patch(from_pos);
-		preset->add_patch(patch, to_pos);
-
-		_update_current_preset();
 	}
 }
 
@@ -1222,48 +1061,6 @@ ProjectExportDialog::ProjectExportDialog() {
 	script_mode->add_item(TTR("Compiled"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED);
 	script_mode->connect("item_selected", callable_mp(this, &ProjectExportDialog::_script_export_mode_changed));
 
-	// Patch packages.
-
-	VBoxContainer *patch_vb = memnew(VBoxContainer);
-	sections->add_child(patch_vb);
-	patch_vb->set_name(TTR("Patches"));
-
-	// FIXME: Patching support doesn't seem properly implemented yet, so we hide it.
-	// The rest of the code is still kept for now, in the hope that it will be made
-	// functional and reactivated.
-	patch_vb->hide();
-
-	patches = memnew(Tree);
-	patch_vb->add_child(patches);
-	patches->set_v_size_flags(Control::SIZE_EXPAND_FILL);
-	patches->set_hide_root(true);
-	patches->connect("button_pressed", callable_mp(this, &ProjectExportDialog::_patch_button_pressed));
-	patches->connect("item_edited", callable_mp(this, &ProjectExportDialog::_patch_edited));
-#ifndef _MSC_VER
-#warning must reimplement drag forward
-#endif
-	//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(EditorFileDialog);
-	patch_dialog->add_filter("*.pck ; " + TTR("Pack File"));
-	patch_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
-	patch_dialog->connect("file_selected", callable_mp(this, &ProjectExportDialog::_patch_selected));
-	add_child(patch_dialog);
-
-	patch_erase = memnew(ConfirmationDialog);
-	patch_erase->get_ok()->set_text(TTR("Delete"));
-	patch_erase->connect("confirmed", callable_mp(this, &ProjectExportDialog::_patch_deleted));
-	add_child(patch_erase);
-
 	// Feature tags.
 
 	VBoxContainer *feature_vb = memnew(VBoxContainer);

+ 0 - 12
editor/project_export.h

@@ -87,12 +87,6 @@ private:
 
 	StringName editor_icons;
 
-	Tree *patches;
-	Button *patch_export;
-	int patch_index;
-	EditorFileDialog *patch_dialog;
-	ConfirmationDialog *patch_erase;
-
 	Button *export_button;
 	Button *export_all_button;
 	AcceptDialog *export_all_dialog;
@@ -109,9 +103,6 @@ private:
 
 	String default_filename;
 
-	void _patch_selected(const String &p_path);
-	void _patch_deleted();
-
 	void _runnable_pressed();
 	void _update_parameters(const String &p_edited_property);
 	void _name_changed(const String &p_string);
@@ -133,9 +124,6 @@ private:
 	bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, bool p_only_scenes);
 	void _tree_changed();
 
-	void _patch_button_pressed(Object *p_item, int p_column, int p_id);
-	void _patch_edited();
-
 	Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
 	bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
 	void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);