summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct3
-rw-r--r--core/SCsub21
-rw-r--r--core/core_string_names.cpp23
-rw-r--r--core/core_string_names.h27
-rw-r--r--core/io/compression.cpp2
-rw-r--r--core/variant_op.cpp508
-rw-r--r--doc/classes/Area.xml47
-rw-r--r--doc/classes/Area2D.xml69
-rw-r--r--doc/classes/CollisionObject.xml26
-rw-r--r--doc/classes/CollisionObject2D.xml33
-rw-r--r--doc/classes/Range.xml9
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp2
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp2
-rw-r--r--drivers/gles3/shaders/scene.glsl5
-rw-r--r--editor/editor_settings.cpp6
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp36
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp4
-rw-r--r--main/main.cpp22
-rw-r--r--misc/dist/linux/godot.6165
-rw-r--r--misc/dist/linux/godot.appdata.xml34
-rw-r--r--misc/dist/linux/godot.desktop9
-rw-r--r--modules/openssl/stream_peer_openssl.cpp60
-rw-r--r--modules/openssl/stream_peer_openssl.h5
-rw-r--r--platform/osx/os_osx.h1
-rw-r--r--platform/osx/os_osx.mm23
-rw-r--r--platform/server/detect.py12
-rw-r--r--platform/windows/detect.py9
-rw-r--r--platform/x11/detect.py15
-rw-r--r--scene/2d/collision_object_2d.cpp2
-rw-r--r--scene/3d/collision_object.cpp2
-rw-r--r--scene/resources/material.cpp21
-rw-r--r--scene/resources/material.h5
-rw-r--r--servers/visual/shader_language.cpp5
-rw-r--r--servers/visual/shader_types.cpp1
-rw-r--r--servers/visual/visual_server_raster.h20
-rw-r--r--thirdparty/zstd/SCsub23
36 files changed, 1050 insertions, 207 deletions
diff --git a/SConstruct b/SConstruct
index f2f1ea57f3..964222c7a0 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-EnsureSConsVersion(0, 14)
+EnsureSConsVersion(0, 98, 1)
import string
@@ -171,6 +171,7 @@ opts.Add('builtin_pcre2', "Use the builtin pcre2 library (yes/no)", 'yes')
opts.Add('builtin_recast', "Use the builtin recast library (yes/no)", 'yes')
opts.Add('builtin_squish', "Use the builtin squish library (yes/no)", 'yes')
opts.Add('builtin_zlib', "Use the builtin zlib library (yes/no)", 'yes')
+opts.Add('builtin_zstd', "Use the builtin zstd library (yes/no)", 'yes')
# Environment setup
opts.Add("CXX", "C++ compiler")
diff --git a/core/SCsub b/core/SCsub
index c1e57f6840..e78fe185a9 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -83,24 +83,8 @@ thirdparty_minizip_sources = [
thirdparty_minizip_sources = [thirdparty_minizip_dir + file for file in thirdparty_minizip_sources]
env.add_source_files(env.core_sources, thirdparty_minizip_sources)
-thirdparty_zstd_dir = "#thirdparty/zstd/"
-thirdparty_zstd_sources = [
- "common/entropy_common.c",
- "common/error_private.c",
- "common/fse_decompress.c",
- "common/pool.c",
- "common/threading.c",
- "common/xxhash.c",
- "common/zstd_common.c",
- "compress/fse_compress.c",
- "compress/huf_compress.c",
- "compress/zstd_compress.c",
- "compress/zstdmt_compress.c",
- "decompress/huf_decompress.c",
- "decompress/zstd_decompress.c",
-]
-thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
-env.add_source_files(env.core_sources, thirdparty_zstd_sources)
+if "builtin_zstd" in env and env["builtin_zstd"] == "yes":
+ SConscript("#thirdparty/zstd/SCsub")
# Godot's own sources
@@ -123,5 +107,4 @@ SConscript('helper/SCsub')
# Build it all as a library
lib = env.Library("core", env.core_sources)
env.Prepend(LIBS=[lib])
-env.Append(CPPPATH=["#thirdparty/zstd", "#thirdparty/zstd/common"])
Export('env')
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp
index ef9346253f..feee39225f 100644
--- a/core/core_string_names.cpp
+++ b/core/core_string_names.cpp
@@ -47,4 +47,27 @@ CoreStringNames::CoreStringNames()
_sections_unfolded(StaticCString::create("_sections_unfolded")),
#endif
_custom_features(StaticCString::create("_custom_features")) {
+
+ x = StaticCString::create("x");
+ y = StaticCString::create("y");
+ z = StaticCString::create("z");
+ w = StaticCString::create("w");
+ r = StaticCString::create("r");
+ g = StaticCString::create("g");
+ b = StaticCString::create("b");
+ a = StaticCString::create("a");
+ position = StaticCString::create("position");
+ size = StaticCString::create("size");
+ end = StaticCString::create("end");
+ basis = StaticCString::create("basis");
+ origin = StaticCString::create("origin");
+ normal = StaticCString::create("normal");
+ d = StaticCString::create("d");
+ h = StaticCString::create("h");
+ s = StaticCString::create("s");
+ v = StaticCString::create("v");
+ r8 = StaticCString::create("r8");
+ g8 = StaticCString::create("g8");
+ b8 = StaticCString::create("b8");
+ a8 = StaticCString::create("a8");
}
diff --git a/core/core_string_names.h b/core/core_string_names.h
index 2eb2b703ae..6fcc773169 100644
--- a/core/core_string_names.h
+++ b/core/core_string_names.h
@@ -37,8 +37,6 @@ class CoreStringNames {
friend void register_core_types();
friend void unregister_core_types();
- static CoreStringNames *singleton;
-
static void create() { singleton = memnew(CoreStringNames); }
static void free() {
memdelete(singleton);
@@ -50,6 +48,8 @@ class CoreStringNames {
public:
_FORCE_INLINE_ static CoreStringNames *get_singleton() { return singleton; }
+ static CoreStringNames *singleton;
+
StringName _free;
StringName changed;
StringName _meta;
@@ -65,6 +65,29 @@ public:
StringName _sections_unfolded;
#endif
StringName _custom_features;
+
+ StringName x;
+ StringName y;
+ StringName z;
+ StringName w;
+ StringName r;
+ StringName g;
+ StringName b;
+ StringName a;
+ StringName position;
+ StringName size;
+ StringName end;
+ StringName basis;
+ StringName origin;
+ StringName normal;
+ StringName d;
+ StringName h;
+ StringName s;
+ StringName v;
+ StringName r8;
+ StringName g8;
+ StringName b8;
+ StringName a8;
};
#endif // SCENE_STRING_NAMES_H
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index 44fa65e11d..fbe97e54c7 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -33,9 +33,9 @@
#include "zip_io.h"
#include "thirdparty/misc/fastlz.h"
-#include "thirdparty/zstd/zstd.h"
#include <zlib.h>
+#include <zstd.h>
int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) {
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 1c5a4ce8d0..4065b6a844 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -334,6 +334,13 @@ bool Variant::booleanize() const {
DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, true, false, false) \
}
+#define DEFAULT_OP_ARRAY_NEQ(m_prefix, m_op_name, m_name, m_type) \
+ CASE_TYPE(m_prefix, m_op_name, m_name) { \
+ if (p_b.type == NIL) \
+ _RETURN(true) \
+ DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, ==, true, true, false) \
+ }
+
#define DEFAULT_OP_ARRAY_LT(m_prefix, m_op_name, m_name, m_type) \
DEFAULT_OP_ARRAY_OP(m_prefix, m_op_name, m_name, m_type, <, !=, false, a_len < array_b.size(), true)
@@ -555,14 +562,13 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
DEFAULT_OP_STR_NULL(math, OP_NOT_EQUAL, NODE_PATH, !=, NodePath);
DEFAULT_OP_LOCALMEM_NULL(math, OP_NOT_EQUAL, _RID, !=, RID);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_BYTE_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_INT_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_REAL_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_STRING_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_VECTOR2_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_VECTOR3_ARRAY);
- CASE_TYPE(math, OP_NOT_EQUAL, POOL_COLOR_ARRAY);
- _RETURN_FAIL;
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_BYTE_ARRAY, uint8_t);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_INT_ARRAY, int);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_REAL_ARRAY, real_t);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_STRING_ARRAY, String);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR2_ARRAY, Vector2);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_VECTOR3_ARRAY, Vector3);
+ DEFAULT_OP_ARRAY_NEQ(math, OP_NOT_EQUAL, POOL_COLOR_ARRAY, Color);
}
SWITCH_OP(math, OP_LESS, p_a.type) {
@@ -1214,54 +1220,486 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
void Variant::set_named(const StringName &p_index, const Variant &p_value, bool *r_valid) {
- if (type == OBJECT) {
+ bool valid = false;
+ switch (type) {
+ case VECTOR2: {
+ if (p_value.type == Variant::INT) {
+ Vector2 *v = reinterpret_cast<Vector2 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._int;
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Vector2 *v = reinterpret_cast<Vector2 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._real;
+ valid = true;
+ }
+ }
-#ifdef DEBUG_ENABLED
- if (!_get_obj().obj) {
- if (r_valid)
- *r_valid = false;
- return;
- } else {
+ } break;
+ case RECT2: {
- if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null() && !ObjectDB::instance_validate(_get_obj().obj)) {
- if (r_valid)
- *r_valid = false;
- return;
+ if (p_value.type == Variant::VECTOR2) {
+ Rect2 *v = reinterpret_cast<Rect2 *>(_data._mem);
+ //scalar name
+ if (p_index == CoreStringNames::singleton->position) {
+ v->position = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->size) {
+ v->size = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->end) {
+ v->size = *reinterpret_cast<const Vector2 *>(p_value._data._mem) - v->position;
+ valid = true;
+ }
+ }
+ } break;
+ case TRANSFORM2D: {
+
+ if (p_value.type == Variant::VECTOR2) {
+ Transform2D *v = _data._transform2d;
+ if (p_index == CoreStringNames::singleton->x) {
+ v->elements[0] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->elements[1] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->origin) {
+ v->elements[2] = *reinterpret_cast<const Vector2 *>(p_value._data._mem);
+ valid = true;
+ }
+ }
+
+ } break;
+ case VECTOR3: {
+
+ if (p_value.type == Variant::INT) {
+ Vector3 *v = reinterpret_cast<Vector3 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->z = p_value._data._int;
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Vector3 *v = reinterpret_cast<Vector3 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->z = p_value._data._real;
+ valid = true;
+ }
+ }
+
+ } break;
+ case PLANE: {
+
+ if (p_value.type == Variant::INT) {
+ Plane *v = reinterpret_cast<Plane *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->normal.x = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->normal.y = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->normal.z = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->d) {
+ v->d = p_value._data._int;
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Plane *v = reinterpret_cast<Plane *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->normal.x = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->normal.y = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->normal.z = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->d) {
+ v->d = p_value._data._real;
+ valid = true;
+ }
+
+ } else if (p_value.type == Variant::VECTOR3) {
+ Plane *v = reinterpret_cast<Plane *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->normal) {
+ v->normal = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
+ valid = true;
+ }
+ }
+
+ } break;
+ case QUAT: {
+
+ if (p_value.type == Variant::INT) {
+ Quat *v = reinterpret_cast<Quat *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->z = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->w) {
+ v->w = p_value._data._int;
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Quat *v = reinterpret_cast<Quat *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ v->x = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->y = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->z = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->w) {
+ v->w = p_value._data._real;
+ valid = true;
+ }
+ }
+
+ } break; // 10
+ case RECT3: {
+
+ if (p_value.type == Variant::VECTOR3) {
+ Rect3 *v = _data._rect3;
+ //scalar name
+ if (p_index == CoreStringNames::singleton->position) {
+ v->position = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->size) {
+ v->size = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->end) {
+ v->size = *reinterpret_cast<const Vector3 *>(p_value._data._mem) - v->position;
+ valid = true;
+ }
+ }
+ } break;
+ case BASIS: {
+
+ if (p_value.type == Variant::VECTOR3) {
+ Basis *v = _data._basis;
+ //scalar name
+ if (p_index == CoreStringNames::singleton->x) {
+ v->set_axis(0, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ v->set_axis(1, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ v->set_axis(2, *reinterpret_cast<const Vector3 *>(p_value._data._mem));
+ valid = true;
+ }
+ }
+ } break;
+ case TRANSFORM: {
+
+ if (p_value.type == Variant::BASIS && p_index == CoreStringNames::singleton->basis) {
+ _data._transform->basis = *p_value._data._basis;
+ valid = true;
+ } else if (p_value.type == Variant::VECTOR3 && p_index == CoreStringNames::singleton->origin) {
+ _data._transform->origin = *reinterpret_cast<const Vector3 *>(p_value._data._mem);
+ valid = true;
+ }
+
+ } break;
+ case COLOR: {
+
+ if (p_value.type == Variant::INT) {
+ Color *v = reinterpret_cast<Color *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->r) {
+ v->r = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->g) {
+ v->g = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->b) {
+ v->b = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->a) {
+ v->a = p_value._data._int;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->r8) {
+ v->r = p_value._data._int / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->g8) {
+ v->g = p_value._data._int / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->b8) {
+ v->b = p_value._data._int / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->a8) {
+ v->a = p_value._data._int / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->h) {
+ v->set_hsv(p_value._data._int, v->get_s(), v->get_v());
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->s) {
+ v->set_hsv(v->get_h(), p_value._data._int, v->get_v());
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->v) {
+ v->set_hsv(v->get_h(), v->get_v(), p_value._data._int);
+ valid = true;
+ }
+ } else if (p_value.type == Variant::REAL) {
+ Color *v = reinterpret_cast<Color *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->r) {
+ v->r = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->g) {
+ v->g = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->b) {
+ v->b = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->a) {
+ v->a = p_value._data._real;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->r8) {
+ v->r = p_value._data._real / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->g8) {
+ v->g = p_value._data._real / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->b8) {
+ v->b = p_value._data._real / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->a8) {
+ v->a = p_value._data._real / 255.0;
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->h) {
+ v->set_hsv(p_value._data._real, v->get_s(), v->get_v());
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->s) {
+ v->set_hsv(v->get_h(), p_value._data._real, v->get_v());
+ valid = true;
+ } else if (p_index == CoreStringNames::singleton->v) {
+ v->set_hsv(v->get_h(), v->get_v(), p_value._data._real);
+ valid = true;
+ }
+ }
+ } break;
+ case OBJECT: {
+
+#ifdef DEBUG_ENABLED
+ if (!_get_obj().obj) {
+ break;
+ } else if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null() && !ObjectDB::instance_validate(_get_obj().obj)) {
+ break;
}
- }
#endif
- _get_obj().obj->set(p_index, p_value, r_valid);
- return;
+ _get_obj().obj->set(p_index, p_value, &valid);
+
+ } break;
+ default: {
+ set(p_index.operator String(), p_value, &valid);
+ } break;
}
- set(p_index.operator String(), p_value, r_valid);
+ if (r_valid) {
+ *r_valid = valid;
+ }
}
Variant Variant::get_named(const StringName &p_index, bool *r_valid) const {
- if (type == OBJECT) {
+ if (r_valid) {
+ *r_valid = true;
+ }
+ switch (type) {
+ case VECTOR2: {
+ const Vector2 *v = reinterpret_cast<const Vector2 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->x;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->y;
+ }
-#ifdef DEBUG_ENABLED
- if (!_get_obj().obj) {
- if (r_valid)
- *r_valid = false;
- return "Instance base is null.";
- } else {
+ } break;
+ case RECT2: {
- if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null() && !ObjectDB::instance_validate(_get_obj().obj)) {
+ const Rect2 *v = reinterpret_cast<const Rect2 *>(_data._mem);
+ //scalar name
+ if (p_index == CoreStringNames::singleton->position) {
+ return v->position;
+ } else if (p_index == CoreStringNames::singleton->size) {
+ return v->size;
+ } else if (p_index == CoreStringNames::singleton->end) {
+ return v->size + v->position;
+ }
+ } break;
+ case TRANSFORM2D: {
+
+ const Transform2D *v = _data._transform2d;
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->elements[0];
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->elements[1];
+ } else if (p_index == CoreStringNames::singleton->origin) {
+ return v->elements[2];
+ }
+
+ } break;
+ case VECTOR3: {
+
+ const Vector3 *v = reinterpret_cast<const Vector3 *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->x;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->y;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ return v->z;
+ }
+
+ } break;
+ case PLANE: {
+
+ const Plane *v = reinterpret_cast<const Plane *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->normal.x;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->normal.y;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ return v->normal.z;
+ } else if (p_index == CoreStringNames::singleton->d) {
+ return v->d;
+ } else if (p_index == CoreStringNames::singleton->normal) {
+ return v->normal;
+ }
+
+ } break;
+ case QUAT: {
+
+ const Quat *v = reinterpret_cast<const Quat *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->x;
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->y;
+ } else if (p_index == CoreStringNames::singleton->z) {
+ return v->z;
+ } else if (p_index == CoreStringNames::singleton->w) {
+ return v->w;
+ }
+
+ } break; // 10
+ case RECT3: {
+
+ const Rect3 *v = _data._rect3;
+ //scalar name
+ if (p_index == CoreStringNames::singleton->position) {
+ return v->position;
+ } else if (p_index == CoreStringNames::singleton->size) {
+ return v->size;
+ } else if (p_index == CoreStringNames::singleton->end) {
+ return v->size + v->position;
+ }
+ } break;
+ case BASIS: {
+
+ const Basis *v = _data._basis;
+ //scalar name
+ if (p_index == CoreStringNames::singleton->x) {
+ return v->get_axis(0);
+ } else if (p_index == CoreStringNames::singleton->y) {
+ return v->get_axis(1);
+ } else if (p_index == CoreStringNames::singleton->z) {
+ return v->get_axis(2);
+ }
+
+ } break;
+ case TRANSFORM: {
+
+ if (p_index == CoreStringNames::singleton->basis) {
+ return _data._transform->basis;
+ } else if (p_index == CoreStringNames::singleton->origin) {
+ return _data._transform->origin;
+ }
+
+ } break;
+ case COLOR: {
+
+ const Color *v = reinterpret_cast<const Color *>(_data._mem);
+ if (p_index == CoreStringNames::singleton->r) {
+ return v->r;
+ } else if (p_index == CoreStringNames::singleton->g) {
+ return v->g;
+ } else if (p_index == CoreStringNames::singleton->b) {
+ return v->b;
+ } else if (p_index == CoreStringNames::singleton->a) {
+ return v->a;
+ } else if (p_index == CoreStringNames::singleton->r8) {
+ return v->r * 255.0;
+ } else if (p_index == CoreStringNames::singleton->g8) {
+ return v->g * 255.0;
+ } else if (p_index == CoreStringNames::singleton->b8) {
+ return v->b * 255.0;
+ } else if (p_index == CoreStringNames::singleton->a8) {
+ return v->a * 255.0;
+ } else if (p_index == CoreStringNames::singleton->h) {
+ return v->get_h();
+ } else if (p_index == CoreStringNames::singleton->s) {
+ return v->get_s();
+ } else if (p_index == CoreStringNames::singleton->v) {
+ return v->get_v();
+ }
+ } break;
+ case OBJECT: {
+
+#ifdef DEBUG_ENABLED
+ if (!_get_obj().obj) {
if (r_valid)
*r_valid = false;
- return "Attempted use of stray pointer object.";
+ return "Instance base is null.";
+ } else {
+
+ if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null() && !ObjectDB::instance_validate(_get_obj().obj)) {
+ if (r_valid)
+ *r_valid = false;
+ return "Attempted use of stray pointer object.";
+ }
}
- }
#endif
- return _get_obj().obj->get(p_index, r_valid);
+ return _get_obj().obj->get(p_index, r_valid);
+
+ } break;
+ default: {
+ return get(p_index.operator String(), r_valid);
+ }
}
- return get(p_index.operator String(), r_valid);
+ if (r_valid) {
+ *r_valid = false;
+ }
+ return Variant();
}
#define DEFAULT_OP_ARRAY_CMD(m_name, m_type, skip_test, cmd) \
diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml
index c59bbee084..8797575038 100644
--- a/doc/classes/Area.xml
+++ b/doc/classes/Area.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Area" inherits="CollisionObject" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- General purpose area detection and influence for 3D physics.
+ General purpose area node for detection and 3D physics influence.
</brief_description>
<description>
- General purpose area detection for 3D physics. Areas can be used for detection of objects that enter/exit them, as well as overriding space parameters (changing gravity, damping, etc). For this, use any space override different from AREA_SPACE_OVERRIDE_DISABLE and point gravity at the center of mass.
+ 3D area that detects [CollisionObject] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
</description>
<tutorials>
</tutorials>
@@ -88,14 +88,14 @@
<return type="Array">
</return>
<description>
- Return a list of the areas that are totally or partially inside this area.
+ Returns a list of intersecting [Area]\ s.
</description>
</method>
<method name="get_overlapping_bodies" qualifiers="const">
<return type="Array">
</return>
<description>
- Return a list of the bodies ([PhysicsBody]) that are totally or partially inside this area.
+ Returns a list of intersecting [PhysicsBody]\ s.
</description>
</method>
<method name="get_priority" qualifiers="const">
@@ -169,7 +169,7 @@
<argument index="0" name="area" type="Node">
</argument>
<description>
- Return whether the area passed is totally or partially inside this area.
+ If [code]true[/code] the given area overlaps the Area.
</description>
</method>
<method name="overlaps_body" qualifiers="const">
@@ -178,7 +178,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- Return whether the body passed is totally or partially inside this area.
+ If [code]true[/code] the given body overlaps the Area.
</description>
</method>
<method name="set_angular_damp">
@@ -374,30 +374,43 @@
</methods>
<members>
<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp">
+ The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
</member>
<member name="audio_bus_name" type="String" setter="set_audio_bus" getter="get_audio_bus">
+ The name of the area's audio bus.
</member>
<member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus">
+ If [code]true[/code] the area's audio bus overrides the default audio bus. Default value: [code]false[/code].
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
+ The area's physics layer(s). Collidable objects can exist in any of 32 different layers. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See also [code]collision_mask[/code].
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
+ The physics layers this area scans to determine collision detection.
</member>
<member name="gravity" type="float" setter="set_gravity" getter="get_gravity">
+ The area's gravity intensity (ranges from -1024 to 1024). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
</member>
<member name="gravity_distance_scale" type="float" setter="set_gravity_distance_scale" getter="get_gravity_distance_scale">
+ The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
</member>
<member name="gravity_point" type="bool" setter="set_gravity_is_point" getter="is_gravity_a_point">
+ If [code]true[/code] gravity is calculated from a point (set via [code]gravity_vec[/code]). Also see [code]space_override[/code]. Default value: [code]false[/code].
</member>
<member name="gravity_vec" type="Vector3" setter="set_gravity_vector" getter="get_gravity_vector">
+ The area's gravity vector (not normalized). If gravity is a point (see [method is_gravity_a_point]), this will be the point of attraction.
</member>
<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp">
+ The rate at which objects stop moving in this area. Represents the linear velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
</member>
<member name="monitorable" type="bool" setter="set_monitorable" getter="is_monitorable">
+ If [code]true[/code] other monitoring areas can detect this area. Default value: [code]true[/code].
</member>
<member name="monitoring" type="bool" setter="set_monitoring" getter="is_monitoring">
+ If [code]true[/code] the area detects bodies or areas entering and exiting it. Default value: [code]true[/code].
</member>
<member name="priority" type="float" setter="set_priority" getter="get_priority">
+ The area's priority. Higher priority areas are processed first. Default value: 0.
</member>
<member name="reverb_bus_amount" type="float" setter="set_reverb_amount" getter="get_reverb_amount">
</member>
@@ -408,6 +421,7 @@
<member name="reverb_bus_uniformity" type="float" setter="set_reverb_uniformity" getter="get_reverb_uniformity">
</member>
<member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area.SpaceOverride">
+ Override mode for gravity and damping calculations within this area. See the SPACE_OVERRIDE_* constants for values.
</member>
</members>
<signals>
@@ -415,14 +429,14 @@
<argument index="0" name="area" type="Object">
</argument>
<description>
- This signal is triggered only once when an area enters this area. The only parameter passed is the area that entered this area.
+ Emitted when another area enters.
</description>
</signal>
<signal name="area_exited">
<argument index="0" name="area" type="Object">
</argument>
<description>
- This signal is triggered only once when an area exits this area. The only parameter passed is the area that exited this area.
+ Emitted when another area exits.
</description>
</signal>
<signal name="area_shape_entered">
@@ -435,7 +449,7 @@
<argument index="3" name="self_shape" type="int">
</argument>
<description>
- This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when another area enters, reporting which areas overlapped.
</description>
</signal>
<signal name="area_shape_exited">
@@ -448,21 +462,21 @@
<argument index="3" name="self_shape" type="int">
</argument>
<description>
- This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when another area exits, reporting which areas were overlapping.
</description>
</signal>
<signal name="body_entered">
<argument index="0" name="body" type="Object">
</argument>
<description>
- This signal is triggered only once when a body enters this area. The only parameter passed is the body that entered this area.
+ Emitted when a [PhysicsBody] object enters.
</description>
</signal>
<signal name="body_exited">
<argument index="0" name="body" type="Object">
</argument>
<description>
- This signal is triggered only once when a body exits this area. The only parameter passed is the body that exited this area.
+ Emitted when a [PhysicsBody2D] object exits.
</description>
</signal>
<signal name="body_shape_entered">
@@ -475,7 +489,7 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- This signal triggers only once when a body enters this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape of the body that entered this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when a [PhysicsBody2D] object enters, reporting which shapes overlapped.
</description>
</signal>
<signal name="body_shape_exited">
@@ -488,20 +502,25 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- This signal triggers only once when a body exits this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape exiting this area, and the fourth one is the index of the shape in this area that reported the exit.
+ Emitted when a [PhysicsBody2D] object exits, reporting which shapes were overlapping.
</description>
</signal>
</signals>
<constants>
<constant name="SPACE_OVERRIDE_DISABLED" value="0">
+ This area does not affect gravity/damping.
</constant>
<constant name="SPACE_OVERRIDE_COMBINE" value="1">
+ This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order).
</constant>
<constant name="SPACE_OVERRIDE_COMBINE_REPLACE" value="2">
+ This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order), ignoring any lower priority areas.
</constant>
<constant name="SPACE_OVERRIDE_REPLACE" value="3">
+ This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
</constant>
<constant name="SPACE_OVERRIDE_REPLACE_COMBINE" value="4">
+ This area replaces any gravity/damping calculated so far (in [code]priority[/code] order), but keeps calculating the rest of the areas.
</constant>
</constants>
</class>
diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml
index cef5053289..0cbc079962 100644
--- a/doc/classes/Area2D.xml
+++ b/doc/classes/Area2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Area2D" inherits="CollisionObject2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- 2D area that detects nodes that enter or exit it. Can override 2D physics properties within range.
+ 2D area for detection and 2D physics influence.
</brief_description>
<description>
- 2D area that detects nodes that enter or exit it. Change the 'space_override' property SPACE_OVERRIDE_* to override physics parameters for nodes like [Rigidbody2D]. E.g. gravity, damping... See [CollisionObject2D] for usage.
+ 2D area that detects [CollisionObject2D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
</description>
<tutorials>
</tutorials>
@@ -88,14 +88,14 @@
<return type="Array">
</return>
<description>
- Returns a list of the [Area2D]s that intersect with this area.
+ Returns a list of intersecting [Area2D]\ s.
</description>
</method>
<method name="get_overlapping_bodies" qualifiers="const">
<return type="Array">
</return>
<description>
- Return a list of the [PhysicsBody2D]s that intersect with this area.
+ Returns a list of intersecting [PhysicsBody2D]\ s.
</description>
</method>
<method name="get_priority" qualifiers="const">
@@ -145,7 +145,7 @@
<argument index="0" name="area" type="Node">
</argument>
<description>
- Return whether the area passed is totally or partially inside this area.
+ If [code]true[/code] the given area overlaps the Area2D.
</description>
</method>
<method name="overlaps_body" qualifiers="const">
@@ -154,7 +154,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- Return whether the body passed is totally or partially inside this area.
+ If [code]true[/code] the given body overlaps the Area2D.
</description>
</method>
<method name="set_angular_damp">
@@ -318,49 +318,46 @@
</methods>
<members>
<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp">
- The rate at which objects stop spinning in this area. Represents the amount of speed lost per second. If 1.0, physics bodies in the area stop rotating immediately. If 0.0, they never slow down. Does not incorporate external forces. The physics-update's rate affects 'angular_damp'.
+ The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
</member>
<member name="audio_bus_name" type="String" setter="set_audio_bus_name" getter="get_audio_bus_name">
- The name of the Area2D's audio bus.
+ The name of the area's audio bus.
</member>
<member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus">
- If [code]true[/code], overrides the default audio bus with the Area2D's. Defaults to [code]false[/code].
+ If [code]true[/code] the area's audio bus overrides the default audio bus. Default value: [code]false[/code].
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
- The physics layer this Area2D is in.
- Collidable objects can exist in any of 32 different layers. These layers are not visual, but more of a tagging system instead. A collidable can use these layers/tags to select with which objects it can collide, using [method set_collision_mask].
- A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans.
+ The area's physics layer(s). Collidable objects can exist in any of 32 different layers. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See also [code]collision_mask[/code].
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
- The physics layers this Area2D scans to determine collision detections.
+ The physics layers this area scans to determine collision detection.
</member>
<member name="gravity" type="float" setter="set_gravity" getter="get_gravity">
- The gravity intensity within the Area2D (ranges -1024 to 1024). This is useful to alter the force of gravity without altering its direction.
- This value multiplies the gravity vector, whether it is the given vector ([method set_gravity_vector]), or a calculated one (when using a center of gravity).
+ The area's gravity intensity (ranges from -1024 to 1024). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
</member>
<member name="gravity_distance_scale" type="float" setter="set_gravity_distance_scale" getter="get_gravity_distance_scale">
- The falloff factor for point gravity. The greater this value is, the faster the strength of gravity decreases with the square of distance.
+ The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
</member>
<member name="gravity_point" type="bool" setter="set_gravity_is_point" getter="is_gravity_a_point">
- If [code]true[/code], calculates gravity from a particular point during a space override (see [method set_space_override_mode]). If a point, [Vector2] position is set with [method set_gravity_vector]. Defaults to [code]false[/code].
+ If [code]true[/code] gravity is calculated from a point (set via [code]gravity_vec[/code]). Also see [code]space_override[/code]. Default value: [code]false[/code].
</member>
<member name="gravity_vec" type="Vector2" setter="set_gravity_vector" getter="get_gravity_vector">
- The gravitational direction/strength as a vector (not normalized). If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center.
+ The area's gravity vector (not normalized). If gravity is a point (see [method is_gravity_a_point]), this will be the point of attraction.
</member>
<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp">
- The rate at which objects stop spinning in this area. Represents the amount of speed lost per second. If 1.0, physics bodies in the area stop rotating immediately. If 0.0, they never slow down. Does not incorporate external forces. The physics-update's rate affects 'angular_damp'.
+ The rate at which objects stop moving in this area. Represents the linear velocity lost per second. Values range from [code]0[/code] (no damping) to [code]1[/code] (full damping).
</member>
<member name="monitorable" type="bool" setter="set_monitorable" getter="is_monitorable">
- If [code]true[/code], other monitoring areas can detect this Area2D (is it undetectable at the moment?). Defaults to [code]true[/code].
+ If [code]true[/code] other monitoring areas can detect this area. Default value: [code]true[/code].
</member>
<member name="monitoring" type="bool" setter="set_monitoring" getter="is_monitoring">
- If [code]true[/code], this detects bodies/areas entering/exiting it (can it detect others at the moment?). Defaults to [code]true[/code].
+ If [code]true[/code] the area detects bodies or areas entering and exiting it. Default value: [code]true[/code].
</member>
<member name="priority" type="float" setter="set_priority" getter="get_priority">
- The processing order for this priority. Ranges from 0 to 128. Defaults to 0. Higher priorities are processed first.
+ The area's priority. Higher priority areas are processed first. Default value: 0.
</member>
<member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area2D.SpaceOverride">
- How to override gravity and damping calculations within this Area2D, if at all. Consult the SPACE_OVERRIDE_* constants for available options.
+ Override mode for gravity and damping calculations within this area. See the SPACE_OVERRIDE_* constants for values.
</member>
</members>
<signals>
@@ -368,14 +365,14 @@
<argument index="0" name="area" type="Object">
</argument>
<description>
- This signal is triggered only once when an area enters this area. The only parameter passed is the area that entered this area.
+ Emitted when another area enters.
</description>
</signal>
<signal name="area_exited">
<argument index="0" name="area" type="Object">
</argument>
<description>
- This signal is triggered only once when an area exits this area. The only parameter passed is the area that exited this area.
+ Emitted when another area exits.
</description>
</signal>
<signal name="area_shape_entered">
@@ -388,7 +385,7 @@
<argument index="3" name="self_shape" type="int">
</argument>
<description>
- This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when another area enters, reporting which shapes overlapped.
</description>
</signal>
<signal name="area_shape_exited">
@@ -401,21 +398,21 @@
<argument index="3" name="self_shape" type="int">
</argument>
<description>
- This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when another area exits, reporting which shapes were overlapping.
</description>
</signal>
<signal name="body_entered">
<argument index="0" name="body" type="Object">
</argument>
<description>
- This signal is triggered only once when a body enters this area. The only parameter passed is the body that entered this area.
+ Emitted when a [PhysicsBody2D] object enters.
</description>
</signal>
<signal name="body_exited">
<argument index="0" name="body" type="Object">
</argument>
<description>
- This signal is triggered only once when a body exits this area. The only parameter passed is the body that exited this area.
+ Emitted when a [PhysicsBody2D] object exits.
</description>
</signal>
<signal name="body_shape_entered">
@@ -428,7 +425,7 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- This signal triggers only once when a body enters this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape of the body that entered this area, and the fourth one is the index of the shape in this area that reported the entering.
+ Emitted when a [PhysicsBody2D] object enters, reporting which shapes overlapped.
</description>
</signal>
<signal name="body_shape_exited">
@@ -441,25 +438,25 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- This signal triggers only once when a body exits this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape exiting this area, and the fourth one is the index of the shape in this area that reported the exit.
+ Emitted when a [PhysicsBody2D] object exits, reporting which shapes were overlapping.
</description>
</signal>
</signals>
<constants>
<constant name="SPACE_OVERRIDE_DISABLED" value="0">
- This area does not affect gravity/damp. These are areas that exist only to detect collisions and objects entering or exiting them.
+ This area does not affect gravity/damping.
</constant>
<constant name="SPACE_OVERRIDE_COMBINE" value="1">
- This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects.
+ This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order).
</constant>
<constant name="SPACE_OVERRIDE_COMBINE_REPLACE" value="2">
- This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one.
+ This area adds its gravity/damping values to whatever has been calculated so far (in [code]priority[/code] order), ignoring any lower priority areas.
</constant>
<constant name="SPACE_OVERRIDE_REPLACE" value="3">
- This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas.
+ This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
</constant>
<constant name="SPACE_OVERRIDE_REPLACE_COMBINE" value="4">
- This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one.
+ This area replaces any gravity/damping calculated so far (in [code]priority[/code] order), but keeps calculating the rest of the areas.
</constant>
</constants>
</class>
diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject.xml
index 98023a5898..64e9e07925 100644
--- a/doc/classes/CollisionObject.xml
+++ b/doc/classes/CollisionObject.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionObject" inherits="Spatial" category="Core" version="3.0.alpha.custom_build">
<brief_description>
+ Base node for collision objects.
</brief_description>
<description>
+ CollisionObject is the base class for physics objects. It can hold any number of collision [Shape]\ s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
</description>
<tutorials>
</tutorials>
@@ -31,7 +33,7 @@
<argument index="0" name="owner" type="Object">
</argument>
<description>
- Creates new holder for the shapes. Argument is a [CollisionShape] node. It will return owner_id which usually you will want to save for later use.
+ Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description>
</method>
<method name="get_capture_input_on_drag" qualifiers="const">
@@ -44,13 +46,14 @@
<return type="RID">
</return>
<description>
+ Returns the object's [RID].
</description>
</method>
<method name="get_shape_owners">
<return type="Array">
</return>
<description>
- Shape owner is a node which is holding concrete shape resources. This method will return an array which is holding an integer numbers that are representing unique ID of each owner. You can use those ids when you are using others shape_owner methods.
+ Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
</description>
</method>
<method name="is_ray_pickable" qualifiers="const">
@@ -65,6 +68,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ If [code]true[/code] the shape owner and its shapes are disabled.
</description>
</method>
<method name="remove_shape_owner">
@@ -73,6 +77,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Removes the given shape owner.
</description>
</method>
<method name="set_capture_input_on_drag">
@@ -97,6 +102,7 @@
<argument index="0" name="shape_index" type="int">
</argument>
<description>
+ Returns the [code]owner_id[/code] of the given shape.
</description>
</method>
<method name="shape_owner_add_shape">
@@ -107,6 +113,7 @@
<argument index="1" name="shape" type="Shape">
</argument>
<description>
+ Adds a [Shape] to the shape owner.
</description>
</method>
<method name="shape_owner_clear_shapes">
@@ -115,7 +122,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Will remove all the shapes associated with given owner.
+ Removes all shapes from the shape owner.
</description>
</method>
<method name="shape_owner_get_owner" qualifiers="const">
@@ -124,6 +131,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Returns the parent object of the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape" qualifiers="const">
@@ -134,7 +142,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Will return a [Shape]. First argument owner_id is an integer that can be obtained from [method get_shape_owners]. Shape_id is a position of the shape inside owner; it's a value in range from 0 to [method shape_owner_get_shape_count].
+ Returns the [Shape] with the given id from the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape_count" qualifiers="const">
@@ -143,7 +151,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Returns number of shapes to which given owner is associated to.
+ Returns the number of shapes the given shape owner contains.
</description>
</method>
<method name="shape_owner_get_shape_index" qualifiers="const">
@@ -162,7 +170,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Will return [Transform] of an owner node.
+ Returns the shape owner's [Transform].
</description>
</method>
<method name="shape_owner_remove_shape">
@@ -173,7 +181,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Removes related shape from the owner.
+ Removes a shape from the given shape owner.
</description>
</method>
<method name="shape_owner_set_disabled">
@@ -184,6 +192,7 @@
<argument index="1" name="disabled" type="bool">
</argument>
<description>
+ If [code]true[/code] disables the given shape owner.
</description>
</method>
<method name="shape_owner_set_transform">
@@ -194,6 +203,7 @@
<argument index="1" name="transform" type="Transform">
</argument>
<description>
+ Sets the [Transform] of the given shape owner.
</description>
</method>
</methods>
@@ -220,10 +230,12 @@
</signal>
<signal name="mouse_entered">
<description>
+ Emitted when the mouse pointer enters any of this object's shapes.
</description>
</signal>
<signal name="mouse_exited">
<description>
+ Emitted when the mouse pointer exits all this object's shapes.
</description>
</signal>
</signals>
diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml
index db1412805f..52743bd37d 100644
--- a/doc/classes/CollisionObject2D.xml
+++ b/doc/classes/CollisionObject2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="CollisionObject2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
<brief_description>
- Base node for 2D collisionables.
+ Base node for 2D collision objects.
</brief_description>
<description>
- CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionShape2D] and/or [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API.
+ CollisionObject2D is the base class for 2D physics objects. It can hold any number of 2D collision [Shape2D]\ s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject2D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
</description>
<tutorials>
</tutorials>
@@ -29,21 +29,21 @@
<argument index="0" name="owner" type="Object">
</argument>
<description>
- Creates new holder for the shapes. Argument is a [CollisionShape2D] node. It will return owner_id which usually you will want to save for later use.
+ Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
</description>
</method>
<method name="get_rid" qualifiers="const">
<return type="RID">
</return>
<description>
- Return the RID of this object.
+ Returns the object's [RID].
</description>
</method>
<method name="get_shape_owners">
<return type="Array">
</return>
<description>
- Shape owner is a node which is holding concrete shape resources. This method will return an array which is holding an integer numbers that are representing unique ID of each owner. You can use those ids when you are using others shape_owner methods.
+ Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
</description>
</method>
<method name="is_pickable" qualifiers="const">
@@ -59,6 +59,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ If [code]true[/code] the shape owner and its shapes are disabled.
</description>
</method>
<method name="is_shape_owner_one_way_collision_enabled" qualifiers="const">
@@ -75,6 +76,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Removes the given shape owner.
</description>
</method>
<method name="set_pickable">
@@ -92,6 +94,7 @@
<argument index="0" name="shape_index" type="int">
</argument>
<description>
+ Returns the [code]owner_id[/code] of the given shape.
</description>
</method>
<method name="shape_owner_add_shape">
@@ -102,6 +105,7 @@
<argument index="1" name="shape" type="Shape2D">
</argument>
<description>
+ Adds a [Shape2D] to the shape owner.
</description>
</method>
<method name="shape_owner_clear_shapes">
@@ -110,7 +114,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Will remove all the shapes associated with given owner.
+ Removes all shapes from the shape owner.
</description>
</method>
<method name="shape_owner_get_owner" qualifiers="const">
@@ -119,6 +123,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
+ Returns the parent object of the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape" qualifiers="const">
@@ -129,7 +134,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Will return a [Shape2D]. First argument owner_id is an integer that can be obtained from [method get_shape_owners]. Shape_id is a position of the shape inside owner; it's a value in range from 0 to [method shape_owner_get_shape_count].
+ Returns the [Shape2D] with the given id from the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape_count" qualifiers="const">
@@ -138,7 +143,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Returns number of shapes to which given owner is associated to.
+ Returns the number of shapes the given shape owner contains.
</description>
</method>
<method name="shape_owner_get_shape_index" qualifiers="const">
@@ -157,7 +162,7 @@
<argument index="0" name="owner_id" type="int">
</argument>
<description>
- Will return [Transform2D] of an owner node.
+ Returns the shape owner's [Transform2D].
</description>
</method>
<method name="shape_owner_remove_shape">
@@ -168,7 +173,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Removes related shape from the owner.
+ Removes a shape from the given shape owner.
</description>
</method>
<method name="shape_owner_set_disabled">
@@ -179,6 +184,7 @@
<argument index="1" name="disabled" type="bool">
</argument>
<description>
+ If [code]true[/code] disables the given shape owner.
</description>
</method>
<method name="shape_owner_set_one_way_collision">
@@ -199,11 +205,13 @@
<argument index="1" name="transform" type="Transform2D">
</argument>
<description>
+ Sets the [Transform2D] of the given shape owner.
</description>
</method>
</methods>
<members>
<member name="input_pickable" type="bool" setter="set_pickable" getter="is_pickable">
+ If [code]true[/code] this object is pickable. A pickable object can detect the mouse pointer entering/leaving, and if the mouse is inside it, report input events.
</member>
</members>
<signals>
@@ -215,16 +223,17 @@
<argument index="2" name="shape_idx" type="int">
</argument>
<description>
+ Emitted when an input event occurs and [code]input_pickable[/code] is [code]true[/code].
</description>
</signal>
<signal name="mouse_entered">
<description>
- This event fires only once when the mouse pointer enters any shape of this object.
+ Emitted when the mouse pointer enters any of this object's shapes.
</description>
</signal>
<signal name="mouse_exited">
<description>
- This event fires only once when the mouse pointer exits all shapes of this object.
+ Emitted when the mouse pointer exits all this object's shapes.
</description>
</signal>
</signals>
diff --git a/doc/classes/Range.xml b/doc/classes/Range.xml
index 9af6abf7b8..cd75c2b658 100644
--- a/doc/classes/Range.xml
+++ b/doc/classes/Range.xml
@@ -138,29 +138,38 @@
<argument index="0" name="with" type="Node">
</argument>
<description>
+ Binds two Ranges together along with any Ranges previously grouped with either of them. When any of Range's member variables change, it will share the new value with all other Ranges in its group.
</description>
</method>
<method name="unshare">
<return type="void">
</return>
<description>
+ Stop Range from sharing its member variables with any other Range.
</description>
</method>
</methods>
<members>
<member name="exp_edit" type="bool" setter="set_exp_ratio" getter="is_ratio_exp">
+ If [code]true[/code] and [code]min_value[/code] is greater than 0, [code]value[/code] will be represented exponentially rather than linearly.
</member>
<member name="max_value" type="float" setter="set_max" getter="get_max">
+ Maximum value. Range is clamped if [code]value[/code] is greater than [code]max_value[/code]. Default value: 100.
</member>
<member name="min_value" type="float" setter="set_min" getter="get_min">
+ Minimum value. Range is clamped if [code]value[/code] is less than [code]min_value[/code]. Default value: 0.
</member>
<member name="page" type="float" setter="set_page" getter="get_page">
+ Page size. Used mainly for [ScrollBar]. ScrollBar's length is its size multiplied by [code]page[/code] over the difference between [code]min_value[/code] and [code]max_value[/code].
</member>
<member name="rounded" type="bool" setter="set_use_rounded_values" getter="is_using_rounded_values">
+ If [code]true[/code], [code]value[/code] will always be rounded to the nearest integer.
</member>
<member name="step" type="float" setter="set_step" getter="get_step">
+ If greater than 0, [code]value[/code] will always be rounded to a multiple of [code]step[/code]. If [code]rounded[/code] is also [code]true[/code], [code]value[/code] will first be rounded to a multiple of [code]step[/code] then rounded to the nearest integer.
</member>
<member name="value" type="float" setter="set_value" getter="get_value">
+ Range's current value.
</member>
</members>
<signals>
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index b99817fb12..ae41a936c6 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1564,6 +1564,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
p_shader->canvas_item.blend_mode = Shader::CanvasItem::BLEND_MODE_MIX;
p_shader->canvas_item.uses_screen_texture = false;
p_shader->canvas_item.uses_screen_uv = false;
+ p_shader->canvas_item.uses_time = false;
shaders.actions_canvas.render_mode_values["blend_add"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_ADD);
shaders.actions_canvas.render_mode_values["blend_mix"] = Pair<int *, int>(&p_shader->canvas_item.blend_mode, Shader::CanvasItem::BLEND_MODE_MIX);
@@ -1595,6 +1596,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
p_shader->spatial.unshaded = false;
p_shader->spatial.no_depth_test = false;
p_shader->spatial.uses_sss = false;
+ p_shader->spatial.uses_time = false;
p_shader->spatial.uses_vertex_lighting = false;
p_shader->spatial.uses_screen_texture = false;
p_shader->spatial.uses_vertex = false;
diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp
index b3b2517ad6..9a5b53c84b 100644
--- a/drivers/gles3/shader_compiler_gles3.cpp
+++ b/drivers/gles3/shader_compiler_gles3.cpp
@@ -787,6 +787,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].renames["SSS_STRENGTH"] = "sss_strength";
actions[VS::SHADER_SPATIAL].renames["TRANSMISSION"] = "transmission";
actions[VS::SHADER_SPATIAL].renames["AO"] = "ao";
+ actions[VS::SHADER_SPATIAL].renames["AO_LIGHT_AFFECT"] = "ao_light_affect";
actions[VS::SHADER_SPATIAL].renames["EMISSION"] = "emission";
//actions[VS::SHADER_SPATIAL].renames["SCREEN_UV"]=ShaderLanguage::TYPE_VEC2;
actions[VS::SHADER_SPATIAL].renames["POINT_COORD"] = "gl_PointCoord";
@@ -806,6 +807,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY"] = "#define LIGHT_USE_ANISOTROPY\n";
actions[VS::SHADER_SPATIAL].usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY";
actions[VS::SHADER_SPATIAL].usage_defines["AO"] = "#define ENABLE_AO\n";
+ actions[VS::SHADER_SPATIAL].usage_defines["AO_LIGHT_AFFECT"] = "#define ENABLE_AO\n";
actions[VS::SHADER_SPATIAL].usage_defines["UV"] = "#define ENABLE_UV_INTERP\n";
actions[VS::SHADER_SPATIAL].usage_defines["UV2"] = "#define ENABLE_UV2_INTERP\n";
actions[VS::SHADER_SPATIAL].usage_defines["NORMALMAP"] = "#define ENABLE_NORMALMAP\n";
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 0eb26ae58f..25115bc18a 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1536,6 +1536,7 @@ void main() {
#if defined(ENABLE_AO)
float ao=1.0;
+ float ao_light_affect=0.0;
#endif
float alpha = 1.0;
@@ -1920,9 +1921,13 @@ FRAGMENT_SHADER_CODE
#if defined(ENABLE_AO)
ambient_light*=ao;
+ ao_light_affect = mix(1.0,ao,ao_light_affect);
+ specular_light*=ao_light_affect;
+ diffuse_light*=ao_light_affect;
#endif
+
//energu conservation
diffuse_light=mix(diffuse_light,vec3(0.0),metallic);
ambient_light=mix(ambient_light,vec3(0.0),metallic);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 02a9999eae..cec3bc7f2d 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -690,11 +690,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
hints["editors/3d/navigation_feel/orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
set("editors/3d/navigation_feel/translation_inertia", 0.15);
hints["editors/3d/navigation_feel/translation_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- set("editors/3d/navigation_feel/zoom_inertia", 0.1);
+ set("editors/3d/navigation_feel/zoom_inertia", 0.075);
hints["editors/3d/navigation_feel/zoom_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/zoom_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- set("editors/3d/navigation_feel/manipulation_orbit_inertia", 0.1);
+ set("editors/3d/navigation_feel/manipulation_orbit_inertia", 0.075);
hints["editors/3d/navigation_feel/manipulation_orbit_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/manipulation_orbit_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
- set("editors/3d/navigation_feel/manipulation_translation_inertia", 0.1);
+ set("editors/3d/navigation_feel/manipulation_translation_inertia", 0.075);
hints["editors/3d/navigation_feel/manipulation_translation_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/navigation_feel/manipulation_translation_inertia", PROPERTY_HINT_RANGE, "0.0, 1, 0.01");
// freelook
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 008dcac2c1..bfdbdda8fe 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -70,20 +70,17 @@
#define MAX_FOV 179
void SpatialEditorViewport::_update_camera(float p_interp_delta) {
- if (orthogonal) {
- //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar());
- camera->set_orthogonal(2 * cursor.distance, 0.1, 8192);
- } else
- camera->set_perspective(get_fov(), get_znear(), get_zfar());
+
+ bool is_orthogonal = camera->get_projection() == Camera::PROJECTION_ORTHOGONAL;
//when not being manipulated, move softly
- float free_orbit_inertia = EDITOR_DEF("editors/3d/navigation_feel/orbit_inertia", 0.15);
- float free_translation_inertia = EDITOR_DEF("editors/3d/navigation_feel/translation_inertia", 0.15);
+ float free_orbit_inertia = EDITOR_GET("editors/3d/navigation_feel/orbit_inertia");
+ float free_translation_inertia = EDITOR_GET("editors/3d/navigation_feel/translation_inertia");
//when being manipulated, move more quickly
- float manip_orbit_inertia = EDITOR_DEF("editors/3d/navigation_feel/manipulation_orbit_inertia", 0.1);
- float manip_translation_inertia = EDITOR_DEF("editors/3d/navigation_feel/manipulation_translation_inertia", 0.1);
+ float manip_orbit_inertia = EDITOR_GET("editors/3d/navigation_feel/manipulation_orbit_inertia");
+ float manip_translation_inertia = EDITOR_GET("editors/3d/navigation_feel/manipulation_translation_inertia");
- float zoom_inertia = EDITOR_DEF("editors/3d/navigation_feel/zoom_inertia", 0.1);
+ float zoom_inertia = EDITOR_GET("editors/3d/navigation_feel/zoom_inertia");
//determine if being manipulated
bool manipulated = (Input::get_singleton()->get_mouse_button_mask() & (2 | 4)) || Input::get_singleton()->is_key_pressed(KEY_SHIFT) || Input::get_singleton()->is_key_pressed(KEY_ALT) || Input::get_singleton()->is_key_pressed(KEY_CONTROL);
@@ -104,21 +101,30 @@ void SpatialEditorViewport::_update_camera(float p_interp_delta) {
camera_cursor = cursor;
}
- float tolerance = 0.0001;
+ float tolerance = 0.001;
bool equal = true;
- if (Math::abs(old_camera_cursor.x_rot - camera_cursor.x_rot) > tolerance || Math::abs(old_camera_cursor.y_rot - camera_cursor.y_rot) > tolerance)
+ if (Math::abs(old_camera_cursor.x_rot - camera_cursor.x_rot) > tolerance || Math::abs(old_camera_cursor.y_rot - camera_cursor.y_rot) > tolerance) {
equal = false;
+ }
- if (equal && old_camera_cursor.pos.distance_squared_to(camera_cursor.pos) > tolerance * tolerance)
+ if (equal && old_camera_cursor.pos.distance_squared_to(camera_cursor.pos) > tolerance * tolerance) {
equal = false;
+ }
- if (equal && Math::abs(old_camera_cursor.distance - camera_cursor.distance) > tolerance)
+ if (equal && Math::abs(old_camera_cursor.distance - camera_cursor.distance) > tolerance) {
equal = false;
+ }
- if (!equal || p_interp_delta == 0 || is_freelook_active()) {
+ if (!equal || p_interp_delta == 0 || is_freelook_active() || is_orthogonal != orthogonal) {
camera->set_global_transform(to_camera_transform(camera_cursor));
update_transform_gizmo_view();
+
+ if (orthogonal) {
+ //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar());
+ camera->set_orthogonal(2 * cursor.distance, 0.1, 8192);
+ } else
+ camera->set_perspective(get_fov(), get_znear(), get_zfar());
}
}
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index b85ffd6c67..328d07d7a8 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -351,6 +351,10 @@ PoolVector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool era
return PoolVector<Vector2>();
}
+ if (id == prev_id) {
+ return PoolVector<Vector2>();
+ }
+
Rect2i r = node->get_item_rect();
r.position = r.position / node->get_cell_size();
r.size = r.size / node->get_cell_size();
diff --git a/main/main.cpp b/main/main.cpp
index 1f7418ba2a..9096b935c2 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -74,6 +74,7 @@
#include "performance.h"
#include "translation.h"
#include "version.h"
+#include "version_hash.gen.h"
static ProjectSettings *globals = NULL;
static Engine *engine = NULL;
@@ -122,6 +123,14 @@ static String unescape_cmdline(const String &p_str) {
return p_str.replace("%20", " ");
}
+static String get_full_version_string() {
+
+ String hash = String(VERSION_HASH);
+ if (hash.length() != 0)
+ hash = "." + hash.left(7);
+ return String(VERSION_MKSTRING) + hash;
+}
+
//#define DEBUG_INIT
#ifdef DEBUG_INIT
@@ -132,7 +141,7 @@ static String unescape_cmdline(const String &p_str) {
void Main::print_help(const char *p_binary) {
- OS::get_singleton()->print(VERSION_FULL_NAME " - https://godotengine.org\n");
+ print_line(String(_MKSTR(VERSION_NAME)) + " v" + get_full_version_string() + " - https://godotengine.org");
OS::get_singleton()->print("(c) 2007-2017 Juan Linietsky, Ariel Manzur.\n");
OS::get_singleton()->print("(c) 2014-2017 Godot Engine contributors.\n");
OS::get_singleton()->print("\n");
@@ -141,6 +150,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print("General options:\n");
OS::get_singleton()->print(" -h, --help Display this help message.\n");
+ OS::get_singleton()->print(" --version Display the version string.\n");
OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n");
OS::get_singleton()->print(" --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n");
OS::get_singleton()->print("\n");
@@ -195,7 +205,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n");
OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n");
OS::get_singleton()->print(" --disable-crash-handler Disable crash handler when supported by the platform code.\n");
- OS::get_singleton()->print(" --fixed-fps <fps> Forces a fixed ratio between process and fixed_process timing, for use when precision is required, or when rendering to video files. Setting this will disable real-time syncronization, so that run speed is only capped by performance\n");
+ OS::get_singleton()->print(" --fixed-fps <fps> Force a fixed number of frames per second. This setting disables real-time synchronization.\n");
OS::get_singleton()->print("\n");
OS::get_singleton()->print("Standalone tools:\n");
@@ -203,7 +213,7 @@ void Main::print_help(const char *p_binary) {
#ifdef TOOLS_ENABLED
OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n");
OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n");
- OS::get_singleton()->print(" --doctool <file> Dump the whole engine API to <file> in XML format. If <file> exists, it will be merged.\n");
+ OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n");
OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
#ifdef DEBUG_METHODS_ENABLED
OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
@@ -268,7 +278,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
while (I) {
I->get() = unescape_cmdline(I->get().strip_escapes());
- //print_line("CMD: "+I->get());
I = I->next();
}
@@ -318,6 +327,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
show_help = true;
goto error;
+ } else if (I->get() == "--version") {
+
+ print_line(get_full_version_string());
+ goto error;
+
} else if (I->get() == "--resolution") { // force resolution
if (I->next()) {
diff --git a/misc/dist/linux/godot.6 b/misc/dist/linux/godot.6
new file mode 100644
index 0000000000..946fa6c913
--- /dev/null
+++ b/misc/dist/linux/godot.6
@@ -0,0 +1,165 @@
+.TH GODOT "6" "September 2017" "godot 3.0-alpha" "Games"
+.SH NAME
+godot \- multi\-platform 2D and 3D game engine with a feature\-rich editor
+.SH SYNOPSIS
+.B godot
+[\fI\,options\/\fR] [path to scene or 'project.godot' file]
+.SH DESCRIPTION
+Godot Engine is an advanced, feature\-packed, multi\-platform 2D and 3D game
+engine.
+.br
+It provides a huge set of common tools, so you can just focus on making
+your game without reinventing the wheel.
+.SS "General options:"
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display this help message.
+.TP
+\fB\-\-version\fR
+Display the version string.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Use verbose stdout mode.
+.TP
+\fB\-\-quiet\fR
+Quiet mode, silences stdout messages. Errors are still displayed.
+.SS "Run options:"
+.TP
+\fB\-e\fR, \fB\-\-editor\fR
+Start the editor instead of running the scene.
+.TP
+\fB\-p\fR, \fB\-\-project\-manager\fR
+Start the project manager, even if a project is auto\-detected.
+.TP
+\fB\-l\fR, \fB\-\-language\fR <locale>
+Use a specific locale (<locale> being a two\-letter code).
+.TP
+\fB\-\-path\fR <directory>
+Path to a project (<directory> must contain a 'project.godot' file).
+.TP
+\fB\-\-main\-pack\fR <file>
+Path to a pack (.pck) file to load.
+.TP
+\fB\-\-render\-thread\fR <mode>
+Render thread mode ('unsafe', 'safe', 'separate').
+.TP
+\fB\-\-remote\-fs\fR <address>
+Remote filesystem (<host/IP>[:<port>] address).
+.TP
+\fB\-\-remote\-fs\-password\fR <password>
+Password for remote filesystem.
+.TP
+\fB\-\-audio\-driver\fR <driver>
+Audio driver ('PulseAudio', 'ALSA').
+.TP
+\fB\-\-video\-driver\fR <driver>
+Video driver ('GLES3').
+.SS "Display options:"
+.TP
+\fB\-f\fR, \fB\-\-fullscreen\fR
+Request fullscreen mode.
+.TP
+\fB\-m\fR, \fB\-\-maximized\fR
+Request a maximized window.
+.TP
+\fB\-w\fR, \fB\-\-windowed\fR
+Request windowed mode.
+.TP
+\fB\-\-resolution\fR <W>x<H>
+Request window resolution.
+.TP
+\fB\-\-position\fR <X>,<Y>
+Request window position.
+.TP
+\fB\-\-low\-dpi\fR
+Force low\-DPI mode (macOS and Windows only).
+.TP
+\fB\-\-no\-window\fR
+Disable window creation (Windows only). Useful together with \fB\-\-script\fR.
+.SS "Debug options:"
+.TP
+\fB\-d\fR, \fB\-\-debug\fR
+Debug (local stdout debugger).
+.TP
+\fB\-b\fR, \fB\-\-breakpoints\fR
+Breakpoint list as source::line comma\-separated pairs, no spaces (use %20 instead).
+.TP
+\fB\-\-profiling\fR
+Enable profiling in the script debugger.
+.TP
+\fB\-\-remote\-debug\fR <address>
+Remote debug (<host/IP>:<port> address).
+.TP
+\fB\-\-debug\-collisions\fR
+Show collisions shapes when running the scene.
+.TP
+\fB\-\-debug\-navigation\fR
+Show navigation polygons when running the scene.
+.TP
+\fB\-\-frame\-delay\fR <ms>
+Simulate high CPU load (delay each frame by <ms> milliseconds).
+.TP
+\fB\-\-time\-scale\fR <scale>
+Force time scale (higher values are faster, 1.0 is normal speed).
+.TP
+\fB\-\-disable\-render\-loop\fR
+Disable render loop so rendering only occurs when called explicitly from script.
+.TP
+\fB\-\-disable\-crash\-handler\fR
+Disable crash handler when supported by the platform code.
+.TP
+\fB\-\-fixed\-fps\fR <fps>
+Force a fixed number of frames per second. This setting disables real\-time synchronization.
+.SS "Standalone tools:"
+.TP
+\fB\-s\fR, \fB\-\-script\fR <script>
+Run a script.
+.TP
+\fB\-\-export\fR <target>
+Export the project using the given export target.
+.TP
+\fB\-\-export\-debug\fR
+Use together with \fB\-\-export\fR, enables debug mode for the template.
+.TP
+\fB\-\-doctool\fR <path>
+Dump the engine API reference to the given <path> in XML format, merging if existing files are found.
+.TP
+\fB\-\-no\-docbase\fR
+Disallow dumping the base types (used with \fB\-\-doctool\fR).
+.TP
+\fB\-\-gdnative\-generate\-json\-api\fR
+Generate JSON dump of the Godot API for GDNative bindings.
+.TP
+\fB\-\-test\fR <test>
+Run a unit test ('string', 'containers', 'math', 'render', 'multimesh', 'gui', 'io', 'shaderlang', 'physics', 'oa_hash_map').
+.SH FILES
+~/.godot/
+.RS
+User\-specific configuration and cache folder, contains persistent editor and game configuration and saved files, temporary metadata, etc.
+.RE
+~/.godot/app_userdata/
+.RS
+Contains the default configuration and user data folders for Godot\-made games (\fIuser://\fR path).
+.RE
+~/.godot/templates/
+.RS
+Installation folder for "export templates", compiled binaries of the engine to deploy on the many supported platforms.
+.RE
+/usr/share/doc/godot/
+.RS
+Additional documentation files.
+.RE
+/usr/share/licenses/godot/
+.RS
+Detailed licensing information.
+.RE
+.SH "SEE ALSO"
+See the project website at \fIhttps://godotengine.org\fR and the source
+code repository at \fIhttps://github.com/godotengine/godot\fR for more details.
+.SH BUGS
+Godot Engine is a free and open source project and welcomes any kind of
+contributions. In particular, you can report issues or make suggestions on
+Godot's issue tracker at \fIhttps://github.com/godotengine/godot/issues\fR.
+.SH AUTHOR
+Man page written by Rémi Verschelde <akien@godotengine.org> on behalf of the
+Godot Engine development team.
diff --git a/misc/dist/linux/godot.appdata.xml b/misc/dist/linux/godot.appdata.xml
new file mode 100644
index 0000000000..907fe1f3be
--- /dev/null
+++ b/misc/dist/linux/godot.appdata.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2017 Rémi Verschelde <akien@godotengine.org> -->
+<component type="desktop">
+ <id>godot.desktop</id>
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>MIT</project_license>
+ <name>Godot Engine</name>
+ <summary>Multi-platform 2D and 3D game engine with a feature-rich editor</summary>
+ <description>
+ <p>
+ Godot is an advanced, feature-packed, multi-platform 2D and 3D game
+ engine. It provides a huge set of common tools, so you can just focus on
+ making your game without reinventing the wheel.
+ </p>
+ <p>
+ Godot is completely free and open source under the very permissive MIT
+ license. No strings attached, no royalties, nothing. Your game is yours,
+ down to the last line of engine code.
+ </p>
+ </description>
+ <screenshots>
+ <screenshot type="default" width="1330" height="720">
+ <caption>3D project loaded in the Godot Engine editor</caption>
+ <image>https://download.tuxfamily.org/godotengine/media/screenshots/editor_3d_fracteed-720p.jpg</image>
+ </screenshot>
+ </screenshots>
+ <url type="homepage">https://godotengine.org</url>
+ <url type="bugtracker">https://github.com/godotengine/godot/issues</url>
+ <url type="help">http://docs.godotengine.org</url>
+ <url type="donation">https://godotengine.org/donate</url>
+ <url type="translate">https://hosted.weblate.org/projects/godot-engine/godot</url>
+ <developer_name>The Godot Engine Community</developer_name>
+ <update_contact>akien_at_godotengine_dot_org</update_contact>
+</component>
diff --git a/misc/dist/linux/godot.desktop b/misc/dist/linux/godot.desktop
new file mode 100644
index 0000000000..545c491256
--- /dev/null
+++ b/misc/dist/linux/godot.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Godot Engine
+GenericName=Libre game engine
+Comment=Multi-platform 2D and 3D game engine with a feature rich editor
+Exec=godot -pm
+Icon=godot
+Terminal=false
+Type=Application
+Categories=Development;IDE;
diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp
index d40bf73883..c19bdc4214 100644
--- a/modules/openssl/stream_peer_openssl.cpp
+++ b/modules/openssl/stream_peer_openssl.cpp
@@ -29,6 +29,17 @@
/*************************************************************************/
#include "stream_peer_openssl.h"
+// Compatibility with OpenSSL 1.1.0.
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#define BIO_set_num(b, n)
+#else
+#define BIO_set_num(b, n) ((b)->num = (n))
+
+#define BIO_set_init(b, i) ((b)->init = (i))
+#define BIO_set_data(b, p) ((b)->ptr = (p))
+#define BIO_get_data(b) ((b)->ptr)
+#endif
+
//hostname matching code from curl
bool StreamPeerOpenSSL::_match_host_name(const char *name, const char *hostname) {
@@ -157,10 +168,10 @@ int StreamPeerOpenSSL::_cert_verify_callback(X509_STORE_CTX *x509_ctx, void *arg
}
int StreamPeerOpenSSL::_bio_create(BIO *b) {
- b->init = 1;
- b->num = 0;
- b->ptr = NULL;
- b->flags = 0;
+ BIO_set_init(b, 1);
+ BIO_set_num(b, 0);
+ BIO_set_data(b, NULL);
+ BIO_clear_flags(b, ~0);
return 1;
}
@@ -168,9 +179,9 @@ int StreamPeerOpenSSL::_bio_destroy(BIO *b) {
if (b == NULL)
return 0;
- b->ptr = NULL; /* sb_tls_remove() will free it */
- b->init = 0;
- b->flags = 0;
+ BIO_set_data(b, NULL); /* sb_tls_remove() will free it */
+ BIO_set_init(b, 0);
+ BIO_clear_flags(b, ~0);
return 1;
}
@@ -178,7 +189,7 @@ int StreamPeerOpenSSL::_bio_read(BIO *b, char *buf, int len) {
if (buf == NULL || len <= 0) return 0;
- StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)b->ptr;
+ StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)BIO_get_data(b);
ERR_FAIL_COND_V(sp == NULL, 0);
@@ -212,7 +223,7 @@ int StreamPeerOpenSSL::_bio_write(BIO *b, const char *buf, int len) {
if (buf == NULL || len <= 0) return 0;
- StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)b->ptr;
+ StreamPeerOpenSSL *sp = (StreamPeerOpenSSL *)BIO_get_data(b);
ERR_FAIL_COND_V(sp == NULL, 0);
@@ -258,6 +269,26 @@ int StreamPeerOpenSSL::_bio_puts(BIO *b, const char *str) {
return _bio_write(b, str, strlen(str));
}
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+BIO_METHOD *StreamPeerOpenSSL::_bio_method = NULL;
+
+BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() {
+ if (_bio_method) // already initialized.
+ return _bio_method;
+
+ /* it's a source/sink BIO */
+ _bio_method = BIO_meth_new(100 | 0x400, "streampeer glue");
+ BIO_meth_set_write(_bio_method, _bio_write);
+ BIO_meth_set_read(_bio_method, _bio_read);
+ BIO_meth_set_puts(_bio_method, _bio_puts);
+ BIO_meth_set_gets(_bio_method, _bio_gets);
+ BIO_meth_set_ctrl(_bio_method, _bio_ctrl);
+ BIO_meth_set_create(_bio_method, _bio_create);
+ BIO_meth_set_destroy(_bio_method, _bio_destroy);
+
+ return _bio_method;
+}
+#else
BIO_METHOD StreamPeerOpenSSL::_bio_method = {
/* it's a source/sink BIO */
(100 | 0x400),
@@ -271,6 +302,11 @@ BIO_METHOD StreamPeerOpenSSL::_bio_method = {
_bio_destroy
};
+BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() {
+ return &_bio_method;
+}
+#endif
+
Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname) {
if (connected)
@@ -330,8 +366,8 @@ Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida
}
ssl = SSL_new(ctx);
- bio = BIO_new(&_bio_method);
- bio->ptr = this;
+ bio = BIO_new(_get_bio_method());
+ BIO_set_data(bio, this);
SSL_set_bio(ssl, bio, bio);
if (p_for_hostname != String()) {
@@ -532,7 +568,9 @@ void StreamPeerOpenSSL::initialize_ssl() {
load_certs_func = _load_certs;
_create = _create_func;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use
+#endif
SSL_library_init(); // Initialize OpenSSL's SSL libraries
SSL_load_error_strings(); // Load SSL error strings
ERR_load_BIO_strings(); // Load BIO error strings
diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h
index 1e445ef681..535114058d 100644
--- a/modules/openssl/stream_peer_openssl.h
+++ b/modules/openssl/stream_peer_openssl.h
@@ -53,7 +53,12 @@ private:
static int _bio_gets(BIO *b, char *buf, int len);
static int _bio_puts(BIO *b, const char *str);
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ static BIO_METHOD *_bio_method;
+#else
static BIO_METHOD _bio_method;
+#endif
+ static BIO_METHOD *_get_bio_method();
static bool _match_host_name(const char *name, const char *hostname);
static Error _match_common_name(const char *hostname, const X509 *server_cert);
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index c6a9aeba88..6c81da04f5 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -184,7 +184,6 @@ public:
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
virtual String get_executable_path() const;
- virtual String get_resource_dir() const;
virtual LatinKeyboardVariant get_latin_keyboard_variant() const;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 2e300c963d..9a26adc155 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1733,29 +1733,6 @@ String OS_OSX::get_executable_path() const {
}
}
-String OS_OSX::get_resource_dir() const {
- /*
- Bastiaan Olij - I'm leaving this code commented out but in place so we can have a further discussion about this later on.
- For loading the package file from the resource folder it makes more sense to make this call work in ProjectSettings::setup
- instead of relying on changing the current working folder as is the case right now (see godot_main_osx.mm).
- The problem is that when this function returns a value we try and load a project.godot file from this resources folder and
- stop attempting to load anything else if that fails. That breaks our tools build.
- One possible solution is to only apply this logic in a non-tools build with an ifdef block.
-
- For now however, just returning this to working condition.
-
- // start with our executable path
- String path = get_executable_path();
-
- int pos = path.find_last("/Contents/MacOS/");
- if (pos < 0)
- return OS::get_resource_dir();
-
- return path.substr(0, pos) + "/Contents/Resources/";
-*/
- return OS::get_resource_dir();
-}
-
// Returns string representation of keys, if they are printable.
//
static NSString *createStringForKeys(const CGKeyCode *keyCode, int length) {
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 2bb4b59e94..5c13297bc6 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -65,15 +65,6 @@ def configure(env):
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
if (env['builtin_openssl'] == 'no'):
- # Currently not compatible with OpenSSL 1.1.0+
- # https://github.com/godotengine/godot/issues/8624
- import subprocess
- openssl_version = subprocess.check_output(['pkg-config', 'openssl', '--modversion']).strip('\n')
- if (openssl_version >= "1.1.0"):
- print("Error: Found system-installed OpenSSL %s, currently only supporting version 1.0.x." % openssl_version)
- print("Aborting.. You can compile with 'builtin_openssl=yes' to use the bundled version.\n")
- sys.exit(255)
-
env.ParseConfig('pkg-config openssl --cflags --libs')
if (env['builtin_libwebp'] == 'no'):
@@ -98,6 +89,9 @@ def configure(env):
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
env.ParseConfig('pkg-config libsquish --cflags --libs')
+ if env['builtin_zstd'] == 'no':
+ env.ParseConfig('pkg-config libzstd --cflags --libs')
+
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 65eb51a2f3..053ea466f3 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -64,6 +64,7 @@ def get_opts():
return [
('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32),
('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64),
+ ('use_lto', 'Use link time optimization (when using MingW)', 'no'),
('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
]
@@ -256,11 +257,15 @@ def configure(env):
env["CC"] = mingw_prefix + "gcc"
env['AS'] = mingw_prefix + "as"
env['CXX'] = mingw_prefix + "g++"
- env['AR'] = mingw_prefix + "ar"
- env['RANLIB'] = mingw_prefix + "ranlib"
+ env['AR'] = mingw_prefix + "gcc-ar"
+ env['RANLIB'] = mingw_prefix + "gcc-ranlib"
env['LD'] = mingw_prefix + "g++"
env["x86_libtheora_opt_gcc"] = True
+ if (env["use_lto"] == "yes"):
+ env.Append(CCFLAGS=['-flto'])
+ env.Append(LINKFLAGS=['-flto'])
+
## Compile flags
env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index efd388e44f..b9b4ad8201 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -120,6 +120,9 @@ def configure(env):
if (env["use_lto"] == "yes"):
env.Append(CCFLAGS=['-flto'])
env.Append(LINKFLAGS=['-flto'])
+ if (env["use_llvm"] == "no"):
+ env['RANLIB'] = 'gcc-ranlib'
+ env['AR'] = 'gcc-ar'
env.Append(CCFLAGS=['-pipe'])
env.Append(LINKFLAGS=['-pipe'])
@@ -134,15 +137,6 @@ def configure(env):
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
if (env['builtin_openssl'] == 'no'):
- # Currently not compatible with OpenSSL 1.1.0+
- # https://github.com/godotengine/godot/issues/8624
- import subprocess
- openssl_version = subprocess.check_output(['pkg-config', 'openssl', '--modversion']).strip('\n')
- if (openssl_version >= "1.1.0"):
- print("Error: Found system-installed OpenSSL %s, currently only supporting version 1.0.x." % openssl_version)
- print("Aborting.. You can compile with 'builtin_openssl=yes' to use the bundled version.\n")
- sys.exit(255)
-
env.ParseConfig('pkg-config openssl --cflags --libs')
if (env['builtin_libwebp'] == 'no'):
@@ -167,6 +161,9 @@ def configure(env):
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
env.ParseConfig('pkg-config libsquish --cflags --libs')
+ if env['builtin_zstd'] == 'no':
+ env.ParseConfig('pkg-config libzstd --cflags --libs')
+
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index ce56b85a9e..73e5dc6021 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -82,7 +82,7 @@ uint32_t CollisionObject2D::create_shape_owner(Object *p_owner) {
uint32_t id;
if (shapes.size() == 0) {
- id = 1;
+ id = 0;
} else {
id = shapes.back()->key() + 1;
}
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index 1c0633fba7..7b4770e435 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -161,7 +161,7 @@ uint32_t CollisionObject::create_shape_owner(Object *p_owner) {
uint32_t id;
if (shapes.size() == 0) {
- id = 1;
+ id = 0;
} else {
id = shapes.back()->key() + 1;
}
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index c6b434af44..da0f522ff3 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -268,6 +268,8 @@ void SpatialMaterial::init_shaders() {
shader_names->grow = "grow";
+ shader_names->ao_light_affect = "ao_light_affect";
+
shader_names->proximity_fade_distance = "proximity_fade_distance";
shader_names->distance_fade_min = "distance_fade_min";
shader_names->distance_fade_max = "distance_fade_max";
@@ -462,6 +464,7 @@ void SpatialMaterial::_update_shader() {
if (features[FEATURE_AMBIENT_OCCLUSION]) {
code += "uniform sampler2D texture_ambient_occlusion : hint_white;\n";
code += "uniform vec4 ao_texture_channel;\n";
+ code += "uniform float ao_light_affect;\n";
}
if (features[FEATURE_DETAIL]) {
@@ -796,6 +799,8 @@ void SpatialMaterial::_update_shader() {
code += "\tAO = dot(texture(texture_ambient_occlusion,base_uv),ao_texture_channel);\n";
}
}
+
+ code += "\tAO_LIGHT_AFFECT = ao_light_affect;\n";
}
if (features[FEATURE_SUBSURACE_SCATTERING]) {
@@ -1012,6 +1017,16 @@ float SpatialMaterial::get_rim_tint() const {
return rim_tint;
}
+void SpatialMaterial::set_ao_light_affect(float p_ao_light_affect) {
+
+ ao_light_affect = p_ao_light_affect;
+ VS::get_singleton()->material_set_param(_get_material(), shader_names->ao_light_affect, p_ao_light_affect);
+}
+float SpatialMaterial::get_ao_light_affect() const {
+
+ return ao_light_affect;
+}
+
void SpatialMaterial::set_clearcoat(float p_clearcoat) {
clearcoat = p_clearcoat;
@@ -1745,6 +1760,9 @@ void SpatialMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_grow", "amount"), &SpatialMaterial::set_grow);
ClassDB::bind_method(D_METHOD("get_grow"), &SpatialMaterial::get_grow);
+ ClassDB::bind_method(D_METHOD("set_ao_light_affect", "amount"), &SpatialMaterial::set_ao_light_affect);
+ ClassDB::bind_method(D_METHOD("get_ao_light_affect"), &SpatialMaterial::get_ao_light_affect);
+
ClassDB::bind_method(D_METHOD("set_alpha_scissor_threshold", "threshold"), &SpatialMaterial::set_alpha_scissor_threshold);
ClassDB::bind_method(D_METHOD("get_alpha_scissor_threshold"), &SpatialMaterial::get_alpha_scissor_threshold);
@@ -1853,6 +1871,7 @@ void SpatialMaterial::_bind_methods() {
ADD_GROUP("Ambient Occlusion", "ao_");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "ao_enabled"), "set_feature", "get_feature", FEATURE_AMBIENT_OCCLUSION);
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "ao_light_affect", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ao_light_affect", "get_ao_light_affect");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "ao_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_AMBIENT_OCCLUSION);
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "ao_on_uv2"), "set_flag", "get_flag", FLAG_AO_ON_UV2);
ADD_PROPERTY(PropertyInfo(Variant::INT, "ao_texture_channel", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Gray"), "set_ao_texture_channel", "get_ao_texture_channel");
@@ -2036,6 +2055,8 @@ SpatialMaterial::SpatialMaterial()
set_distance_fade_min_distance(0);
set_distance_fade_max_distance(10);
+ set_ao_light_affect(0.0);
+
set_metallic_texture_channel(TEXTURE_CHANNEL_RED);
set_roughness_texture_channel(TEXTURE_CHANNEL_RED);
set_ao_texture_channel(TEXTURE_CHANNEL_RED);
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 721514f586..cf190f0921 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -315,6 +315,7 @@ private:
StringName proximity_fade_distance;
StringName distance_fade_min;
StringName distance_fade_max;
+ StringName ao_light_affect;
StringName metallic_texture_channel;
StringName roughness_texture_channel;
@@ -358,6 +359,7 @@ private:
float point_size;
float alpha_scissor_threshold;
bool grow_enabled;
+ float ao_light_affect;
float grow;
int particles_anim_h_frames;
int particles_anim_v_frames;
@@ -443,6 +445,9 @@ public:
void set_rim_tint(float p_rim_tint);
float get_rim_tint() const;
+ void set_ao_light_affect(float p_ao_light_affect);
+ float get_ao_light_affect() const;
+
void set_clearcoat(float p_clearcoat);
float get_clearcoat() const;
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index ec3337686f..595decb529 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -267,6 +267,7 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[] = {
{ TK_CF_BREAK, "break" },
{ TK_CF_CONTINUE, "continue" },
{ TK_CF_RETURN, "return" },
+ { TK_CF_DISCARD, "discard" },
{ TK_UNIFORM, "uniform" },
{ TK_VARYING, "varying" },
{ TK_ARG_IN, "in" },
@@ -3804,6 +3805,10 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
func_node->return_type = type;
func_node->return_precision = precision;
+ if (p_functions.has(name)) {
+ func_node->can_discard = p_functions[name].can_discard;
+ }
+
func_node->body = alloc_node<BlockNode>();
func_node->body->parent_function = func_node;
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index e828898f82..8c1cb9c828 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -105,6 +105,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SSS_STRENGTH"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["TRANSMISSION"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["AO"] = ShaderLanguage::TYPE_FLOAT;
+ shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["AO_LIGHT_AFFECT"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["EMISSION"] = ShaderLanguage::TYPE_VEC3;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
shader_modes[VS::SHADER_SPATIAL].functions["fragment"].built_ins["DEPTH_TEXTURE"] = ShaderLanguage::TYPE_SAMPLER2D;
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 7c7ce46268..b5cae978f5 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -589,11 +589,29 @@ class VisualServerRaster : public VisualServer {
#endif
void _draw_margins();
+ static void _changes_changed() {}
public:
+//if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
+//#define DEBUG_CHANGES
+
+#ifdef DEBUG_CHANGES
+ _FORCE_INLINE_ static void redraw_request() {
+ changes++;
+ _changes_changed();
+ }
+
+#define DISPLAY_CHANGED \
+ changes++; \
+ _changes_changed();
+
+#else
_FORCE_INLINE_ static void redraw_request() { changes++; }
-#define DISPLAY_CHANGED changes++;
+#define DISPLAY_CHANGED \
+ changes++;
+#endif
+// print_line(String("CHANGED: ") + __FUNCTION__);
#define BIND0R(m_r, m_name) \
m_r m_name() { return BINDBASE->m_name(); }
diff --git a/thirdparty/zstd/SCsub b/thirdparty/zstd/SCsub
new file mode 100644
index 0000000000..e8be1aaf44
--- /dev/null
+++ b/thirdparty/zstd/SCsub
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+Import('env')
+
+thirdparty_zstd_dir = "#thirdparty/zstd/"
+thirdparty_zstd_sources = [
+ "common/entropy_common.c",
+ "common/error_private.c",
+ "common/fse_decompress.c",
+ "common/pool.c",
+ "common/threading.c",
+ "common/xxhash.c",
+ "common/zstd_common.c",
+ "compress/fse_compress.c",
+ "compress/huf_compress.c",
+ "compress/zstd_compress.c",
+ "compress/zstdmt_compress.c",
+ "decompress/huf_decompress.c",
+ "decompress/zstd_decompress.c",
+]
+thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
+env.add_source_files(env.core_sources, thirdparty_zstd_sources)
+env.Append(CPPPATH=["#thirdparty/zstd", "#thirdparty/zstd/common"])