summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/os/memory.cpp40
-rw-r--r--core/os/memory.h12
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp1
-rw-r--r--editor/editor_themes.cpp11
-rw-r--r--editor/icons/2x/icon_GUI_dropdown.pngbin183 -> 198 bytes
-rw-r--r--editor/icons/icon_GUI_dropdown.pngbin130 -> 136 bytes
-rw-r--r--editor/icons/source/icon_GUI_dropdown.svg22
-rw-r--r--editor/icons/source/icon_connect.svg46
-rw-r--r--editor/project_settings_editor.cpp18
-rw-r--r--editor/script_create_dialog.cpp31
-rw-r--r--main/main.cpp1
-rw-r--r--main/performance.cpp4
-rw-r--r--modules/gdnative/SCsub15
-rw-r--r--modules/gdnative/gdnative.h2
-rw-r--r--modules/gdnative/godot/array.cpp2
-rw-r--r--modules/gdnative/godot/array.h6
-rw-r--r--modules/gdnative/godot/basis.cpp4
-rw-r--r--modules/gdnative/godot/basis.h6
-rw-r--r--modules/gdnative/godot/color.cpp4
-rw-r--r--modules/gdnative/godot/color.h4
-rw-r--r--modules/gdnative/godot/dictionary.cpp4
-rw-r--r--modules/gdnative/godot/dictionary.h6
-rw-r--r--modules/gdnative/godot/gdnative.cpp2
-rw-r--r--modules/gdnative/godot/gdnative.h34
-rw-r--r--modules/gdnative/godot/node_path.cpp4
-rw-r--r--modules/gdnative/godot/node_path.h4
-rw-r--r--modules/gdnative/godot/plane.cpp4
-rw-r--r--modules/gdnative/godot/plane.h4
-rw-r--r--modules/gdnative/godot/pool_arrays.cpp2
-rw-r--r--modules/gdnative/godot/pool_arrays.h10
-rw-r--r--modules/gdnative/godot/quat.cpp4
-rw-r--r--modules/gdnative/godot/quat.h4
-rw-r--r--modules/gdnative/godot/rect2.cpp4
-rw-r--r--modules/gdnative/godot/rect2.h4
-rw-r--r--modules/gdnative/godot/rect3.cpp4
-rw-r--r--modules/gdnative/godot/rect3.h6
-rw-r--r--modules/gdnative/godot/rid.cpp4
-rw-r--r--modules/gdnative/godot/rid.h2
-rw-r--r--modules/gdnative/godot/string.cpp2
-rw-r--r--modules/gdnative/godot/string.h2
-rw-r--r--modules/gdnative/godot/transform.cpp4
-rw-r--r--modules/gdnative/godot/transform.h8
-rw-r--r--modules/gdnative/godot/transform2d.cpp4
-rw-r--r--modules/gdnative/godot/transform2d.h6
-rw-r--r--modules/gdnative/godot/variant.cpp3
-rw-r--r--modules/gdnative/godot/variant.h38
-rw-r--r--modules/gdnative/godot/vector2.cpp4
-rw-r--r--modules/gdnative/godot/vector2.h2
-rw-r--r--modules/gdnative/godot/vector3.cpp4
-rw-r--r--modules/gdnative/godot/vector3.h4
-rw-r--r--modules/gdnative/register_types.cpp22
-rw-r--r--platform/android/SCsub2
-rw-r--r--platform/android/detect.py28
-rw-r--r--platform/android/export/export.cpp15
-rw-r--r--platform/android/java_class_wrapper.cpp12
-rw-r--r--scene/gui/menu_button.cpp2
-rw-r--r--scene/gui/text_edit.cpp104
-rw-r--r--scene/gui/tree.cpp1
-rw-r--r--servers/audio_server.cpp3
-rw-r--r--servers/physics/area_sw.h1
-rw-r--r--servers/physics/body_sw.cpp3
-rw-r--r--servers/physics/body_sw.h1
-rw-r--r--servers/physics/physics_server_sw.cpp30
-rw-r--r--servers/physics/space_sw.cpp6
-rw-r--r--servers/physics_2d/area_2d_sw.h1
-rw-r--r--servers/physics_2d/body_2d_sw.h1
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.cpp6
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp31
68 files changed, 402 insertions, 283 deletions
diff --git a/core/os/memory.cpp b/core/os/memory.cpp
index 069ee48fae..acc960acd9 100644
--- a/core/os/memory.cpp
+++ b/core/os/memory.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "memory.h"
#include "copymem.h"
+#include "core/safe_refcount.h"
#include "error_macros.h"
#include <stdio.h>
#include <stdlib.h>
@@ -43,14 +44,12 @@ void *operator new(size_t p_size, void *(*p_allocfunc)(size_t p_size)) {
return p_allocfunc(p_size);
}
-#include <stdio.h>
-
#ifdef DEBUG_ENABLED
-size_t Memory::mem_usage = 0;
-size_t Memory::max_usage = 0;
+uint64_t Memory::mem_usage = 0;
+uint64_t Memory::max_usage = 0;
#endif
-size_t Memory::alloc_count = 0;
+uint64_t Memory::alloc_count = 0;
void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
@@ -62,10 +61,10 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
void *mem = malloc(p_bytes + (prepad ? PAD_ALIGN : 0));
- alloc_count++;
-
ERR_FAIL_COND_V(!mem, NULL);
+ atomic_increment(&alloc_count);
+
if (prepad) {
uint64_t *s = (uint64_t *)mem;
*s = p_bytes;
@@ -73,10 +72,8 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
uint8_t *s8 = (uint8_t *)mem;
#ifdef DEBUG_ENABLED
- mem_usage += p_bytes;
- if (mem_usage > max_usage) {
- max_usage = mem_usage;
- }
+ atomic_add(&mem_usage, p_bytes);
+ atomic_exchange_if_greater(&max_usage, mem_usage);
#endif
return s8 + PAD_ALIGN;
} else {
@@ -103,8 +100,12 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
uint64_t *s = (uint64_t *)mem;
#ifdef DEBUG_ENABLED
- mem_usage -= *s;
- mem_usage += p_bytes;
+ if (p_bytes > *s) {
+ atomic_add(&mem_usage, p_bytes - *s);
+ atomic_exchange_if_greater(&max_usage, mem_usage);
+ } else {
+ atomic_sub(&mem_usage, *s - p_bytes);
+ }
#endif
if (p_bytes == 0) {
@@ -144,14 +145,14 @@ void Memory::free_static(void *p_ptr, bool p_pad_align) {
bool prepad = p_pad_align;
#endif
- alloc_count--;
+ atomic_decrement(&alloc_count);
if (prepad) {
mem -= PAD_ALIGN;
uint64_t *s = (uint64_t *)mem;
#ifdef DEBUG_ENABLED
- mem_usage -= *s;
+ atomic_sub(&mem_usage, *s);
#endif
free(mem);
@@ -161,19 +162,20 @@ void Memory::free_static(void *p_ptr, bool p_pad_align) {
}
}
-size_t Memory::get_mem_available() {
+uint64_t Memory::get_mem_available() {
- return 0xFFFFFFFFFFFFF;
+ return -1; // 0xFFFF...
}
-size_t Memory::get_mem_usage() {
+uint64_t Memory::get_mem_usage() {
#ifdef DEBUG_ENABLED
return mem_usage;
#else
return 0;
#endif
}
-size_t Memory::get_mem_max_usage() {
+
+uint64_t Memory::get_mem_max_usage() {
#ifdef DEBUG_ENABLED
return max_usage;
#else
diff --git a/core/os/memory.h b/core/os/memory.h
index b3eb599955..e1d7138ad5 100644
--- a/core/os/memory.h
+++ b/core/os/memory.h
@@ -45,20 +45,20 @@ class Memory {
Memory();
#ifdef DEBUG_ENABLED
- static size_t mem_usage;
- static size_t max_usage;
+ static uint64_t mem_usage;
+ static uint64_t max_usage;
#endif
- static size_t alloc_count;
+ static uint64_t alloc_count;
public:
static void *alloc_static(size_t p_bytes, bool p_pad_align = false);
static void *realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align = false);
static void free_static(void *p_ptr, bool p_pad_align = false);
- static size_t get_mem_available();
- static size_t get_mem_usage();
- static size_t get_mem_max_usage();
+ static uint64_t get_mem_available();
+ static uint64_t get_mem_usage();
+ static uint64_t get_mem_max_usage();
};
class DefaultAllocator {
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index bb7b85e653..3fc5bed80b 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -83,7 +83,6 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL
if (type == _EXT_DEBUG_TYPE_OTHER_ARB)
return;
- print_line("mesege");
char debSource[256], debType[256], debSev[256];
if (source == _EXT_DEBUG_SOURCE_API_ARB)
strcpy(debSource, "OpenGL");
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 6b985c7b4b..df16de947e 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -163,6 +163,13 @@ Ref<Theme> create_editor_theme() {
theme->set_color("light_color_1", "Editor", light_color_1);
theme->set_color("light_color_2", "Editor", light_color_2);
+ Color success_color = highlight_color.linear_interpolate(Color(0, 1, .8), 0.8);
+ Color warning_color = highlight_color.linear_interpolate(Color(1, 1, .2), 0.8);
+ Color error_color = highlight_color.linear_interpolate(Color(1, .2, .2), 0.8);
+ theme->set_color("success_color", "Editor", success_color);
+ theme->set_color("warning_color", "Editor", warning_color);
+ theme->set_color("error_color", "Editor", error_color);
+
// Checkbox icon
theme->set_icon("checked", "CheckBox", theme->get_icon("GuiChecked", "EditorIcons"));
theme->set_icon("unchecked", "CheckBox", theme->get_icon("GuiUnchecked", "EditorIcons"));
@@ -307,8 +314,8 @@ Ref<Theme> create_editor_theme() {
theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
theme->set_icon("select_arrow", "Tree", theme->get_icon("GuiDropdown", "EditorIcons"));
theme->set_stylebox("bg_focus", "Tree", focus_sbt);
- theme->set_stylebox("custom_button", "Tree", style_button_type);
- theme->set_stylebox("custom_button_pressed", "Tree", style_button_type);
+ theme->set_stylebox("custom_button", "Tree", make_empty_stylebox());
+ theme->set_stylebox("custom_button_pressed", "Tree", make_empty_stylebox());
theme->set_stylebox("custom_button_hover", "Tree", style_button_type);
theme->set_color("custom_button_font_highlight", "Tree", HIGHLIGHT_COLOR_LIGHT);
diff --git a/editor/icons/2x/icon_GUI_dropdown.png b/editor/icons/2x/icon_GUI_dropdown.png
index c959378430..78d3352e4e 100644
--- a/editor/icons/2x/icon_GUI_dropdown.png
+++ b/editor/icons/2x/icon_GUI_dropdown.png
Binary files differ
diff --git a/editor/icons/icon_GUI_dropdown.png b/editor/icons/icon_GUI_dropdown.png
index 4bd6544830..d21cdb634e 100644
--- a/editor/icons/icon_GUI_dropdown.png
+++ b/editor/icons/icon_GUI_dropdown.png
Binary files differ
diff --git a/editor/icons/source/icon_GUI_dropdown.svg b/editor/icons/source/icon_GUI_dropdown.svg
index f313b09983..897f63c268 100644
--- a/editor/icons/source/icon_GUI_dropdown.svg
+++ b/editor/icons/source/icon_GUI_dropdown.svg
@@ -9,9 +9,9 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="8"
+ width="14"
height="14"
- viewBox="0 0 8 14"
+ viewBox="0 0 14 14"
id="svg2"
version="1.1"
inkscape:version="0.92+devel unknown"
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="45.254834"
- inkscape:cx="1.2944669"
- inkscape:cy="5.9830116"
+ inkscape:zoom="32"
+ inkscape:cx="6.5843041"
+ inkscape:cy="6.8000184"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -72,21 +72,21 @@
id="layer1"
transform="translate(0,-1038.3622)">
<circle
- style="fill:#ffffff;fill-opacity:0.58823532;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686"
+ style="fill:#ffffff;fill-opacity:0.58823529;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686"
id="path4268"
- cx="4.5"
+ cx="7.5"
cy="1040.8622"
r="1.5" />
<circle
r="1.5"
cy="1045.8622"
- cx="4.5"
+ cx="7.5"
id="circle4271"
- style="fill:#ffffff;fill-opacity:0.58823532;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686" />
+ style="fill:#ffffff;fill-opacity:0.58823529;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686" />
<circle
- style="fill:#ffffff;fill-opacity:0.58823532;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686"
+ style="fill:#ffffff;fill-opacity:0.58823529;stroke-width:2;stroke-linejoin:round;stroke-opacity:0.39215686"
id="circle4273"
- cx="4.5"
+ cx="7.5"
cy="1050.8622"
r="1.5" />
</g>
diff --git a/editor/icons/source/icon_connect.svg b/editor/icons/source/icon_connect.svg
index 745d3cc436..15c8b481a1 100644
--- a/editor/icons/source/icon_connect.svg
+++ b/editor/icons/source/icon_connect.svg
@@ -14,7 +14,7 @@
viewBox="0 0 16 16"
id="svg2"
version="1.1"
- inkscape:version="0.91 r13725"
+ inkscape:version="0.92+devel unknown"
inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
inkscape:export-xdpi="45"
inkscape:export-ydpi="45"
@@ -28,9 +28,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="22.627418"
- inkscape:cx="0.78663326"
- inkscape:cy="12.940707"
+ inkscape:zoom="32.000001"
+ inkscape:cx="13.864856"
+ inkscape:cy="7.2235346"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -46,7 +46,8 @@
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
- inkscape:window-maximized="1">
+ inkscape:window-maximized="1"
+ inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid3336" />
@@ -68,10 +69,37 @@
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1036.3622)">
+ <circle
+ style="fill:#e0e0e0;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
+ id="path4266"
+ cx="4"
+ cy="1048.3622"
+ r="2" />
<path
- style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 7 2 A 2 2 0 0 0 5 4 L 5 7 L 1 7 L 1 9 L 5 9 L 5 12 A 2 2 0 0 0 7 14 L 11 14 L 11 12 L 14 12 L 14 10 L 11 10 L 11 6 L 14 6 L 14 4 L 11 4 L 11 2 L 7 2 z "
- transform="translate(0,1036.3622)"
- id="rect4155" />
+ id="circle4268"
+ style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc"
+ sodipodi:cx="4"
+ sodipodi:cy="1048.3622"
+ sodipodi:rx="5"
+ sodipodi:ry="5"
+ sodipodi:start="4.712389"
+ sodipodi:end="0"
+ sodipodi:arc-type="arc"
+ d="M 4.0000001,1043.3622 A 5,5 0 0 1 9,1048.3622"
+ sodipodi:open="true" />
+ <path
+ id="circle4270"
+ style="fill:none;stroke:#e0e0e0;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc"
+ sodipodi:cx="4"
+ sodipodi:cy="1048.3622"
+ sodipodi:rx="9"
+ sodipodi:ry="9"
+ sodipodi:start="4.712389"
+ sodipodi:end="0"
+ sodipodi:open="true"
+ sodipodi:arc-type="arc"
+ d="m 4.0000002,1039.3622 a 9,9 0 0 1 8.9999998,9" />
</g>
</svg>
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 6d23e874df..6238cad14d 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -140,7 +140,7 @@ void ProjectSettingsEditor::_action_edited() {
add_at = "input/" + old_name;
message->set_text(TTR("Invalid action (anything goes but '/' or ':')."));
- message->popup_centered(Size2(300, 100));
+ message->popup_centered(Size2(300, 100) * EDSCALE);
return;
}
@@ -152,7 +152,7 @@ void ProjectSettingsEditor::_action_edited() {
add_at = "input/" + old_name;
message->set_text(vformat(TTR("Action '%s' already exists!"), new_name));
- message->popup_centered(Size2(300, 100));
+ message->popup_centered(Size2(300, 100) * EDSCALE);
return;
}
@@ -399,7 +399,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
device_index->add_item(TTR("Button 7"));
device_index->add_item(TTR("Button 8"));
device_index->add_item(TTR("Button 9"));
- device_input->popup_centered_minsize(Size2(350, 95));
+ device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE);
Ref<InputEventMouseButton> mb = p_exiting_event;
if (mb.is_valid()) {
@@ -420,7 +420,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
String desc = _axis_names[i];
device_index->add_item(TTR("Axis") + " " + itos(i / 2) + " " + (i & 1 ? "+" : "-") + desc);
}
- device_input->popup_centered_minsize(Size2(350, 95));
+ device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE);
Ref<InputEventJoypadMotion> jm = p_exiting_event;
if (jm.is_valid()) {
@@ -441,7 +441,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
device_index->add_item(itos(i) + ": " + String(_button_names[i]));
}
- device_input->popup_centered_minsize(Size2(350, 95));
+ device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE);
Ref<InputEventJoypadButton> jb = p_exiting_event;
if (jb.is_valid()) {
@@ -835,13 +835,13 @@ void ProjectSettingsEditor::_action_add() {
String action = action_name->get_text();
if (action.find("/") != -1 || action.find(":") != -1 || action == "") {
message->set_text(TTR("Invalid action (anything goes but '/' or ':')."));
- message->popup_centered(Size2(300, 100));
+ message->popup_centered(Size2(300, 100) * EDSCALE);
return;
}
if (ProjectSettings::get_singleton()->has("input/" + action)) {
message->set_text(vformat(TTR("Action '%s' already exists!"), action));
- message->popup_centered(Size2(300, 100));
+ message->popup_centered(Size2(300, 100) * EDSCALE);
return;
}
@@ -879,7 +879,7 @@ void ProjectSettingsEditor::_save() {
Error err = ProjectSettings::get_singleton()->save();
message->set_text(err != OK ? TTR("Error saving settings.") : TTR("Settings saved OK."));
- message->popup_centered(Size2(300, 100));
+ message->popup_centered(Size2(300, 100) * EDSCALE);
}
void ProjectSettingsEditor::_settings_prop_edited(const String &p_name) {
@@ -1554,7 +1554,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
add = memnew(Button);
hbc->add_child(add);
- add->set_custom_minimum_size(Size2(150, 0));
+ add->set_custom_minimum_size(Size2(150, 0) * EDSCALE);
add->set_text(TTR("Add"));
add->connect("pressed", this, "_action_add");
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index d81161ae94..0748c43b5f 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "script_create_dialog.h"
+#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor_file_system.h"
#include "io/resource_saver.h"
@@ -229,7 +230,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
List<String> extensions;
// get all possible extensions for script
for (int l = 0; l < language_menu->get_item_count(); l++) {
- language->get_recognized_extensions(&extensions);
+ ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
}
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
@@ -240,8 +241,11 @@ void ScriptCreateDialog::_lang_changed(int l) {
}
}
}
- file_path->set_text(path);
+ } else {
+ path = "class" + selected_ext;
+ _path_changed(path);
}
+ file_path->set_text(path);
bool use_templates = language->is_using_templates();
template_menu->set_disabled(!use_templates);
@@ -403,9 +407,9 @@ void ScriptCreateDialog::_msg_script_valid(bool valid, const String &p_msg) {
error_label->set_text(TTR(p_msg));
if (valid) {
- error_label->add_color_override("font_color", Color(0, 1.0, 0.8, 0.8));
+ error_label->add_color_override("font_color", get_color("success_color", "Editor"));
} else {
- error_label->add_color_override("font_color", Color(1, 0.2, 0.2, 0.8));
+ error_label->add_color_override("font_color", get_color("error_color", "Editor"));
}
}
@@ -413,9 +417,9 @@ void ScriptCreateDialog::_msg_path_valid(bool valid, const String &p_msg) {
path_error_label->set_text(TTR(p_msg));
if (valid) {
- path_error_label->add_color_override("font_color", Color(0, 1.0, 0.8, 0.8));
+ path_error_label->add_color_override("font_color", get_color("success_color", "Editor"));
} else {
- path_error_label->add_color_override("font_color", Color(1, 0.4, 0.0, 0.8));
+ path_error_label->add_color_override("font_color", get_color("error_color", "Editor"));
}
}
@@ -543,19 +547,6 @@ ScriptCreateDialog::ScriptCreateDialog() {
gc = memnew(GridContainer);
gc->set_columns(2);
- /* Error Stylebox Background */
-
- StyleBoxFlat *sb = memnew(StyleBoxFlat);
- sb->set_bg_color(Color(0, 0, 0, 0.05));
- sb->set_light_color(Color(1, 1, 1, 0.05));
- sb->set_dark_color(Color(1, 1, 1, 0.05));
- sb->set_border_blend(false);
- sb->set_border_size(1);
- sb->set_default_margin(MARGIN_TOP, 10.0 * EDSCALE);
- sb->set_default_margin(MARGIN_BOTTOM, 10.0 * EDSCALE);
- sb->set_default_margin(MARGIN_LEFT, 10.0 * EDSCALE);
- sb->set_default_margin(MARGIN_RIGHT, 10.0 * EDSCALE);
-
/* Error Messages Field */
vb = memnew(VBoxContainer);
@@ -582,7 +573,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
pc = memnew(PanelContainer);
pc->set_h_size_flags(Control::SIZE_FILL);
- pc->add_style_override("panel", sb);
+ pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
pc->add_child(vb);
/* Margins */
diff --git a/main/main.cpp b/main/main.cpp
index 285c900faa..c2058ee8d4 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1704,6 +1704,7 @@ void Main::cleanup() {
#endif
if (audio_server) {
+ audio_server->finish();
memdelete(audio_server);
}
diff --git a/main/performance.cpp b/main/performance.cpp
index c819e15f71..3d8e21bf33 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -117,8 +117,8 @@ float Performance::get_monitor(Monitor p_monitor) const {
case TIME_FIXED_PROCESS: return _fixed_process_time;
case MEMORY_STATIC: return Memory::get_mem_usage();
case MEMORY_DYNAMIC: return MemoryPool::total_memory;
- case MEMORY_STATIC_MAX: return MemoryPool::max_memory;
- case MEMORY_DYNAMIC_MAX: return 0;
+ case MEMORY_STATIC_MAX: return Memory::get_mem_max_usage();
+ case MEMORY_DYNAMIC_MAX: return MemoryPool::max_memory;
case MEMORY_MESSAGE_BUFFER_MAX: return MessageQueue::get_singleton()->get_max_buffer_usage();
case OBJECT_COUNT: return ObjectDB::get_object_count();
case OBJECT_RESOURCE_COUNT: return ResourceCache::get_cached_resource_count();
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index ac13319a1d..014c988bd7 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -1,14 +1,15 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources, "*.cpp")
-env.add_source_files(env.modules_sources, "godot/*.cpp")
+mod_env = env_modules.Clone()
+mod_env.add_source_files(env.modules_sources, "*.cpp")
+mod_env.add_source_files(env.modules_sources, "godot/*.cpp")
-env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN'])
+mod_env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN'])
+mod_env.Append(CPPPATH=['#modules/gdnative/'])
if "platform" in env and env["platform"] == "x11": # there has to be a better solution?
- env.Append(LINKFLAGS=["-rdynamic"])
-env.use_ptrcall = True
-
-Export('env')
+ mod_env.Append(LINKFLAGS=["-rdynamic"])
+mod_env.use_ptrcall = True
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index dd845cab7a..f02741f4e3 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -35,7 +35,7 @@
#include "os/thread_safe.h"
#include "resource.h"
-#include "godot/gdnative.h"
+#include <godot/gdnative.h>
class GDNativeLibrary : public Resource {
GDCLASS(GDNativeLibrary, Resource)
diff --git a/modules/gdnative/godot/array.cpp b/modules/gdnative/godot/array.cpp
index c068eecf8f..97c73dc253 100644
--- a/modules/gdnative/godot/array.cpp
+++ b/modules/gdnative/godot/array.cpp
@@ -27,7 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "array.h"
+#include <godot/array.h>
#include "core/array.h"
#include "core/os/memory.h"
diff --git a/modules/gdnative/godot/array.h b/modules/gdnative/godot/array.h
index cbdbfbdde3..158170ba0e 100644
--- a/modules/gdnative/godot/array.h
+++ b/modules/gdnative/godot/array.h
@@ -46,10 +46,10 @@ typedef struct {
} godot_array;
#endif
-#include "pool_arrays.h"
-#include "variant.h"
+#include <godot/pool_arrays.h>
+#include <godot/variant.h>
-#include "gdnative.h"
+#include <godot/gdnative.h>
void GDAPI godot_array_new(godot_array *r_dest);
void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src);
diff --git a/modules/gdnative/godot/basis.cpp b/modules/gdnative/godot/basis.cpp
index 7188215d04..5cf379b7d5 100644
--- a/modules/gdnative/godot/basis.cpp
+++ b/modules/gdnative/godot/basis.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "basis.h"
-#include "core/variant.h"
+#include <godot/basis.h>
#include "core/math/matrix3.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/basis.h b/modules/gdnative/godot/basis.h
index 79b2b45fdd..e96b8b730d 100644
--- a/modules/gdnative/godot/basis.h
+++ b/modules/gdnative/godot/basis.h
@@ -45,9 +45,9 @@ typedef struct {
} godot_basis;
#endif
-#include "gdnative.h"
-#include "quat.h"
-#include "vector3.h"
+#include <godot/gdnative.h>
+#include <godot/quat.h>
+#include <godot/vector3.h>
void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis);
void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi);
diff --git a/modules/gdnative/godot/color.cpp b/modules/gdnative/godot/color.cpp
index eac966ca1f..a5ffee1e0b 100644
--- a/modules/gdnative/godot/color.cpp
+++ b/modules/gdnative/godot/color.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "color.h"
-#include "core/variant.h"
+#include <godot/color.h>
#include "core/color.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/color.h b/modules/gdnative/godot/color.h
index 77e709fbe3..2cd6b48b48 100644
--- a/modules/gdnative/godot/color.h
+++ b/modules/gdnative/godot/color.h
@@ -45,8 +45,8 @@ typedef struct {
} godot_color;
#endif
-#include "gdnative.h"
-#include "string.h"
+#include <godot/gdnative.h>
+#include <godot/string.h>
void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a);
void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b);
diff --git a/modules/gdnative/godot/dictionary.cpp b/modules/gdnative/godot/dictionary.cpp
index 1c0761edfd..ce402fa008 100644
--- a/modules/gdnative/godot/dictionary.cpp
+++ b/modules/gdnative/godot/dictionary.cpp
@@ -27,11 +27,11 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "dictionary.h"
-#include "core/variant.h"
+#include <godot/dictionary.h>
#include "core/dictionary.h"
#include "core/io/json.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/dictionary.h b/modules/gdnative/godot/dictionary.h
index a08deb27df..594b02b4dd 100644
--- a/modules/gdnative/godot/dictionary.h
+++ b/modules/gdnative/godot/dictionary.h
@@ -45,9 +45,9 @@ typedef struct {
} godot_dictionary;
#endif
-#include "array.h"
-#include "gdnative.h"
-#include "variant.h"
+#include <godot/array.h>
+#include <godot/gdnative.h>
+#include <godot/variant.h>
void GDAPI godot_dictionary_new(godot_dictionary *r_dest);
void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src);
diff --git a/modules/gdnative/godot/gdnative.cpp b/modules/gdnative/godot/gdnative.cpp
index 29b499ebab..4cda1f4560 100644
--- a/modules/gdnative/godot/gdnative.cpp
+++ b/modules/gdnative/godot/gdnative.cpp
@@ -27,7 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "gdnative.h"
+#include <godot/gdnative.h>
#include "class_db.h"
#include "error_macros.h"
diff --git a/modules/gdnative/godot/gdnative.h b/modules/gdnative/godot/gdnative.h
index b0343272ef..d849999079 100644
--- a/modules/gdnative/godot/gdnative.h
+++ b/modules/gdnative/godot/gdnative.h
@@ -174,72 +174,72 @@ typedef struct godot_pool_color_array godot_pool_color_array;
*/
/////// String
-#include "string.h"
+#include <godot/string.h>
////// Vector2
-#include "vector2.h"
+#include <godot/vector2.h>
////// Rect2
-#include "rect2.h"
+#include <godot/rect2.h>
////// Vector3
-#include "vector3.h"
+#include <godot/vector3.h>
////// Transform2D
-#include "transform2d.h"
+#include <godot/transform2d.h>
/////// Plane
-#include "plane.h"
+#include <godot/plane.h>
/////// Quat
-#include "quat.h"
+#include <godot/quat.h>
/////// Rect3
-#include "rect3.h"
+#include <godot/rect3.h>
/////// Basis
-#include "basis.h"
+#include <godot/basis.h>
/////// Transform
-#include "transform.h"
+#include <godot/transform.h>
/////// Color
-#include "color.h"
+#include <godot/color.h>
/////// NodePath
-#include "node_path.h"
+#include <godot/node_path.h>
/////// RID
-#include "rid.h"
+#include <godot/rid.h>
/////// Dictionary
-#include "dictionary.h"
+#include <godot/dictionary.h>
/////// Array
-#include "array.h"
+#include <godot/array.h>
// single API file for Pool*Array
-#include "pool_arrays.h"
+#include <godot/pool_arrays.h>
void GDAPI godot_object_destroy(godot_object *p_o);
////// Variant
-#include "variant.h"
+#include <godot/variant.h>
////// Singleton API
diff --git a/modules/gdnative/godot/node_path.cpp b/modules/gdnative/godot/node_path.cpp
index a9edbc8352..e718a9e55f 100644
--- a/modules/gdnative/godot/node_path.cpp
+++ b/modules/gdnative/godot/node_path.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "node_path.h"
-#include "core/variant.h"
+#include <godot/node_path.h>
#include "core/path_db.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/node_path.h b/modules/gdnative/godot/node_path.h
index 06955a052e..4d3dc4e0ee 100644
--- a/modules/gdnative/godot/node_path.h
+++ b/modules/gdnative/godot/node_path.h
@@ -45,8 +45,8 @@ typedef struct {
} godot_node_path;
#endif
-#include "gdnative.h"
-#include "string.h"
+#include <godot/gdnative.h>
+#include <godot/string.h>
void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from);
void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src);
diff --git a/modules/gdnative/godot/plane.cpp b/modules/gdnative/godot/plane.cpp
index e9e659e5da..5c5b302345 100644
--- a/modules/gdnative/godot/plane.cpp
+++ b/modules/gdnative/godot/plane.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "plane.h"
-#include "core/variant.h"
+#include <godot/plane.h>
#include "core/math/plane.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/plane.h b/modules/gdnative/godot/plane.h
index e9e3b71e03..8519ac60c4 100644
--- a/modules/gdnative/godot/plane.h
+++ b/modules/gdnative/godot/plane.h
@@ -45,8 +45,8 @@ typedef struct {
} godot_plane;
#endif
-#include "gdnative.h"
-#include "vector3.h"
+#include <godot/gdnative.h>
+#include <godot/vector3.h>
void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d);
void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3);
diff --git a/modules/gdnative/godot/pool_arrays.cpp b/modules/gdnative/godot/pool_arrays.cpp
index 6a6ee0f126..fa460be8bc 100644
--- a/modules/gdnative/godot/pool_arrays.cpp
+++ b/modules/gdnative/godot/pool_arrays.cpp
@@ -27,7 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "pool_arrays.h"
+#include <godot/pool_arrays.h>
#include "array.h"
#include "core/variant.h"
diff --git a/modules/gdnative/godot/pool_arrays.h b/modules/gdnative/godot/pool_arrays.h
index 1e2916cea9..29517d21ac 100644
--- a/modules/gdnative/godot/pool_arrays.h
+++ b/modules/gdnative/godot/pool_arrays.h
@@ -113,12 +113,12 @@ typedef struct {
} godot_pool_color_array;
#endif
-#include "array.h"
-#include "color.h"
-#include "vector2.h"
-#include "vector3.h"
+#include <godot/array.h>
+#include <godot/color.h>
+#include <godot/vector2.h>
+#include <godot/vector3.h>
-#include "gdnative.h"
+#include <godot/gdnative.h>
// byte
diff --git a/modules/gdnative/godot/quat.cpp b/modules/gdnative/godot/quat.cpp
index 6800f7fc7e..37ee4d6b15 100644
--- a/modules/gdnative/godot/quat.cpp
+++ b/modules/gdnative/godot/quat.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "quat.h"
-#include "core/variant.h"
+#include <godot/quat.h>
#include "core/math/quat.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/quat.h b/modules/gdnative/godot/quat.h
index b86cbacc62..0979653d93 100644
--- a/modules/gdnative/godot/quat.h
+++ b/modules/gdnative/godot/quat.h
@@ -45,8 +45,8 @@ typedef struct {
} godot_quat;
#endif
-#include "gdnative.h"
-#include "vector3.h"
+#include <godot/gdnative.h>
+#include <godot/vector3.h>
void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w);
void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle);
diff --git a/modules/gdnative/godot/rect2.cpp b/modules/gdnative/godot/rect2.cpp
index 830d7bb496..023584c4f6 100644
--- a/modules/gdnative/godot/rect2.cpp
+++ b/modules/gdnative/godot/rect2.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "rect2.h"
-#include "core/variant.h"
+#include <godot/rect2.h>
#include "core/math/math_2d.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/rect2.h b/modules/gdnative/godot/rect2.h
index 7b6613d9dd..cb1ddb58cf 100644
--- a/modules/gdnative/godot/rect2.h
+++ b/modules/gdnative/godot/rect2.h
@@ -43,8 +43,8 @@ typedef struct godot_rect2 {
} godot_rect2;
#endif
-#include "gdnative.h"
-#include "vector2.h"
+#include <godot/gdnative.h>
+#include <godot/vector2.h>
void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size);
void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height);
diff --git a/modules/gdnative/godot/rect3.cpp b/modules/gdnative/godot/rect3.cpp
index 0fabba5b7b..708d2987f2 100644
--- a/modules/gdnative/godot/rect3.cpp
+++ b/modules/gdnative/godot/rect3.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "rect3.h"
-#include "core/variant.h"
+#include <godot/rect3.h>
#include "core/math/rect3.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/rect3.h b/modules/gdnative/godot/rect3.h
index 638d89f76f..69279351c4 100644
--- a/modules/gdnative/godot/rect3.h
+++ b/modules/gdnative/godot/rect3.h
@@ -45,9 +45,9 @@ typedef struct {
} godot_rect3;
#endif
-#include "gdnative.h"
-#include "plane.h"
-#include "vector3.h"
+#include <godot/gdnative.h>
+#include <godot/plane.h>
+#include <godot/vector3.h>
void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
diff --git a/modules/gdnative/godot/rid.cpp b/modules/gdnative/godot/rid.cpp
index 2b724e554d..eb9538e692 100644
--- a/modules/gdnative/godot/rid.cpp
+++ b/modules/gdnative/godot/rid.cpp
@@ -27,11 +27,11 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "rid.h"
-#include "core/variant.h"
+#include <godot/rid.h>
#include "core/resource.h"
#include "core/rid.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/rid.h b/modules/gdnative/godot/rid.h
index 92e101fd2e..ac5b5383d9 100644
--- a/modules/gdnative/godot/rid.h
+++ b/modules/gdnative/godot/rid.h
@@ -45,7 +45,7 @@ typedef struct {
} godot_rid;
#endif
-#include "gdnative.h"
+#include <godot/gdnative.h>
void GDAPI godot_rid_new(godot_rid *r_dest);
diff --git a/modules/gdnative/godot/string.cpp b/modules/gdnative/godot/string.cpp
index e54ef3655f..3573f266ac 100644
--- a/modules/gdnative/godot/string.cpp
+++ b/modules/gdnative/godot/string.cpp
@@ -27,7 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "string.h"
+#include <godot/string.h>
#include "string_db.h"
#include "ustring.h"
diff --git a/modules/gdnative/godot/string.h b/modules/gdnative/godot/string.h
index d4d6d6c1d0..9013326454 100644
--- a/modules/gdnative/godot/string.h
+++ b/modules/gdnative/godot/string.h
@@ -46,7 +46,7 @@ typedef struct {
} godot_string;
#endif
-#include "gdnative.h"
+#include <godot/gdnative.h>
void GDAPI godot_string_new(godot_string *r_dest);
void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src);
diff --git a/modules/gdnative/godot/transform.cpp b/modules/gdnative/godot/transform.cpp
index e566ed0b6e..87fee918bd 100644
--- a/modules/gdnative/godot/transform.cpp
+++ b/modules/gdnative/godot/transform.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "transform.h"
-#include "core/variant.h"
+#include <godot/transform.h>
#include "core/math/transform.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/transform.h b/modules/gdnative/godot/transform.h
index d14190ec49..30b9970f67 100644
--- a/modules/gdnative/godot/transform.h
+++ b/modules/gdnative/godot/transform.h
@@ -45,10 +45,10 @@ typedef struct {
} godot_transform;
#endif
-#include "basis.h"
-#include "gdnative.h"
-#include "variant.h"
-#include "vector3.h"
+#include <godot/basis.h>
+#include <godot/gdnative.h>
+#include <godot/variant.h>
+#include <godot/vector3.h>
void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin);
void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin);
diff --git a/modules/gdnative/godot/transform2d.cpp b/modules/gdnative/godot/transform2d.cpp
index 01db3f7ae0..65f9f8ee32 100644
--- a/modules/gdnative/godot/transform2d.cpp
+++ b/modules/gdnative/godot/transform2d.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "transform2d.h"
-#include "core/variant.h"
+#include <godot/transform2d.h>
#include "core/math/math_2d.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/transform2d.h b/modules/gdnative/godot/transform2d.h
index 7171e528f2..41c8ba982c 100644
--- a/modules/gdnative/godot/transform2d.h
+++ b/modules/gdnative/godot/transform2d.h
@@ -45,9 +45,9 @@ typedef struct {
} godot_transform2d;
#endif
-#include "gdnative.h"
-#include "variant.h"
-#include "vector2.h"
+#include <godot/gdnative.h>
+#include <godot/variant.h>
+#include <godot/vector2.h>
void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos);
void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin);
diff --git a/modules/gdnative/godot/variant.cpp b/modules/gdnative/godot/variant.cpp
index 3469058cfd..506614583c 100644
--- a/modules/gdnative/godot/variant.cpp
+++ b/modules/gdnative/godot/variant.cpp
@@ -27,7 +27,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "variant.h"
+#include <godot/variant.h>
+
#include "core/variant.h"
#ifdef __cplusplus
diff --git a/modules/gdnative/godot/variant.h b/modules/gdnative/godot/variant.h
index b56d5824fa..1c19d2a25b 100644
--- a/modules/gdnative/godot/variant.h
+++ b/modules/gdnative/godot/variant.h
@@ -99,25 +99,25 @@ typedef struct godot_variant_call_error {
godot_variant_type expected;
} godot_variant_call_error;
-#include "array.h"
-#include "basis.h"
-#include "color.h"
-#include "dictionary.h"
-#include "node_path.h"
-#include "plane.h"
-#include "pool_arrays.h"
-#include "quat.h"
-#include "rect2.h"
-#include "rect3.h"
-#include "rid.h"
-#include "string.h"
-#include "transform.h"
-#include "transform2d.h"
-#include "variant.h"
-#include "vector2.h"
-#include "vector3.h"
-
-#include "gdnative.h"
+#include <godot/array.h>
+#include <godot/basis.h>
+#include <godot/color.h>
+#include <godot/dictionary.h>
+#include <godot/node_path.h>
+#include <godot/plane.h>
+#include <godot/pool_arrays.h>
+#include <godot/quat.h>
+#include <godot/rect2.h>
+#include <godot/rect3.h>
+#include <godot/rid.h>
+#include <godot/string.h>
+#include <godot/transform.h>
+#include <godot/transform2d.h>
+#include <godot/variant.h>
+#include <godot/vector2.h>
+#include <godot/vector3.h>
+
+#include <godot/gdnative.h>
godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v);
diff --git a/modules/gdnative/godot/vector2.cpp b/modules/gdnative/godot/vector2.cpp
index 6b40e31a89..05d4b1acc8 100644
--- a/modules/gdnative/godot/vector2.cpp
+++ b/modules/gdnative/godot/vector2.cpp
@@ -27,10 +27,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "vector2.h"
-#include "core/variant.h"
+#include <godot/vector2.h>
#include "core/math/math_2d.h"
+#include "core/variant.h"
#ifdef __cplusplus
extern "C" {
diff --git a/modules/gdnative/godot/vector2.h b/modules/gdnative/godot/vector2.h
index 9934ddadbb..9db238b4fd 100644
--- a/modules/gdnative/godot/vector2.h
+++ b/modules/gdnative/godot/vector2.h
@@ -45,7 +45,7 @@ typedef struct {
} godot_vector2;
#endif
-#include "gdnative.h"
+#include <godot/gdnative.h>
void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y);
diff --git a/modules/gdnative/godot/vector3.cpp b/modules/gdnative/godot/vector3.cpp
index 904cdad9d0..fe27e740e2 100644
--- a/modules/gdnative/godot/vector3.cpp
+++ b/modules/gdnative/godot/vector3.cpp
@@ -27,9 +27,9 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "vector3.h"
-#include "core/variant.h"
+#include <godot/vector3.h>
+#include "core/variant.h"
#include "core/vector.h"
#ifdef __cplusplus
diff --git a/modules/gdnative/godot/vector3.h b/modules/gdnative/godot/vector3.h
index b5f8d0f49a..8aba1d9a85 100644
--- a/modules/gdnative/godot/vector3.h
+++ b/modules/gdnative/godot/vector3.h
@@ -45,8 +45,8 @@ typedef struct {
} godot_vector3;
#endif
-#include "basis.h"
-#include "gdnative.h"
+#include <godot/basis.h>
+#include <godot/gdnative.h>
typedef enum {
GODOT_VECTOR3_AXIS_X,
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index d180d5aada..da50104e26 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -76,4 +76,26 @@ void register_gdnative_types() {
void unregister_gdnative_types() {
memdelete(GDNativeCallRegistry::singleton);
+
+ // This is for printing out the sizes of the core types
+
+ /*
+ print_line(String("array:\t") + itos(sizeof(Array)));
+ print_line(String("basis:\t") + itos(sizeof(Basis)));
+ print_line(String("color:\t") + itos(sizeof(Color)));
+ print_line(String("dict:\t" ) + itos(sizeof(Dictionary)));
+ print_line(String("node_path:\t") + itos(sizeof(NodePath)));
+ print_line(String("plane:\t") + itos(sizeof(Plane)));
+ print_line(String("poolarray:\t") + itos(sizeof(PoolByteArray)));
+ print_line(String("quat:\t") + itos(sizeof(Quat)));
+ print_line(String("rect2:\t") + itos(sizeof(Rect2)));
+ print_line(String("rect3:\t") + itos(sizeof(Rect3)));
+ print_line(String("rid:\t") + itos(sizeof(RID)));
+ print_line(String("string:\t") + itos(sizeof(String)));
+ print_line(String("transform:\t") + itos(sizeof(Transform)));
+ print_line(String("transfo2D:\t") + itos(sizeof(Transform2D)));
+ print_line(String("variant:\t") + itos(sizeof(Variant)));
+ print_line(String("vector2:\t") + itos(sizeof(Vector2)));
+ print_line(String("vector3:\t") + itos(sizeof(Vector3)));
+ */
}
diff --git a/platform/android/SCsub b/platform/android/SCsub
index 7fb3c876be..b124a1a5a8 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -141,6 +141,8 @@ if env['android_arch'] == 'armv6':
lib_arch_dir = 'armeabi'
elif env['android_arch'] == 'armv7':
lib_arch_dir = 'armeabi-v7a'
+elif env['android_arch'] == 'arm64v8':
+ lib_arch_dir = 'arm64-v8a'
elif env['android_arch'] == 'x86':
lib_arch_dir = 'x86'
else:
diff --git a/platform/android/detect.py b/platform/android/detect.py
index fae1df3f27..ad5bfb4949 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -22,7 +22,7 @@ def get_opts():
return [
('ANDROID_NDK_ROOT', 'Path to the Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
('ndk_platform', 'Target platform (android-<api>, e.g. "android-18")', "android-18"),
- ('android_arch', 'Target architecture (armv7/armv6/x86)', "armv7"),
+ ('android_arch', 'Target architecture (armv7/armv6/arm64v8/x86)', "armv7"),
('android_neon', 'Enable NEON support (armv7 only)', "yes"),
('android_stl', 'Enable Android STL support (for modules)', "no")
]
@@ -89,7 +89,7 @@ def configure(env):
## Architecture
- if env['android_arch'] not in ['armv7', 'armv6', 'x86']:
+ if env['android_arch'] not in ['armv7', 'armv6', 'arm64v8', 'x86']:
env['android_arch'] = 'armv7'
neon_text = ""
@@ -99,18 +99,21 @@ def configure(env):
can_vectorize = True
if env['android_arch'] == 'x86':
+ env['ARCH'] = 'arch-x86'
env.extra_suffix = ".x86" + env.extra_suffix
target_subpath = "x86-4.9"
abi_subpath = "i686-linux-android"
arch_subpath = "x86"
env["x86_libtheora_opt_gcc"] = True
elif env['android_arch'] == 'armv6':
+ env['ARCH'] = 'arch-arm'
env.extra_suffix = ".armv6" + env.extra_suffix
target_subpath = "arm-linux-androideabi-4.9"
abi_subpath = "arm-linux-androideabi"
arch_subpath = "armeabi"
can_vectorize = False
elif env["android_arch"] == "armv7":
+ env['ARCH'] = 'arch-arm'
target_subpath = "arm-linux-androideabi-4.9"
abi_subpath = "arm-linux-androideabi"
arch_subpath = "armeabi-v7a"
@@ -118,6 +121,12 @@ def configure(env):
env.extra_suffix = ".armv7.neon" + env.extra_suffix
else:
env.extra_suffix = ".armv7" + env.extra_suffix
+ elif env["android_arch"] == "arm64v8":
+ env['ARCH'] = 'arch-arm64'
+ target_subpath = "aarch64-linux-android-4.9"
+ abi_subpath = "aarch64-linux-android"
+ arch_subpath = "arm64-v8a"
+ env.extra_suffix = ".armv8" + env.extra_suffix
## Build type
@@ -149,6 +158,8 @@ def configure(env):
elif (sys.platform.startswith('win')):
if (platform.machine().endswith('64')):
host_subpath = "windows-x86_64"
+ if env["android_arch"] == "arm64v8":
+ mt_link = False
else:
mt_link = False
host_subpath = "windows"
@@ -166,11 +177,6 @@ def configure(env):
env['RANLIB'] = tools_path + "/ranlib"
env['AS'] = tools_path + "/as"
- if env['android_arch'] == 'x86':
- env['ARCH'] = 'arch-x86'
- else:
- env['ARCH'] = 'arch-arm'
-
sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH']
common_opts = ['-fno-integrated-as', '-gcc-toolchain', gcc_toolchain_path]
@@ -199,6 +205,11 @@ def configure(env):
else:
env.Append(CPPFLAGS=['-mfpu=vfpv3-d16'])
+ elif env["android_arch"] == "arm64v8":
+ target_opts = ['-target', 'aarch64-none-linux-android']
+ env.Append(CPPFLAGS=['-D__ARM_ARCH_8A__'])
+ env.Append(CPPFLAGS=['-mfix-cortex-a53-835769'])
+
env.Append(CPPFLAGS=target_opts)
env.Append(CPPFLAGS=common_opts)
@@ -213,7 +224,8 @@ def configure(env):
## Link flags
env['LINKFLAGS'] = ['-shared', '--sysroot=' + sysroot, '-Wl,--warn-shared-textrel']
- env.Append(LINKFLAGS=string.split('-Wl,--fix-cortex-a8'))
+ if env["android_arch"] == "armv7":
+ env.Append(LINKFLAGS=string.split('-Wl,--fix-cortex-a8'))
env.Append(LINKFLAGS=string.split('-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now'))
env.Append(LINKFLAGS=string.split('-Wl,-soname,libgodot_android.so -Wl,--gc-sections'))
if mt_link:
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index a722cd1b8c..3c52834d92 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -219,6 +219,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
bool use_32_fb;
bool immersive;
bool export_arm;
+ bool export_arm64;
bool export_x86;
String apk_expansion_salt;
String apk_expansion_pkey;
@@ -319,6 +320,8 @@ bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant&
_signed=p_value;
else if (n=="architecture/arm")
export_arm=p_value;
+ else if (n=="architecture/arm64")
+ export_arm64=p_value;
else if (n=="architecture/x86")
export_x86=p_value;
else if (n=="screen/use_32_bits_view")
@@ -392,6 +395,8 @@ bool EditorExportPlatformAndroid::_get(const StringName& p_name,Variant &r_ret)
r_ret=_signed;
else if (n=="architecture/arm")
r_ret=export_arm;
+ else if (n=="architecture/arm64")
+ r_ret=export_arm64;
else if (n=="architecture/x86")
r_ret=export_x86;
else if (n=="screen/use_32_bits_view")
@@ -1164,6 +1169,10 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
skip=true;
}
+ if (file.match("lib/arm64*/libgodot_android.so") && !export_arm64) {
+ skip = true;
+ }
+
if (file.begins_with("META-INF") && _signed) {
skip=true;
}
@@ -1801,6 +1810,7 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
immersive=true;
export_arm=true;
+ export_arm64=false;
export_x86=false;
@@ -3176,6 +3186,7 @@ public:
bool export_x86 = p_preset->get("architecture/x86");
bool export_arm = p_preset->get("architecture/arm");
+ bool export_arm64 = p_preset->get("architecture/arm64");
bool use_32_fb = p_preset->get("screen/use_32_bits_view");
bool immersive = p_preset->get("screen/immersive_mode");
@@ -3267,6 +3278,10 @@ public:
skip = true;
}
+ if (file.match("lib/arm64*/libgodot_android.so") && !export_arm64) {
+ skip = true;
+ }
+
if (file.begins_with("META-INF") && _signed) {
skip = true;
}
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index 56a27fa0e0..52ff9cd562 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -190,7 +190,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
argv[i].i = *p_args[i];
} break;
case ARG_TYPE_LONG: {
- argv[i].j = *p_args[i];
+ argv[i].j = (int64_t)*p_args[i];
} break;
case ARG_TYPE_FLOAT: {
argv[i].f = *p_args[i];
@@ -350,7 +350,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
Array arr = *p_args[i];
jlongArray a = env->NewLongArray(arr.size());
for (int j = 0; j < arr.size(); j++) {
- jlong val = arr[j];
+ jlong val = (int64_t)arr[j];
env->SetLongArrayRegion(a, j, 1, &val);
}
argv[i].l = a;
@@ -460,9 +460,9 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
case ARG_TYPE_LONG: {
if (method->_static) {
- ret = env->CallStaticLongMethodA(_class, method->method, argv);
+ ret = (int64_t)env->CallStaticLongMethodA(_class, method->method, argv);
} else {
- ret = env->CallLongMethodA(p_instance->instance, method->method, argv);
+ ret = (int64_t)env->CallLongMethodA(p_instance->instance, method->method, argv);
}
} break;
@@ -680,7 +680,7 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
} break;
case ARG_TYPE_LONG | ARG_NUMBER_CLASS_BIT: {
- var = env->CallLongMethod(obj, JavaClassWrapper::singleton->Long_longValue);
+ var = (int64_t)env->CallLongMethod(obj, JavaClassWrapper::singleton->Long_longValue);
return true;
} break;
@@ -802,7 +802,7 @@ bool JavaClass::_convert_object_to_variant(JNIEnv *env, jobject obj, Variant &va
jlong val;
env->GetLongArrayRegion((jlongArray)arr, 0, 1, &val);
- ret.push_back(val);
+ ret.push_back((int64_t)val);
}
var = ret;
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index fe76b16460..57aa72b7d0 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -55,7 +55,6 @@ void MenuButton::pressed() {
popup->set_size(Size2(size.width, 0));
popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size()));
popup->popup();
- popup->call_deferred("grab_click_focus");
popup->set_invalidate_click_until_motion();
}
@@ -112,6 +111,7 @@ MenuButton::MenuButton() {
popup->hide();
add_child(popup);
popup->set_as_toplevel(true);
+ connect("button_up", popup, "call_deferred", make_binds("grab_click_focus"));
set_process_unhandled_key_input(true);
set_action_mode(ACTION_MODE_BUTTON_PRESS);
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 8baca50d32..d604738da1 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -49,6 +49,10 @@ static bool _is_symbol(CharType c) {
return c != '_' && ((c >= '!' && c <= '/') || (c >= ':' && c <= '@') || (c >= '[' && c <= '`') || (c >= '{' && c <= '~') || c == '\t' || c == ' ');
}
+static bool _is_whitespace(CharType c) {
+ return c == '\t' || c == ' ';
+}
+
static bool _is_char(CharType c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_';
@@ -2096,45 +2100,43 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
break;
#ifdef APPLE_STYLE_KEYS
- if (k->get_alt()) {
+ if (k->get_alt() && cursor.column > 1) {
#else
if (k->get_alt()) {
scancode_handled = false;
break;
- } else if (k->get_command()) {
+ } else if (k->get_command() && cursor.column > 1) {
#endif
int line = cursor.line;
int column = cursor.column;
- bool prev_char = false;
- bool only_whitespace = true;
-
- while (only_whitespace && line > 0) {
-
- while (column > 0) {
- CharType c = text[line][column - 1];
-
- if (c != '\t' && c != ' ') {
- only_whitespace = false;
- break;
- }
+ // check if we are removing a single whitespace, if so remove it and the next char type
+ // else we just remove the whitespace
+ bool only_whitespace = false;
+ if (_is_whitespace(text[line][column - 1]) && _is_whitespace(text[line][column - 2])) {
+ only_whitespace = true;
+ } else if (_is_whitespace(text[line][column - 1])) {
+ // remove the single whitespace
+ column--;
+ }
- column--;
- }
+ // check if its a text char
+ bool only_char = (_is_text_char(text[line][column - 1]) && !only_whitespace);
- if (only_whitespace) {
- line--;
- column = text[line].length();
- }
- }
+ // if its not whitespace or char then symbol.
+ bool only_symbols = !(only_whitespace || only_char);
while (column > 0) {
- bool ischar = _is_text_char(text[line][column - 1]);
+ bool is_whitespace = _is_whitespace(text[line][column - 1]);
+ bool is_text_char = _is_text_char(text[line][column - 1]);
- if (prev_char && !ischar)
+ if (only_whitespace && !is_whitespace) {
break;
-
- prev_char = ischar;
+ } else if (only_char && !is_text_char) {
+ break;
+ } else if (only_symbols && (is_whitespace || is_text_char)) {
+ break;
+ }
column--;
}
@@ -2356,52 +2358,50 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int next_column;
#ifdef APPLE_STYLE_KEYS
- if (k->get_alt()) {
+ if (k->get_alt() && cursor.column < curline_len - 1) {
#else
if (k->get_alt()) {
scancode_handled = false;
break;
- } else if (k->get_command()) {
+ } else if (k->get_command() && cursor.column < curline_len - 1) {
#endif
- int last_line = text.size() - 1;
int line = cursor.line;
int column = cursor.column;
- bool prev_char = false;
- bool only_whitespace = true;
-
- while (only_whitespace && line < last_line) {
-
- while (column < text[line].length()) {
- CharType c = text[line][column];
-
- if (c != '\t' && c != ' ') {
- only_whitespace = false;
- break;
- }
-
- column++;
- }
-
- if (only_whitespace) {
- line++;
- column = 0;
- }
+ // check if we are removing a single whitespace, if so remove it and the next char type
+ // else we just remove the whitespace
+ bool only_whitespace = false;
+ if (_is_whitespace(text[line][column]) && _is_whitespace(text[line][column + 1])) {
+ only_whitespace = true;
+ } else if (_is_whitespace(text[line][column])) {
+ // remove the single whitespace
+ column++;
}
- while (column < text[line].length()) {
+ // check if its a text char
+ bool only_char = (_is_text_char(text[line][column]) && !only_whitespace);
- bool ischar = _is_text_char(text[line][column]);
+ // if its not whitespace or char then symbol.
+ bool only_symbols = !(only_whitespace || only_char);
- if (prev_char && !ischar)
+ while (column < curline_len) {
+ bool is_whitespace = _is_whitespace(text[line][column]);
+ bool is_text_char = _is_text_char(text[line][column]);
+
+ if (only_whitespace && !is_whitespace) {
break;
- prev_char = ischar;
+ } else if (only_char && !is_text_char) {
+ break;
+ } else if (only_symbols && (is_whitespace || is_text_char)) {
+ break;
+ }
column++;
}
next_line = line;
next_column = column;
+
} else {
next_column = cursor.column < curline_len ? (cursor.column + 1) : 0;
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 1456ab51c0..0b57841be7 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1605,7 +1605,6 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
int plus = 1;
while (i + plus < columns.size() && !p_item->cells[i + plus].editable && p_item->cells[i + plus].mode == TreeItem::CELL_MODE_STRING && p_item->cells[i + plus].text == "" && p_item->cells[i + plus].icon.is_null()) {
- plus++;
col_width += cache.hseparation;
col_width += get_column_width(i + plus);
plus++;
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 5303aea6d0..0d2550e53b 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -66,7 +66,8 @@ void AudioDriver::audio_server_process(int p_frames, int32_t *p_buffer, bool p_u
void AudioDriver::update_mix_time(int p_frames) {
_mix_amount += p_frames;
- _last_mix_time = OS::get_singleton()->get_ticks_usec();
+ if (OS::get_singleton())
+ _last_mix_time = OS::get_singleton()->get_ticks_usec();
}
double AudioDriver::get_mix_time() const {
diff --git a/servers/physics/area_sw.h b/servers/physics/area_sw.h
index 06e58e3d5a..3dae1db13f 100644
--- a/servers/physics/area_sw.h
+++ b/servers/physics/area_sw.h
@@ -154,6 +154,7 @@ public:
_FORCE_INLINE_ void add_constraint(ConstraintSW *p_constraint) { constraints.insert(p_constraint); }
_FORCE_INLINE_ void remove_constraint(ConstraintSW *p_constraint) { constraints.erase(p_constraint); }
_FORCE_INLINE_ const Set<ConstraintSW *> &get_constraints() const { return constraints; }
+ _FORCE_INLINE_ void clear_constraints() { constraints.clear(); }
void set_monitorable(bool p_monitorable);
_FORCE_INLINE_ bool is_monitorable() const { return monitorable; }
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp
index 1f32c059a8..e065fae2be 100644
--- a/servers/physics/body_sw.cpp
+++ b/servers/physics/body_sw.cpp
@@ -757,7 +757,8 @@ BodySW::BodySW()
contact_count = 0;
gravity_scale = 1.0;
-
+ linear_damp = -1;
+ angular_damp = -1;
area_angular_damp = 0;
area_linear_damp = 0;
diff --git a/servers/physics/body_sw.h b/servers/physics/body_sw.h
index c3e051c2d0..512b868570 100644
--- a/servers/physics/body_sw.h
+++ b/servers/physics/body_sw.h
@@ -194,6 +194,7 @@ public:
_FORCE_INLINE_ void add_constraint(ConstraintSW *p_constraint, int p_pos) { constraint_map[p_constraint] = p_pos; }
_FORCE_INLINE_ void remove_constraint(ConstraintSW *p_constraint) { constraint_map.erase(p_constraint); }
const Map<ConstraintSW *, int> &get_constraint_map() const { return constraint_map; }
+ _FORCE_INLINE_ void clear_constraint_map() { constraint_map.clear(); }
_FORCE_INLINE_ void set_omit_force_integration(bool p_omit_force_integration) { omit_force_integration = p_omit_force_integration; }
_FORCE_INLINE_ bool get_omit_force_integration() const { return omit_force_integration; }
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index 101bd4b185..833c77216e 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -222,12 +222,24 @@ void PhysicsServerSW::area_set_space(RID p_area, RID p_space) {
AreaSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
+
SpaceSW *space = NULL;
if (p_space.is_valid()) {
space = space_owner.get(p_space);
ERR_FAIL_COND(!space);
}
+ if (area->get_space() == space)
+ return; //pointless
+
+ for (Set<ConstraintSW *>::Element *E = area->get_constraints().front(); E; E = E->next()) {
+ RID self = E->get()->get_self();
+ if (!self.is_valid())
+ continue;
+ free(self);
+ }
+ area->clear_constraints();
+
area->set_space(space);
};
@@ -471,15 +483,23 @@ void PhysicsServerSW::body_set_space(RID p_body, RID p_space) {
BodySW *body = body_owner.get(p_body);
ERR_FAIL_COND(!body);
- SpaceSW *space = NULL;
+ SpaceSW *space = NULL;
if (p_space.is_valid()) {
space = space_owner.get(p_space);
ERR_FAIL_COND(!space);
}
if (body->get_space() == space)
- return; //pointles
+ return; //pointless
+
+ while (body->get_constraint_map().size()) {
+ RID self = body->get_constraint_map().front()->key()->get_self();
+ if (!self.is_valid())
+ continue;
+ free(self);
+ }
+ body->clear_constraint_map();
body->set_space(space);
};
@@ -1329,12 +1349,6 @@ void PhysicsServerSW::free(RID p_rid) {
body->remove_shape(0);
}
- while (body->get_constraint_map().size()) {
- RID self = body->get_constraint_map().front()->key()->get_self();
- ERR_FAIL_COND(!self.is_valid());
- free(self);
- }
-
body_owner.free(p_rid);
memdelete(body);
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index 5679fc8f60..094cfa4656 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -34,12 +34,12 @@
_FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object, uint32_t p_collision_layer, uint32_t p_type_mask) {
- if (p_object->get_type() == CollisionObjectSW::TYPE_AREA)
- return p_type_mask & PhysicsDirectSpaceState::TYPE_MASK_AREA;
-
if ((p_object->get_collision_layer() & p_collision_layer) == 0)
return false;
+ if (p_object->get_type() == CollisionObjectSW::TYPE_AREA)
+ return p_type_mask & PhysicsDirectSpaceState::TYPE_MASK_AREA;
+
BodySW *body = static_cast<BodySW *>(p_object);
return (1 << body->get_mode()) & p_type_mask;
diff --git a/servers/physics_2d/area_2d_sw.h b/servers/physics_2d/area_2d_sw.h
index 68b3c61e44..6d74a4b0f6 100644
--- a/servers/physics_2d/area_2d_sw.h
+++ b/servers/physics_2d/area_2d_sw.h
@@ -153,6 +153,7 @@ public:
_FORCE_INLINE_ void add_constraint(Constraint2DSW *p_constraint) { constraints.insert(p_constraint); }
_FORCE_INLINE_ void remove_constraint(Constraint2DSW *p_constraint) { constraints.erase(p_constraint); }
_FORCE_INLINE_ const Set<Constraint2DSW *> &get_constraints() const { return constraints; }
+ _FORCE_INLINE_ void clear_constraints() { constraints.clear(); }
void set_monitorable(bool p_monitorable);
_FORCE_INLINE_ bool is_monitorable() const { return monitorable; }
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index 9e5deef3f2..412f2f51cd 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -181,6 +181,7 @@ public:
_FORCE_INLINE_ void add_constraint(Constraint2DSW *p_constraint, int p_pos) { constraint_map[p_constraint] = p_pos; }
_FORCE_INLINE_ void remove_constraint(Constraint2DSW *p_constraint) { constraint_map.erase(p_constraint); }
const Map<Constraint2DSW *, int> &get_constraint_map() const { return constraint_map; }
+ _FORCE_INLINE_ void clear_constraint_map() { constraint_map.clear(); }
_FORCE_INLINE_ void set_omit_force_integration(bool p_omit_force_integration) { omit_force_integration = p_omit_force_integration; }
_FORCE_INLINE_ bool get_omit_force_integration() const { return omit_force_integration; }
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
index 5b6c7e2f38..0330bfa9f3 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
@@ -203,9 +203,11 @@ void BroadPhase2DHashGrid::_exit_grid(Element *p_elem, const Rect2 &p_rect, bool
if (sz.width * sz.height > large_object_min_surface) {
//unpair all elements, instead of checking all, just check what is already paired, so we at least save from checking static vs static
- for (Map<Element *, PairData *>::Element *E = p_elem->paired.front(); E; E = E->next()) {
-
+ Map<Element *, PairData *>::Element *E = p_elem->paired.front();
+ while (E) {
+ Map<Element *, PairData *>::Element *next = E->next();
_unpair_attempt(p_elem, E->key());
+ E = next;
}
if (large_elements[p_elem].dec() == 0) {
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index c20d0d14a2..add376bfb2 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -286,12 +286,24 @@ void Physics2DServerSW::area_set_space(RID p_area, RID p_space) {
Area2DSW *area = area_owner.get(p_area);
ERR_FAIL_COND(!area);
+
Space2DSW *space = NULL;
if (p_space.is_valid()) {
space = space_owner.get(p_space);
ERR_FAIL_COND(!space);
}
+ if (area->get_space() == space)
+ return; //pointless
+
+ for (Set<Constraint2DSW *>::Element *E = area->get_constraints().front(); E; E = E->next()) {
+ RID self = E->get()->get_self();
+ if (!self.is_valid())
+ continue;
+ free(self);
+ }
+ area->clear_constraints();
+
area->set_space(space);
};
@@ -533,6 +545,17 @@ void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {
ERR_FAIL_COND(!space);
}
+ if (body->get_space() == space)
+ return; //pointless
+
+ while (body->get_constraint_map().size()) {
+ RID self = body->get_constraint_map().front()->key()->get_self();
+ if (!self.is_valid())
+ continue;
+ free(self);
+ }
+ body->clear_constraint_map();
+
body->set_space(space);
};
@@ -1073,19 +1096,13 @@ void Physics2DServerSW::free(RID p_rid) {
_clear_query(body->get_direct_state_query());
*/
- body->set_space(NULL);
+ body_set_space(p_rid, RID());
while (body->get_shape_count()) {
body->remove_shape(0);
}
- while (body->get_constraint_map().size()) {
- RID self = body->get_constraint_map().front()->key()->get_self();
- ERR_FAIL_COND(!self.is_valid());
- free(self);
- }
-
body_owner.free(p_rid);
memdelete(body);