summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/CODEOWNERS (renamed from CODEOWNERS)0
-rw-r--r--.github/FUNDING.yml2
-rw-r--r--.github/ISSUE_TEMPLATE.md (renamed from ISSUE_TEMPLATE.md)0
-rw-r--r--core/io/config_file.cpp94
-rw-r--r--core/io/config_file.h9
-rw-r--r--core/os/os.cpp2
-rw-r--r--editor/code_editor.cpp2
-rw-r--r--modules/gdscript/gdscript_parser.cpp26
-rw-r--r--modules/upnp/doc_classes/UPNP.xml11
-rw-r--r--scene/2d/cpu_particles_2d.cpp3
-rw-r--r--scene/2d/particles_2d.cpp26
-rw-r--r--scene/3d/cpu_particles.cpp3
-rw-r--r--scene/3d/particles.cpp28
13 files changed, 179 insertions, 27 deletions
diff --git a/CODEOWNERS b/.github/CODEOWNERS
index 399fca03e8..399fca03e8 100644
--- a/CODEOWNERS
+++ b/.github/CODEOWNERS
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000000..0820ab175d
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,2 @@
+patreon: godotengine
+custom: https://godotengine.org/donate
diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 1ca0b3694c..1ca0b3694c 100644
--- a/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index 871e21df3e..f7fb72c089 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -30,7 +30,7 @@
#include "config_file.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access_encrypted.h"
#include "core/os/keyboard.h"
#include "core/variant_parser.h"
@@ -137,6 +137,48 @@ Error ConfigFile::save(const String &p_path) {
return err;
}
+ return _internal_save(file);
+}
+
+Error ConfigFile::save_encrypted(const String &p_path, const Vector<uint8_t> &p_key) {
+
+ Error err;
+ FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE, &err);
+
+ if (err)
+ return err;
+
+ FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
+ err = fae->open_and_parse(f, p_key, FileAccessEncrypted::MODE_WRITE_AES256);
+ if (err) {
+ memdelete(fae);
+ memdelete(f);
+ return err;
+ }
+ return _internal_save(fae);
+}
+
+Error ConfigFile::save_encrypted_pass(const String &p_path, const String &p_pass) {
+
+ Error err;
+ FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE, &err);
+
+ if (err)
+ return err;
+
+ FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
+ err = fae->open_and_parse_password(f, p_pass, FileAccessEncrypted::MODE_WRITE_AES256);
+ if (err) {
+ memdelete(fae);
+ memdelete(f);
+ return err;
+ }
+
+ return _internal_save(fae);
+}
+
+Error ConfigFile::_internal_save(FileAccess *file) {
+
for (OrderedHashMap<String, OrderedHashMap<String, Variant> >::Element E = values.front(); E; E = E.next()) {
if (E != values.front())
@@ -164,6 +206,48 @@ Error ConfigFile::load(const String &p_path) {
if (!f)
return ERR_CANT_OPEN;
+ return _internal_load(p_path, f);
+}
+
+Error ConfigFile::load_encrypted(const String &p_path, const Vector<uint8_t> &p_key) {
+
+ Error err;
+ FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
+
+ if (err)
+ return err;
+
+ FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
+ err = fae->open_and_parse(f, p_key, FileAccessEncrypted::MODE_READ);
+ if (err) {
+ memdelete(fae);
+ memdelete(f);
+ return err;
+ }
+ return _internal_load(p_path, fae);
+}
+
+Error ConfigFile::load_encrypted_pass(const String &p_path, const String &p_pass) {
+
+ Error err;
+ FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
+
+ if (err)
+ return err;
+
+ FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
+ err = fae->open_and_parse_password(f, p_pass, FileAccessEncrypted::MODE_READ);
+ if (err) {
+ memdelete(fae);
+ memdelete(f);
+ return err;
+ }
+
+ return _internal_load(p_path, fae);
+}
+
+Error ConfigFile::_internal_load(const String &p_path, FileAccess *f) {
+
VariantParser::StreamFile stream;
stream.f = f;
@@ -182,7 +266,7 @@ Error ConfigFile::load(const String &p_path) {
next_tag.fields.clear();
next_tag.name = String();
- err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ Error err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
if (err == ERR_FILE_EOF) {
memdelete(f);
return OK;
@@ -215,6 +299,12 @@ void ConfigFile::_bind_methods() {
ClassDB::bind_method(D_METHOD("load", "path"), &ConfigFile::load);
ClassDB::bind_method(D_METHOD("save", "path"), &ConfigFile::save);
+
+ ClassDB::bind_method(D_METHOD("load_encrypted", "path", "key"), &ConfigFile::load_encrypted);
+ ClassDB::bind_method(D_METHOD("load_encrypted_pass", "path", "pass"), &ConfigFile::load_encrypted_pass);
+
+ ClassDB::bind_method(D_METHOD("save_encrypted", "path", "key"), &ConfigFile::save_encrypted);
+ ClassDB::bind_method(D_METHOD("save_encrypted_pass", "path", "pass"), &ConfigFile::save_encrypted_pass);
}
ConfigFile::ConfigFile() {
diff --git a/core/io/config_file.h b/core/io/config_file.h
index 36e5c0ca7d..3ab6fef868 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -32,6 +32,7 @@
#define CONFIG_FILE_H
#include "core/ordered_hash_map.h"
+#include "core/os/file_access.h"
#include "core/reference.h"
class ConfigFile : public Reference {
@@ -42,6 +43,8 @@ class ConfigFile : public Reference {
PoolStringArray _get_sections() const;
PoolStringArray _get_section_keys(const String &p_section) const;
+ Error _internal_load(const String &p_path, FileAccess *f);
+ Error _internal_save(FileAccess *file);
protected:
static void _bind_methods();
@@ -61,6 +64,12 @@ public:
Error save(const String &p_path);
Error load(const String &p_path);
+ Error load_encrypted(const String &p_path, const Vector<uint8_t> &p_key);
+ Error load_encrypted_pass(const String &p_path, const String &p_pass);
+
+ Error save_encrypted(const String &p_path, const Vector<uint8_t> &p_key);
+ Error save_encrypted_pass(const String &p_path, const String &p_pass);
+
ConfigFile();
};
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 027740c6a9..08067385ab 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -760,6 +760,8 @@ OS::OS() {
}
OS::~OS() {
+ if (last_error)
+ memfree(last_error);
memdelete(_logger);
singleton = NULL;
}
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 848921d870..ed50c7914e 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -166,6 +166,8 @@ bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col)
result_line = -1;
result_col = -1;
text_edit->set_search_text("");
+ text_edit->set_search_flags(p_flags);
+ text_edit->set_current_search_result(line, col);
set_error(text.empty() ? "" : TTR("No Matches"));
}
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 85b270b369..a4a27c39d7 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -776,7 +776,8 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
_add_warning(GDScriptWarning::UNASSIGNED_VARIABLE_OP_ASSIGN, -1, identifier.operator String());
}
- } break;
+ FALLTHROUGH;
+ }
case GDScriptTokenizer::TK_OP_ASSIGN: {
lv->assignments += 1;
lv->usages--; // Assignment is not really usage
@@ -846,24 +847,11 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (current_function) {
int arg_idx = current_function->arguments.find(identifier);
if (arg_idx != -1) {
- switch (tokenizer->get_token()) {
- case GDScriptTokenizer::TK_OP_ASSIGN_ADD:
- case GDScriptTokenizer::TK_OP_ASSIGN_BIT_AND:
- case GDScriptTokenizer::TK_OP_ASSIGN_BIT_OR:
- case GDScriptTokenizer::TK_OP_ASSIGN_BIT_XOR:
- case GDScriptTokenizer::TK_OP_ASSIGN_DIV:
- case GDScriptTokenizer::TK_OP_ASSIGN_MOD:
- case GDScriptTokenizer::TK_OP_ASSIGN_MUL:
- case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_LEFT:
- case GDScriptTokenizer::TK_OP_ASSIGN_SHIFT_RIGHT:
- case GDScriptTokenizer::TK_OP_ASSIGN_SUB:
- case GDScriptTokenizer::TK_OP_ASSIGN: {
- // Assignment is not really usage
- current_function->arguments_usage.write[arg_idx] = current_function->arguments_usage[arg_idx] - 1;
- } break;
- default: {
- current_function->arguments_usage.write[arg_idx] = current_function->arguments_usage[arg_idx] + 1;
- }
+ if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) {
+ // Assignment is not really usage
+ current_function->arguments_usage.write[arg_idx] = current_function->arguments_usage[arg_idx] - 1;
+ } else {
+ current_function->arguments_usage.write[arg_idx] = current_function->arguments_usage[arg_idx] + 1;
}
}
}
diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml
index 6530fd614e..d3eb21e159 100644
--- a/modules/upnp/doc_classes/UPNP.xml
+++ b/modules/upnp/doc_classes/UPNP.xml
@@ -5,6 +5,17 @@
</brief_description>
<description>
Provides UPNP functionality to discover [UPNPDevice]s on the local network and execute commands on them, like managing port mappings (port forwarding) and querying the local and remote network IP address. Note that methods on this class are synchronous and block the calling thread.
+ To forward a specific port:
+ [codeblock]
+ const PORT = 7777
+ var upnp = UPNP.new()
+ upnp.discover(2000, 2, "InternetGatewayDevice")
+ upnp.add_port_mapping(port)
+ [/codeblock]
+ To close a specific port (e.g. after you have finished using it):
+ [codeblock]
+ upnp.delete_port_mapping(port)
+ [/codeblock]
</description>
<tutorials>
</tutorials>
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index fba1c26d1c..faa0a08d10 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -532,7 +532,8 @@ void CPUParticles2D::_particles_process(float p_delta) {
time = Math::fmod(time, lifetime);
cycle++;
if (one_shot && cycle > 0) {
- emitting = false;
+ set_emitting(false);
+ _change_notify();
}
}
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 823794c3ba..7759897420 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -41,6 +41,12 @@
void Particles2D::set_emitting(bool p_emitting) {
VS::get_singleton()->particles_set_emitting(particles, p_emitting);
+
+ if (p_emitting && one_shot) {
+ set_process_internal(true);
+ } else if (!p_emitting) {
+ set_process_internal(false);
+ }
}
void Particles2D::set_amount(int p_amount) {
@@ -60,8 +66,16 @@ void Particles2D::set_one_shot(bool p_enable) {
one_shot = p_enable;
VS::get_singleton()->particles_set_one_shot(particles, one_shot);
- if (!one_shot && is_emitting())
- VisualServer::get_singleton()->particles_restart(particles);
+
+ if (is_emitting()) {
+
+ set_process_internal(true);
+ if (!one_shot)
+ VisualServer::get_singleton()->particles_restart(particles);
+ }
+
+ if (!one_shot)
+ set_process_internal(false);
}
void Particles2D::set_pre_process_time(float p_time) {
@@ -314,6 +328,14 @@ void Particles2D::_notification(int p_what) {
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
_update_particle_emission_transform();
}
+
+ if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
+
+ if (one_shot && !is_emitting()) {
+ _change_notify();
+ set_process_internal(false);
+ }
+ }
}
void Particles2D::_bind_methods() {
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index ee5d416930..6ede9c10ef 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -505,7 +505,8 @@ void CPUParticles::_particles_process(float p_delta) {
time = Math::fmod(time, lifetime);
cycle++;
if (one_shot && cycle > 0) {
- emitting = false;
+ set_emitting(false);
+ _change_notify();
}
}
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 949de110f5..2bcd0eaa46 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -47,6 +47,12 @@ PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const {
void Particles::set_emitting(bool p_emitting) {
VS::get_singleton()->particles_set_emitting(particles, p_emitting);
+
+ if (p_emitting && one_shot) {
+ set_process_internal(true);
+ } else if (!p_emitting) {
+ set_process_internal(false);
+ }
}
void Particles::set_amount(int p_amount) {
@@ -66,8 +72,16 @@ void Particles::set_one_shot(bool p_one_shot) {
one_shot = p_one_shot;
VS::get_singleton()->particles_set_one_shot(particles, one_shot);
- if (!one_shot && is_emitting())
- VisualServer::get_singleton()->particles_restart(particles);
+
+ if (is_emitting()) {
+
+ set_process_internal(true);
+ if (!one_shot)
+ VisualServer::get_singleton()->particles_restart(particles);
+ }
+
+ if (!one_shot)
+ set_process_internal(false);
}
void Particles::set_pre_process_time(float p_time) {
@@ -307,6 +321,16 @@ void Particles::_notification(int p_what) {
VS::get_singleton()->particles_set_speed_scale(particles, 0);
}
}
+
+ // Use internal process when emitting and one_shot are on so that when
+ // the shot ends the editor can properly update
+ if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
+
+ if (one_shot && !is_emitting()) {
+ _change_notify();
+ set_process_internal(false);
+ }
+ }
}
void Particles::_bind_methods() {