Disable code to add patches menu

(cherry picked from commit 395cb57256)
This commit is contained in:
Ev1lbl0w 2020-10-19 15:22:17 +01:00 committed by Rémi Verschelde
parent 7735cdaf8f
commit a2dcbfe0a8
No known key found for this signature in database
GPG key ID: C3336907360768E1
4 changed files with 0 additions and 263 deletions

View file

@ -202,35 +202,6 @@ bool EditorExportPreset::has_export_file(const String &p_path) {
return selected_files.has(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) { void EditorExportPreset::set_custom_features(const String &p_custom_features) {
custom_features = p_custom_features; custom_features = p_custom_features;
@ -1221,7 +1192,6 @@ void EditorExport::_save() {
config->set_value(section, "include_filter", preset->get_include_filter()); config->set_value(section, "include_filter", preset->get_include_filter());
config->set_value(section, "exclude_filter", preset->get_exclude_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, "export_path", preset->get_export_path());
config->set_value(section, "patch_list", preset->get_patches());
config->set_value(section, "script_export_mode", preset->get_script_export_mode()); config->set_value(section, "script_export_mode", preset->get_script_export_mode());
config->set_value(section, "script_encryption_key", preset->get_script_encryption_key()); config->set_value(section, "script_encryption_key", preset->get_script_encryption_key());
@ -1439,12 +1409,6 @@ void EditorExport::load_config() {
preset->set_exclude_filter(config->get_value(section, "exclude_filter")); preset->set_exclude_filter(config->get_value(section, "exclude_filter"));
preset->set_export_path(config->get_value(section, "export_path", "")); 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, "script_export_mode")) { if (config->has_section_key(section, "script_export_mode")) {
preset->set_script_export_mode(config->get_value(section, "script_export_mode")); preset->set_script_export_mode(config->get_value(section, "script_export_mode"));
} }

View file

@ -70,8 +70,6 @@ private:
Set<String> selected_files; Set<String> selected_files;
bool runnable; bool runnable;
Vector<String> patches;
friend class EditorExport; friend class EditorExport;
friend class EditorExportPlatform; friend class EditorExportPlatform;
@ -118,12 +116,6 @@ public:
void set_exclude_filter(const String &p_exclude); void set_exclude_filter(const String &p_exclude);
String get_exclude_filter() const; 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); void set_custom_features(const String &p_custom_features);
String get_custom_features() const; String get_custom_features() const;

View file

@ -62,9 +62,6 @@ void ProjectExportDialog::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons")); duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons"));
delete_preset->set_icon(get_icon("Remove", "EditorIcons")); delete_preset->set_icon(get_icon("Remove", "EditorIcons"));
Control *panel = custom_feature_display->get_parent_control();
if (panel)
panel->add_style_override("panel", get_stylebox("bg", "Tree"));
} break; } break;
} }
} }
@ -205,7 +202,6 @@ void ProjectExportDialog::_edit_preset(int p_index) {
duplicate_preset->set_disabled(true); duplicate_preset->set_disabled(true);
delete_preset->set_disabled(true); delete_preset->set_disabled(true);
sections->hide(); sections->hide();
patches->clear();
export_error->hide(); export_error->hide();
export_templates_error->hide(); export_templates_error->hide();
return; return;
@ -241,32 +237,6 @@ void ProjectExportDialog::_edit_preset(int p_index) {
include_filters->set_text(current->get_include_filter()); include_filters->set_text(current->get_include_filter());
exclude_filters->set_text(current->get_exclude_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, get_icon("Remove", "EditorIcons"), 0);
patch->add_button(0, get_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, get_icon("folder", "FileDialog"), 1);
_fill_resource_tree(); _fill_resource_tree();
bool needs_templates; bool needs_templates;
@ -382,79 +352,6 @@ void ProjectExportDialog::_tab_changed(int) {
_update_feature_list(); _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_minsize();
} else {
patch_dialog->popup_centered_ratio();
}
}
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) { void ProjectExportDialog::_update_parameters(const String &p_edited_property) {
_update_current_preset(); _update_current_preset();
@ -603,10 +500,6 @@ void ProjectExportDialog::_duplicate_preset() {
preset->set_export_filter(current->get_export_filter()); preset->set_export_filter(current->get_export_filter());
preset->set_include_filter(current->get_include_filter()); preset->set_include_filter(current->get_include_filter());
preset->set_exclude_filter(current->get_exclude_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()); preset->set_custom_features(current->get_custom_features());
for (const List<PropertyInfo>::Element *E = current->get_properties().front(); E; E = E->next()) { for (const List<PropertyInfo>::Element *E = current->get_properties().front(); E; E = E->next()) {
@ -658,23 +551,6 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
set_drag_preview(drag); 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));
set_drag_preview(label);
return d; return d;
} }
} }
@ -691,20 +567,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)) if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point))
return false; 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; return true;
@ -740,32 +602,6 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
_edit_preset(to_pos); _edit_preset(to_pos);
else else
_edit_preset(presets->get_item_count() - 1); _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();
} }
} }
@ -1043,10 +879,6 @@ void ProjectExportDialog::_bind_methods() {
ClassDB::bind_method("_export_type_changed", &ProjectExportDialog::_export_type_changed); ClassDB::bind_method("_export_type_changed", &ProjectExportDialog::_export_type_changed);
ClassDB::bind_method("_filter_changed", &ProjectExportDialog::_filter_changed); ClassDB::bind_method("_filter_changed", &ProjectExportDialog::_filter_changed);
ClassDB::bind_method("_tree_changed", &ProjectExportDialog::_tree_changed); ClassDB::bind_method("_tree_changed", &ProjectExportDialog::_tree_changed);
ClassDB::bind_method("_patch_button_pressed", &ProjectExportDialog::_patch_button_pressed);
ClassDB::bind_method("_patch_selected", &ProjectExportDialog::_patch_selected);
ClassDB::bind_method("_patch_deleted", &ProjectExportDialog::_patch_deleted);
ClassDB::bind_method("_patch_edited", &ProjectExportDialog::_patch_edited);
ClassDB::bind_method("_export_pck_zip", &ProjectExportDialog::_export_pck_zip); ClassDB::bind_method("_export_pck_zip", &ProjectExportDialog::_export_pck_zip);
ClassDB::bind_method("_export_pck_zip_selected", &ProjectExportDialog::_export_pck_zip_selected); ClassDB::bind_method("_export_pck_zip_selected", &ProjectExportDialog::_export_pck_zip_selected);
ClassDB::bind_method("_open_export_template_manager", &ProjectExportDialog::_open_export_template_manager); ClassDB::bind_method("_open_export_template_manager", &ProjectExportDialog::_open_export_template_manager);
@ -1184,45 +1016,6 @@ ProjectExportDialog::ProjectExportDialog() {
exclude_filters); exclude_filters);
exclude_filters->connect("text_changed", this, "_filter_changed"); exclude_filters->connect("text_changed", this, "_filter_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(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(EditorFileDialog);
patch_dialog->add_filter("*.pck ; " + TTR("Pack File"));
patch_dialog->set_mode(EditorFileDialog::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);
// Feature tags. // Feature tags.
VBoxContainer *feature_vb = memnew(VBoxContainer); VBoxContainer *feature_vb = memnew(VBoxContainer);

View file

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