Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove references to compiled GDScript in export #71752

Merged
merged 1 commit into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions editor/export/editor_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ void EditorExport::_save() {
config->set_value(section, "encryption_exclude_filters", preset->get_enc_ex_filter());
config->set_value(section, "encrypt_pck", preset->get_enc_pck());
config->set_value(section, "encrypt_directory", preset->get_enc_directory());
config->set_value(section, "script_export_mode", preset->get_script_export_mode());
config->set_value(section, "script_encryption_key", preset->get_script_encryption_key());

String option_section = "preset." + itos(i) + ".options";
Expand Down Expand Up @@ -264,9 +263,6 @@ void EditorExport::load_config() {
if (config->has_section_key(section, "encryption_exclude_filters")) {
preset->set_enc_ex_filter(config->get_value(section, "encryption_exclude_filters"));
}
if (config->has_section_key(section, "script_export_mode")) {
preset->set_script_export_mode(config->get_value(section, "script_export_mode"));
}
if (config->has_section_key(section, "script_encryption_key")) {
preset->set_script_encryption_key(config->get_value(section, "script_encryption_key"));
}
Expand Down
9 changes: 0 additions & 9 deletions editor/export/editor_export_preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,6 @@ bool EditorExportPreset::get_enc_directory() const {
return enc_directory;
}

void EditorExportPreset::set_script_export_mode(int p_mode) {
script_mode = p_mode;
EditorExport::singleton->save_presets();
}

int EditorExportPreset::get_script_export_mode() const {
return script_mode;
}

void EditorExportPreset::set_script_encryption_key(const String &p_key) {
script_key = p_key;
EditorExport::singleton->save_presets();
Expand Down
9 changes: 0 additions & 9 deletions editor/export/editor_export_preset.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ class EditorExportPreset : public RefCounted {
EXCLUDE_SELECTED_RESOURCES,
};

enum ScriptExportMode {
MODE_SCRIPT_TEXT,
MODE_SCRIPT_COMPILED,
};

private:
Ref<EditorExportPlatform> platform;
ExportFilter export_filter = EXPORT_ALL_RESOURCES;
Expand Down Expand Up @@ -78,7 +73,6 @@ class EditorExportPreset : public RefCounted {
bool enc_pck = false;
bool enc_directory = false;

int script_mode = MODE_SCRIPT_COMPILED;
String script_key;

protected:
Expand Down Expand Up @@ -132,9 +126,6 @@ class EditorExportPreset : public RefCounted {
void set_enc_directory(bool p_enabled);
bool get_enc_directory() const;

void set_script_export_mode(int p_mode);
int get_script_export_mode() const;

void set_script_encryption_key(const String &p_key);
String get_script_encryption_key() const;

Expand Down
22 changes: 0 additions & 22 deletions editor/export/project_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,6 @@ void ProjectExportDialog::_edit_preset(int p_index) {
bool enc_directory_mode = current->get_enc_directory();
enc_directory->set_pressed(enc_directory_mode);

int script_export_mode = current->get_script_export_mode();
script_mode->select(script_export_mode);

String key = current->get_script_encryption_key();
if (!updating_script_key) {
script_key->set_text(key);
Expand Down Expand Up @@ -513,19 +510,6 @@ void ProjectExportDialog::_enc_directory_changed(bool p_pressed) {
_update_current_preset();
}

void ProjectExportDialog::_script_export_mode_changed(int p_mode) {
if (updating) {
return;
}

Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());

current->set_script_export_mode(p_mode);

_update_current_preset();
}

void ProjectExportDialog::_script_encryption_key_changed(const String &p_key) {
if (updating) {
return;
Expand Down Expand Up @@ -1111,12 +1095,6 @@ ProjectExportDialog::ProjectExportDialog() {
exclude_filters);
exclude_filters->connect("text_changed", callable_mp(this, &ProjectExportDialog::_filter_changed));

script_mode = memnew(OptionButton);
resources_vb->add_margin_child(TTR("GDScript Export Mode:"), script_mode);
script_mode->add_item(TTR("Text"), (int)EditorExportPreset::MODE_SCRIPT_TEXT);
script_mode->add_item(TTR("Compiled Bytecode (Faster Loading)"), (int)EditorExportPreset::MODE_SCRIPT_COMPILED);
script_mode->connect("item_selected", callable_mp(this, &ProjectExportDialog::_script_export_mode_changed));

// Feature tags.

VBoxContainer *feature_vb = memnew(VBoxContainer);
Expand Down
2 changes: 0 additions & 2 deletions editor/export/project_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class ProjectExportDialog : public ConfirmationDialog {
LineEdit *custom_features = nullptr;
RichTextLabel *custom_feature_display = nullptr;

OptionButton *script_mode = nullptr;
LineEdit *script_key = nullptr;
Label *script_key_error = nullptr;

Expand Down Expand Up @@ -152,7 +151,6 @@ class ProjectExportDialog : public ConfirmationDialog {
void _enc_pck_changed(bool p_pressed);
void _enc_directory_changed(bool p_pressed);
void _enc_filters_changed(const String &p_text);
void _script_export_mode_changed(int p_mode);
void _script_encryption_key_changed(const String &p_key);
bool _validate_script_encryption_key(const String &p_key);

Expand Down
6 changes: 0 additions & 6 deletions modules/gdscript/doc_classes/GDScript.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
<link title="GDScript documentation index">$DOCS_URL/tutorials/scripting/gdscript/index.html</link>
</tutorials>
<methods>
<method name="get_as_byte_code" qualifiers="const">
<return type="PackedByteArray" />
<description>
Returns byte code for the script source code.
</description>
</method>
<method name="new" qualifiers="vararg">
<return type="Variant" />
<description>
Expand Down
19 changes: 1 addition & 18 deletions modules/gdscript/gdscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,17 +1007,6 @@ void GDScript::_get_property_list(List<PropertyInfo> *p_properties) const {

void GDScript::_bind_methods() {
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &GDScript::_new, MethodInfo("new"));

ClassDB::bind_method(D_METHOD("get_as_byte_code"), &GDScript::get_as_byte_code);
}

Vector<uint8_t> GDScript::get_as_byte_code() const {
return Vector<uint8_t>();
};

// TODO: Fully remove this. There's not this kind of "bytecode" anymore.
Error GDScript::load_byte_code(const String &p_path) {
return ERR_COMPILATION_FAILED;
}

void GDScript::set_path(const String &p_path, bool p_take_over) {
Expand Down Expand Up @@ -2647,8 +2636,6 @@ Ref<Resource> ResourceFormatLoaderGDScript::load(const String &p_path, const Str
Error err;
Ref<GDScript> scr = GDScriptCache::get_full_script(p_path, err, "", p_cache_mode == CACHE_MODE_IGNORE);

// TODO: Reintroduce binary and encrypted scripts.

if (scr.is_null()) {
// Don't fail loading because of parsing error.
scr.instantiate();
Expand All @@ -2663,9 +2650,6 @@ Ref<Resource> ResourceFormatLoaderGDScript::load(const String &p_path, const Str

void ResourceFormatLoaderGDScript::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("gd");
// TODO: Reintroduce binary and encrypted scripts.
// p_extensions->push_back("gdc");
// p_extensions->push_back("gde");
}

bool ResourceFormatLoaderGDScript::handles_type(const String &p_type) const {
Expand All @@ -2674,8 +2658,7 @@ bool ResourceFormatLoaderGDScript::handles_type(const String &p_type) const {

String ResourceFormatLoaderGDScript::get_resource_type(const String &p_path) const {
String el = p_path.get_extension().to_lower();
// TODO: Reintroduce binary and encrypted scripts.
if (el == "gd" /*|| el == "gdc" || el == "gde"*/) {
if (el == "gd") {
return "GDScript";
}
return "";
Expand Down
3 changes: 0 additions & 3 deletions modules/gdscript/gdscript.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ class GDScript : public Script {
virtual void set_path(const String &p_path, bool p_take_over = false) override;
String get_script_path() const;
Error load_source_code(const String &p_path);
Error load_byte_code(const String &p_path);

Vector<uint8_t> get_as_byte_code() const;

bool get_property_default_value(const StringName &p_property, Variant &r_value) const override;

Expand Down
5 changes: 1 addition & 4 deletions modules/gdscript/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,18 @@ class EditorExportGDScript : public EditorExportPlugin {

public:
virtual void _export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features) override {
int script_mode = EditorExportPreset::MODE_SCRIPT_COMPILED;
String script_key;

const Ref<EditorExportPreset> &preset = get_export_preset();

if (preset.is_valid()) {
script_mode = preset->get_script_export_mode();
script_key = preset->get_script_encryption_key().to_lower();
}

if (!p_path.ends_with(".gd") || script_mode == EditorExportPreset::MODE_SCRIPT_TEXT) {
if (!p_path.ends_with(".gd")) {
return;
}

// TODO: Re-add compiled GDScript on export.
return;
}

Expand Down