diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/global_constants.cpp | 1 | ||||
-rw-r--r-- | core/input_map.cpp | 2 | ||||
-rw-r--r-- | core/io/compression.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_memory.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_network.cpp | 2 | ||||
-rw-r--r-- | core/io/packet_peer.cpp | 2 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 2 | ||||
-rw-r--r-- | core/io/resource_saver.cpp | 2 | ||||
-rw-r--r-- | core/math/camera_matrix.cpp | 124 | ||||
-rw-r--r-- | core/math/camera_matrix.h | 2 | ||||
-rw-r--r-- | core/math/face3.h | 24 | ||||
-rw-r--r-- | core/os/dir_access.cpp | 2 | ||||
-rw-r--r-- | core/os/file_access.cpp | 2 | ||||
-rw-r--r-- | core/os/input.cpp | 2 | ||||
-rw-r--r-- | core/os/keyboard.cpp | 2 | ||||
-rw-r--r-- | core/os/keyboard.h | 1 | ||||
-rw-r--r-- | core/os/os.h | 6 | ||||
-rw-r--r-- | core/project_settings.cpp | 50 | ||||
-rw-r--r-- | core/project_settings.h | 2 | ||||
-rw-r--r-- | core/reference.cpp | 3 | ||||
-rw-r--r-- | core/reference.h | 6 | ||||
-rw-r--r-- | core/register_core_types.cpp | 2 | ||||
-rw-r--r-- | core/script_debugger_remote.cpp | 4 | ||||
-rw-r--r-- | core/translation.cpp | 2 |
24 files changed, 181 insertions, 68 deletions
diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 4f535fb05e..18071d7748 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -106,7 +106,6 @@ static _GlobalConstant _global_constants[] = { BIND_GLOBAL_CONSTANT(KEY_F14), BIND_GLOBAL_CONSTANT(KEY_F15), BIND_GLOBAL_CONSTANT(KEY_F16), - BIND_GLOBAL_CONSTANT(KEY_KP_ENTER), BIND_GLOBAL_CONSTANT(KEY_KP_MULTIPLY), BIND_GLOBAL_CONSTANT(KEY_KP_DIVIDE), BIND_GLOBAL_CONSTANT(KEY_KP_SUBTRACT), diff --git a/core/input_map.cpp b/core/input_map.cpp index 1abe019167..24d0624e98 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "input_map.h" -#include "project_settings.h" #include "os/keyboard.h" +#include "project_settings.h" InputMap *InputMap::singleton = NULL; diff --git a/core/io/compression.cpp b/core/io/compression.cpp index ca35ece8f5..139383710c 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "compression.h" -#include "project_settings.h" #include "os/copymem.h" +#include "project_settings.h" #include "zip_io.h" #include "thirdparty/misc/fastlz.h" diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 2197b187eb..8e719568e5 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -29,10 +29,10 @@ /*************************************************************************/ #include "file_access_memory.h" -#include "project_settings.h" #include "map.h" #include "os/copymem.h" #include "os/dir_access.h" +#include "project_settings.h" static Map<String, Vector<uint8_t> > *files = NULL; diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 46457d1425..aa67479d7e 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "file_access_network.h" -#include "project_settings.h" #include "io/ip.h" #include "marshalls.h" #include "os/os.h" +#include "project_settings.h" //#define DEBUG_PRINT(m_p) print_line(m_p) //#define DEBUG_TIME(m_what) printf("MS: %s - %lli\n",m_what,OS::get_singleton()->get_ticks_usec()); diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 81446a3886..a3d33593dd 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "packet_peer.h" -#include "project_settings.h" #include "io/marshalls.h" +#include "project_settings.h" /* helpers / binders */ PacketPeer::PacketPeer() { diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 602cbe6f30..9aa16ed7e7 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "resource_format_binary.h" -#include "project_settings.h" #include "image.h" #include "io/file_access_compressed.h" #include "io/marshalls.h" #include "os/dir_access.h" +#include "project_settings.h" #include "version.h" //#define print_bl(m_what) print_line(m_what) #define print_bl(m_what) diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 58913b80cc..314259b2e9 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "resource_saver.h" -#include "project_settings.h" #include "os/file_access.h" +#include "project_settings.h" #include "resource_loader.h" #include "script_language.h" diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 33ad522315..a1666ccd8b 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -91,6 +91,72 @@ void CameraMatrix::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_ matrix[3][3] = 0; } +void CameraMatrix::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov, int p_eye, real_t p_intraocular_dist, real_t p_convergence_dist) { + if (p_flip_fov) { + p_fovy_degrees = get_fovy(p_fovy_degrees, 1.0 / p_aspect); + } + + real_t left, right, modeltranslation, ymax, xmax, frustumshift; + + ymax = p_z_near * tan(p_fovy_degrees * Math_PI / 360.0f); + xmax = ymax * p_aspect; + frustumshift = (p_intraocular_dist / 2.0) * p_z_near / p_convergence_dist; + + switch (p_eye) { + case 1: { // left eye + left = -xmax + frustumshift; + right = xmax + frustumshift; + modeltranslation = p_intraocular_dist / 2.0; + }; break; + case 2: { // right eye + left = -xmax - frustumshift; + right = xmax - frustumshift; + modeltranslation = -p_intraocular_dist / 2.0; + }; break; + default: { // mono, should give the same result as set_perspective(p_fovy_degrees,p_aspect,p_z_near,p_z_far,p_flip_fov) + left = -xmax; + right = xmax; + modeltranslation = 0.0; + }; break; + }; + + set_frustum(left, right, -ymax, ymax, p_z_near, p_z_far); + + // translate matrix by (modeltranslation, 0.0, 0.0) + CameraMatrix cm; + cm.set_identity(); + cm.matrix[3][0] = modeltranslation; + *this = *this * cm; +} + +void CameraMatrix::set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_dist, real_t p_display_width, real_t p_display_to_lens, real_t p_oversample, real_t p_z_near, real_t p_z_far) { + // we first calculate our base frustum on our values without taking our lens magnification into account. + real_t display_to_eye = 2.0 * p_display_to_lens; + real_t f1 = (p_intraocular_dist * 0.5) / p_display_to_lens; + real_t f2 = ((p_display_width - p_intraocular_dist) * 0.5) / p_display_to_lens; + real_t f3 = (p_display_width / 4.0) / p_display_to_lens; + + // now we apply our oversample factor to increase our FOV. how much we oversample is always a balance we strike between performance and how much + // we're willing to sacrifice in FOV. + real_t add = ((f1 + f2) * (p_oversample - 1.0)) / 2.0; + f1 += add; + f2 += add; + + // always apply KEEP_WIDTH aspect ratio + f3 *= p_aspect; + + switch (p_eye) { + case 1: { // left eye + set_frustum(-f2 * p_z_near, f1 * p_z_near, -f3 * p_z_near, f3 * p_z_near, p_z_near, p_z_far); + }; break; + case 2: { // right eye + set_frustum(-f1 * p_z_near, f2 * p_z_near, -f3 * p_z_near, f3 * p_z_near, p_z_near, p_z_far); + }; break; + default: { // mono, does not apply here! + }; break; + }; +}; + void CameraMatrix::set_orthogonal(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_znear, real_t p_zfar) { set_identity(); @@ -243,23 +309,44 @@ bool CameraMatrix::get_endpoints(const Transform &p_transform, Vector3 *p_8point -matrix[15] + matrix[13]); top_plane.normalize(); - Vector3 near_endpoint; - Vector3 far_endpoint; + Vector3 near_endpoint_left, near_endpoint_right; + Vector3 far_endpoint_left, far_endpoint_right; - bool res = near_plane.intersect_3(right_plane, top_plane, &near_endpoint); + bool res = near_plane.intersect_3(right_plane, top_plane, &near_endpoint_right); ERR_FAIL_COND_V(!res, false); - res = far_plane.intersect_3(right_plane, top_plane, &far_endpoint); + res = far_plane.intersect_3(right_plane, top_plane, &far_endpoint_right); ERR_FAIL_COND_V(!res, false); - p_8points[0] = p_transform.xform(Vector3(near_endpoint.x, near_endpoint.y, near_endpoint.z)); - p_8points[1] = p_transform.xform(Vector3(near_endpoint.x, -near_endpoint.y, near_endpoint.z)); - p_8points[2] = p_transform.xform(Vector3(-near_endpoint.x, near_endpoint.y, near_endpoint.z)); - p_8points[3] = p_transform.xform(Vector3(-near_endpoint.x, -near_endpoint.y, near_endpoint.z)); - p_8points[4] = p_transform.xform(Vector3(far_endpoint.x, far_endpoint.y, far_endpoint.z)); - p_8points[5] = p_transform.xform(Vector3(far_endpoint.x, -far_endpoint.y, far_endpoint.z)); - p_8points[6] = p_transform.xform(Vector3(-far_endpoint.x, far_endpoint.y, far_endpoint.z)); - p_8points[7] = p_transform.xform(Vector3(-far_endpoint.x, -far_endpoint.y, far_endpoint.z)); + if ((matrix[8] == 0) && (matrix[9] == 0)) { + near_endpoint_left = near_endpoint_right; + near_endpoint_left.x = -near_endpoint_left.x; + + far_endpoint_left = far_endpoint_right; + far_endpoint_left.x = -far_endpoint_left.x; + } else { + ///////--- Left Plane ---/////// + Plane left_plane = Plane(matrix[0] + matrix[3], + matrix[4] + matrix[7], + matrix[8] + matrix[11], + -matrix[15] - matrix[12]); + left_plane.normalize(); + + res = near_plane.intersect_3(left_plane, top_plane, &near_endpoint_left); + ERR_FAIL_COND_V(!res, false); + + res = far_plane.intersect_3(left_plane, top_plane, &far_endpoint_left); + ERR_FAIL_COND_V(!res, false); + } + + p_8points[0] = p_transform.xform(Vector3(near_endpoint_right.x, near_endpoint_right.y, near_endpoint_right.z)); + p_8points[1] = p_transform.xform(Vector3(near_endpoint_right.x, -near_endpoint_right.y, near_endpoint_right.z)); + p_8points[2] = p_transform.xform(Vector3(near_endpoint_left.x, near_endpoint_left.y, near_endpoint_left.z)); + p_8points[3] = p_transform.xform(Vector3(near_endpoint_left.x, -near_endpoint_left.y, near_endpoint_left.z)); + p_8points[4] = p_transform.xform(Vector3(far_endpoint_right.x, far_endpoint_right.y, far_endpoint_right.z)); + p_8points[5] = p_transform.xform(Vector3(far_endpoint_right.x, -far_endpoint_right.y, far_endpoint_right.z)); + p_8points[6] = p_transform.xform(Vector3(far_endpoint_left.x, far_endpoint_left.y, far_endpoint_left.z)); + p_8points[7] = p_transform.xform(Vector3(far_endpoint_left.x, -far_endpoint_left.y, far_endpoint_left.z)); return true; } @@ -546,7 +633,18 @@ real_t CameraMatrix::get_fov() const { -matrix[15] + matrix[12]); right_plane.normalize(); - return Math::rad2deg(Math::acos(Math::abs(right_plane.normal.x))) * 2.0; + if ((matrix[8] == 0) && (matrix[9] == 0)) { + return Math::rad2deg(Math::acos(Math::abs(right_plane.normal.x))) * 2.0; + } else { + // our frustum is asymetrical need to calculate the left planes angle seperately.. + Plane left_plane = Plane(matrix[3] + matrix[0], + matrix[7] + matrix[4], + matrix[11] + matrix[8], + matrix[15] + matrix[12]); + left_plane.normalize(); + + return Math::rad2deg(Math::acos(Math::abs(left_plane.normal.x))) + Math::rad2deg(Math::acos(Math::abs(right_plane.normal.x))); + } } void CameraMatrix::make_scale(const Vector3 &p_scale) { diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index af61e35993..4be8ffab8c 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -54,6 +54,8 @@ struct CameraMatrix { void set_light_bias(); void set_light_atlas_rect(const Rect2 &p_rect); void set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov = false); + void set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov, int p_eye, real_t p_intraocular_dist, real_t p_convergence_dist); + void set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_dist, real_t p_display_width, real_t p_display_to_lens, real_t p_oversample, real_t p_z_near, real_t p_z_far); void set_orthogonal(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_znear, real_t p_zfar); void set_orthogonal(real_t p_size, real_t p_aspect, real_t p_znear, real_t p_zfar, bool p_flip_fov = false); void set_frustum(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_near, real_t p_far); diff --git a/core/math/face3.h b/core/math/face3.h index 1cc94321c3..3d02ae4014 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -115,20 +115,20 @@ bool Face3::intersects_aabb2(const Rect3 &p_aabb) const { if (dist_a * dist_b > 0) return false; //does not intersect the plane -#define TEST_AXIS(m_ax) \ - { \ +#define TEST_AXIS(m_ax) \ + { \ real_t aabb_min = p_aabb.position.m_ax; \ real_t aabb_max = p_aabb.position.m_ax + p_aabb.size.m_ax; \ - real_t tri_min, tri_max; \ - for (int i = 0; i < 3; i++) { \ - if (i == 0 || vertex[i].m_ax > tri_max) \ - tri_max = vertex[i].m_ax; \ - if (i == 0 || vertex[i].m_ax < tri_min) \ - tri_min = vertex[i].m_ax; \ - } \ - \ - if (tri_max < aabb_min || aabb_max < tri_min) \ - return false; \ + real_t tri_min, tri_max; \ + for (int i = 0; i < 3; i++) { \ + if (i == 0 || vertex[i].m_ax > tri_max) \ + tri_max = vertex[i].m_ax; \ + if (i == 0 || vertex[i].m_ax < tri_min) \ + tri_min = vertex[i].m_ax; \ + } \ + \ + if (tri_max < aabb_min || aabb_max < tri_min) \ + return false; \ } TEST_AXIS(x); diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index 484942bad5..391ae78c85 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "dir_access.h" -#include "project_settings.h" #include "os/file_access.h" #include "os/memory.h" #include "os/os.h" +#include "project_settings.h" String DirAccess::_get_root_path() const { diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 7f5a84843c..3bd5ac3f41 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -31,8 +31,8 @@ #include "core/io/file_access_pack.h" #include "core/io/marshalls.h" -#include "project_settings.h" #include "os/os.h" +#include "project_settings.h" #include "thirdparty/misc/md5.h" #include "thirdparty/misc/sha256.h" diff --git a/core/os/input.cpp b/core/os/input.cpp index 18d644668c..a90a552d1d 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "input.h" -#include "project_settings.h" #include "input_map.h" #include "os/os.h" +#include "project_settings.h" Input *Input::singleton = NULL; Input *Input::get_singleton() { diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp index 2f5dc03614..e154b1934d 100644 --- a/core/os/keyboard.cpp +++ b/core/os/keyboard.cpp @@ -81,7 +81,6 @@ static const _KeyCodeText _keycodes[] = { {KEY_F14 ,"F14"}, {KEY_F15 ,"F15"}, {KEY_F16 ,"F16"}, - {KEY_KP_ENTER ,"Kp Enter"}, {KEY_KP_MULTIPLY ,"Kp Multiply"}, {KEY_KP_DIVIDE ,"Kp Divide"}, {KEY_KP_SUBTRACT ,"Kp Subtract"}, @@ -334,7 +333,6 @@ bool keycode_has_unicode(uint32_t p_keycode) { case KEY_F14: case KEY_F15: case KEY_F16: - case KEY_KP_ENTER: case KEY_SUPER_L: case KEY_SUPER_R: case KEY_MENU: diff --git a/core/os/keyboard.h b/core/os/keyboard.h index 0a72663867..c6985c887d 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -96,7 +96,6 @@ enum KeyList { KEY_F14 = SPKEY | 0x29, KEY_F15 = SPKEY | 0x2A, KEY_F16 = SPKEY | 0x2B, - KEY_KP_ENTER = SPKEY | 0x80, KEY_KP_MULTIPLY = SPKEY | 0x81, KEY_KP_DIVIDE = SPKEY | 0x82, KEY_KP_SUBTRACT = SPKEY | 0x83, diff --git a/core/os/os.h b/core/os/os.h index 957c1d0ba7..703c6a6bcd 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -184,9 +184,9 @@ public: virtual void set_ime_position(const Point2 &p_pos) {} - virtual Error open_dynamic_library(const String p_path, void *&p_library_handle) { return ERR_UNAVAILABLE; }; - virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; }; - virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) { return ERR_UNAVAILABLE; }; + virtual Error open_dynamic_library(const String p_path, void *&p_library_handle) { return ERR_UNAVAILABLE; } + virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; } + virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) { return ERR_UNAVAILABLE; } virtual void set_keep_screen_on(bool p_enabled); virtual bool is_keep_screen_on() const; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 0426af3fa0..b31f78ec20 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -455,8 +455,10 @@ Error ProjectSettings::_load_settings(const String p_path) { memdelete(f); ERR_FAIL_COND_V(config_version > FORMAT_VERSION, ERR_FILE_CANT_OPEN); } + } else { + // config_version is checked and dropped + set(section + "/" + assign, value); } - set(section + "/" + assign, value); } else if (next_tag.name != String()) { section = next_tag.name; } @@ -600,6 +602,15 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin ERR_FAIL_COND_V(err, err) } + file->store_line("; Engine configuration file."); + file->store_line("; It's best edited using the editor UI and not directly,"); + file->store_line("; since the parameters that go here are not all obvious."); + file->store_line("; "); + file->store_line("; Format: "); + file->store_line("; [section] ; section goes between []"); + file->store_line("; param=value ; assign values to parameters"); + file->store_line(""); + file->store_string("config_version=" + itos(FORMAT_VERSION) + "\n"); if (p_custom_features != String()) file->store_string("custom_features=\"" + p_custom_features + "\"\n"); @@ -640,38 +651,43 @@ Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other par return save_custom(p_file); }; -Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features) { +Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features, bool p_merge_with_current) { ERR_FAIL_COND_V(p_path == "", ERR_INVALID_PARAMETER); Set<_VCSort> vclist; - for (Map<StringName, VariantContainer>::Element *G = props.front(); G; G = G->next()) { + if (p_merge_with_current) { + for (Map<StringName, VariantContainer>::Element *G = props.front(); G; G = G->next()) { - const VariantContainer *v = &G->get(); + const VariantContainer *v = &G->get(); - if (v->hide_from_editor) - continue; + if (v->hide_from_editor) + continue; - if (p_custom.has(G->key())) - continue; + if (p_custom.has(G->key())) + continue; - _VCSort vc; - vc.name = G->key(); //*k; - vc.order = v->order; - vc.type = v->variant.get_type(); - vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE; - if (v->variant == v->initial) - continue; + _VCSort vc; + vc.name = G->key(); //*k; + vc.order = v->order; + vc.type = v->variant.get_type(); + vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE; + if (v->variant == v->initial) + continue; - vclist.insert(vc); + vclist.insert(vc); + } } for (const Map<String, Variant>::Element *E = p_custom.front(); E; E = E->next()) { + // Lookup global prop to store in the same order + Map<StringName, VariantContainer>::Element *global_prop = props.find(E->key()); + _VCSort vc; vc.name = E->key(); - vc.order = 0xFFFFFFF; + vc.order = global_prop ? global_prop->get().order : 0xFFFFFFF; vc.type = E->get().get_type(); vc.flags = PROPERTY_USAGE_STORAGE; vclist.insert(vc); diff --git a/core/project_settings.h b/core/project_settings.h index 278d4b8132..c58ac3ca49 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -138,7 +138,7 @@ public: Error setup(const String &p_path, const String &p_main_pack); - Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>()); + Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true); Error save(); void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info); diff --git a/core/reference.cpp b/core/reference.cpp index c55f8a7fe3..060608eacb 100644 --- a/core/reference.cpp +++ b/core/reference.cpp @@ -74,7 +74,8 @@ bool Reference::unreference() { bool die = refcount.unref(); if (get_script_instance()) { - die = die && get_script_instance()->refcount_decremented(); + bool script_ret = get_script_instance()->refcount_decremented(); + die = die && script_ret; } return die; diff --git a/core/reference.h b/core/reference.h index 4e2d6c36c0..90f2791f4b 100644 --- a/core/reference.h +++ b/core/reference.h @@ -330,7 +330,7 @@ struct PtrToArg<Ref<T> > { _FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) { - return Ref<T>(reinterpret_cast<const T *>(p_ptr)); + return Ref<T>(const_cast<T *>(reinterpret_cast<const T *>(p_ptr))); } _FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) { @@ -355,7 +355,7 @@ struct PtrToArg<RefPtr> { _FORCE_INLINE_ static RefPtr convert(const void *p_ptr) { - return Ref<Reference>(reinterpret_cast<const Reference *>(p_ptr)).get_ref_ptr(); + return Ref<Reference>(const_cast<Reference *>(reinterpret_cast<const Reference *>(p_ptr))).get_ref_ptr(); } _FORCE_INLINE_ static void encode(RefPtr p_val, const void *p_ptr) { @@ -370,7 +370,7 @@ struct PtrToArg<const RefPtr &> { _FORCE_INLINE_ static RefPtr convert(const void *p_ptr) { - return Ref<Reference>(reinterpret_cast<const Reference *>(p_ptr)).get_ref_ptr(); + return Ref<Reference>(const_cast<Reference *>(reinterpret_cast<const Reference *>(p_ptr))).get_ref_ptr(); } }; diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 07715f9718..43f781af55 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -36,7 +36,6 @@ #include "core_string_names.h" #include "func_ref.h" #include "geometry.h" -#include "project_settings.h" #include "input_map.h" #include "io/config_file.h" #include "io/http_client.h" @@ -54,6 +53,7 @@ #include "os/main_loop.h" #include "packed_data_container.h" #include "path_remap.h" +#include "project_settings.h" #include "translation.h" #include "undo_redo.h" diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index a7b6f25590..d19fe213f6 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -29,10 +29,10 @@ /*************************************************************************/ #include "script_debugger_remote.h" -#include "project_settings.h" #include "io/ip.h" #include "os/input.h" #include "os/os.h" +#include "project_settings.h" void ScriptDebuggerRemote::_send_video_memory() { @@ -74,7 +74,7 @@ Error ScriptDebuggerRemote::connect_to_host(const String &p_host, uint16_t p_por } else { OS::get_singleton()->delay_usec(1000000); - print_line("Remote Debugger: Connection failed with status: " + String::num(tcp_client->get_status()) + "'', retrying in 1 sec."); + print_line("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in 1 sec."); }; }; diff --git a/core/translation.cpp b/core/translation.cpp index d782006ddc..50694e4a2d 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -29,9 +29,9 @@ /*************************************************************************/ #include "translation.h" -#include "project_settings.h" #include "io/resource_loader.h" #include "os/os.h" +#include "project_settings.h" static const char *locale_list[] = { "aa", // Afar |