summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/classes/BackBufferCopy.xml4
-rw-r--r--doc/classes/Object.xml2
-rw-r--r--doc/classes/Tween.xml2
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp136
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h2
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp115
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h34
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp2
-rw-r--r--editor/editor_help.cpp18
-rw-r--r--editor/editor_settings.cpp18
-rw-r--r--editor/export_template_manager.cpp22
-rw-r--r--editor/export_template_manager.h2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp3
-rw-r--r--modules/mono/config.py3
-rw-r--r--modules/mono/glue/cs_files/Array.cs5
-rw-r--r--modules/mono/glue/cs_files/Dictionary.cs5
-rw-r--r--modules/websocket/SCsub165
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp2
-rw-r--r--platform/haiku/audio_driver_media_kit.h3
-rw-r--r--platform/haiku/detect.py81
-rw-r--r--platform/haiku/haiku_application.h3
-rw-r--r--platform/haiku/haiku_direct_window.cpp127
-rw-r--r--platform/haiku/haiku_direct_window.h5
-rw-r--r--platform/haiku/haiku_gl_view.h3
-rw-r--r--platform/haiku/os_haiku.cpp34
-rw-r--r--platform/haiku/os_haiku.h4
-rw-r--r--platform/haiku/platform_config.h1
-rw-r--r--platform/haiku/power_haiku.cpp74
-rw-r--r--platform/haiku/power_haiku.h53
-rw-r--r--scene/3d/physics_body.cpp2
-rw-r--r--thirdparty/glad/glad.c6
-rw-r--r--thirdparty/libwebsockets/lws_config.h2
-rw-r--r--thirdparty/libwebsockets/lws_config_private.h2
-rw-r--r--thirdparty/thekla_atlas/nvcore/nvcore.h5
-rw-r--r--thirdparty/thekla_atlas/poshlib/posh.h5
35 files changed, 601 insertions, 349 deletions
diff --git a/doc/classes/BackBufferCopy.xml b/doc/classes/BackBufferCopy.xml
index 7070fdec4c..62c97feaf9 100644
--- a/doc/classes/BackBufferCopy.xml
+++ b/doc/classes/BackBufferCopy.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="BackBufferCopy" inherits="Node2D" category="Core" version="3.1">
<brief_description>
- Copies a region of the screen (or the whole screen) to a buffer so it can be accessed with the texscreen() shader instruction.
+ Copies a region of the screen (or the whole screen) to a buffer so it can be accessed with [code]SCREEN_TEXTURE[/code] in the [code]texture()[/code] function.
</brief_description>
<description>
- Node for back-buffering the currently displayed screen. The region defined in the BackBufferCopy node is bufferized with the content of the screen it covers, or the entire screen according to the copy mode set. Accessing this buffer is done with the texscreen() shader instruction.
+ Node for back-buffering the currently displayed screen. The region defined in the BackBufferCopy node is bufferized with the content of the screen it covers, or the entire screen according to the copy mode set. Use [code]SCREEN_TEXTURE[/code] in the [code]texture()[/code] function to access the buffer.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index ab49bc468c..a830468042 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -184,6 +184,8 @@
<argument index="0" name="property" type="NodePath">
</argument>
<description>
+ Get indexed object property by String.
+ Property indices get accessed with colon seperation, for example: [code]position:x[/code]
</description>
</method>
<method name="get_instance_id" qualifiers="const">
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index 2332c1a7aa..123226183a 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -170,7 +170,7 @@
<argument index="7" name="delay" type="float" default="0">
</argument>
<description>
- Animates [code]property[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later.
+ Animates [code]property[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Setting the initial value to [code]null[/code] uses the current value of the property.
Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 5f31bfe209..b460a2559b 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -812,6 +812,14 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
}
} break;
+ case VS::INSTANCE_IMMEDIATE: {
+ RasterizerStorageGLES2::Immediate *im = storage->immediate_owner.getptr(instance->base);
+ ERR_CONTINUE(!im);
+
+ _add_geometry(im, instance, NULL, -1, p_depth_pass, p_shadow_pass);
+
+ } break;
+
default: {
} break;
@@ -931,6 +939,13 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
state.scene_shader.set_conditional(SceneShaderGLES2::ENABLE_UV2_INTERP, s->attribs[VS::ARRAY_TEX_UV2].enabled);
} break;
+ case VS::INSTANCE_IMMEDIATE: {
+ state.scene_shader.set_conditional(SceneShaderGLES2::USE_INSTANCING, false);
+ state.scene_shader.set_conditional(SceneShaderGLES2::ENABLE_COLOR_INTERP, true);
+ state.scene_shader.set_conditional(SceneShaderGLES2::ENABLE_UV_INTERP, true);
+ state.scene_shader.set_conditional(SceneShaderGLES2::ENABLE_UV2_INTERP, true);
+ } break;
+
default: {
} break;
@@ -1264,6 +1279,118 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
glBindBuffer(GL_ARRAY_BUFFER, 0);
} break;
+
+ case VS::INSTANCE_IMMEDIATE: {
+ const RasterizerStorageGLES2::Immediate *im = static_cast<const RasterizerStorageGLES2::Immediate *>(p_element->geometry);
+
+ if (im->building) {
+ return;
+ }
+
+ bool restore_tex = false;
+
+ glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer);
+
+ for (const List<RasterizerStorageGLES2::Immediate::Chunk>::Element *E = im->chunks.front(); E; E = E->next()) {
+ const RasterizerStorageGLES2::Immediate::Chunk &c = E->get();
+
+ if (c.vertices.empty()) {
+ continue;
+ }
+
+ int vertices = c.vertices.size();
+
+ uint32_t buf_ofs = 0;
+
+ storage->info.render.vertices_count += vertices;
+
+ if (c.texture.is_valid() && storage->texture_owner.owns(c.texture)) {
+ RasterizerStorageGLES2::Texture *t = storage->texture_owner.get(c.texture);
+
+ t = t->get_ptr();
+
+ if (t->redraw_if_visible) {
+ VisualServerRaster::redraw_request();
+ }
+
+#ifdef TOOLS_ENABLED
+ if (t->detect_3d) {
+ t->detect_3d(t->detect_3d_ud);
+ }
+#endif
+ if (t->render_target) {
+ t->render_target->used_in_frame = true;
+ }
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(t->target, t->tex_id);
+ restore_tex = true;
+ } else if (restore_tex) {
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, state.current_main_tex);
+ restore_tex = false;
+ }
+
+ if (!c.normals.empty()) {
+ glEnableVertexAttribArray(VS::ARRAY_NORMAL);
+ glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.normals.ptr());
+ glVertexAttribPointer(VS::ARRAY_NORMAL, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), ((uint8_t *)NULL) + buf_ofs);
+ buf_ofs += sizeof(Vector3) * vertices;
+ } else {
+ glDisableVertexAttribArray(VS::ARRAY_NORMAL);
+ }
+
+ if (!c.tangents.empty()) {
+ glEnableVertexAttribArray(VS::ARRAY_TANGENT);
+ glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Plane) * vertices, c.tangents.ptr());
+ glVertexAttribPointer(VS::ARRAY_TANGENT, 4, GL_FLOAT, GL_FALSE, sizeof(Plane), ((uint8_t *)NULL) + buf_ofs);
+ buf_ofs += sizeof(Plane) * vertices;
+ } else {
+ glDisableVertexAttribArray(VS::ARRAY_TANGENT);
+ }
+
+ if (!c.colors.empty()) {
+ glEnableVertexAttribArray(VS::ARRAY_COLOR);
+ glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Color) * vertices, c.colors.ptr());
+ glVertexAttribPointer(VS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(Color), ((uint8_t *)NULL) + buf_ofs);
+ buf_ofs += sizeof(Color) * vertices;
+ } else {
+ glDisableVertexAttribArray(VS::ARRAY_COLOR);
+ }
+
+ if (!c.uvs.empty()) {
+ glEnableVertexAttribArray(VS::ARRAY_TEX_UV);
+ glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uvs.ptr());
+ glVertexAttribPointer(VS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), ((uint8_t *)NULL) + buf_ofs);
+ buf_ofs += sizeof(Vector2) * vertices;
+ } else {
+ glDisableVertexAttribArray(VS::ARRAY_TEX_UV);
+ }
+
+ if (!c.uv2s.empty()) {
+ glEnableVertexAttribArray(VS::ARRAY_TEX_UV2);
+ glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector2) * vertices, c.uv2s.ptr());
+ glVertexAttribPointer(VS::ARRAY_TEX_UV2, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), ((uint8_t *)NULL) + buf_ofs);
+ buf_ofs += sizeof(Vector2) * vertices;
+ } else {
+ glDisableVertexAttribArray(VS::ARRAY_TEX_UV2);
+ }
+
+ glEnableVertexAttribArray(VS::ARRAY_VERTEX);
+ glBufferSubData(GL_ARRAY_BUFFER, buf_ofs, sizeof(Vector3) * vertices, c.vertices.ptr());
+ glVertexAttribPointer(VS::ARRAY_VERTEX, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), ((uint8_t *)NULL) + buf_ofs);
+
+ glDrawArrays(gl_primitive[c.primitive], 0, c.vertices.size());
+ }
+
+ if (restore_tex) {
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, state.current_main_tex);
+ restore_tex = false;
+ }
+
+ } break;
}
}
@@ -2247,6 +2374,15 @@ void RasterizerSceneGLES2::initialize() {
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
+ {
+ uint32_t immediate_buffer_size = GLOBAL_DEF("rendering/limits/buffers/immediate_buffer_size_kb", 2048);
+
+ glGenBuffers(1, &state.immediate_buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer);
+ glBufferData(GL_ARRAY_BUFFER, immediate_buffer_size * 1024, NULL, GL_DYNAMIC_DRAW);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ }
+
// cubemaps for shadows
{
int max_shadow_cubemap_sampler_size = 512;
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
index f47d1f1d4e..e153080e15 100644
--- a/drivers/gles2/rasterizer_scene_gles2.h
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -74,6 +74,8 @@ public:
GLuint sky_verts;
+ GLuint immediate_buffer;
+
// ResolveShaderGLES3 resolve_shader;
// ScreenSpaceReflectionShaderGLES3 ssr_shader;
// EffectBlurShaderGLES3 effect_blur_shader;
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 8c4325ccde..1bd3c0a935 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -2679,45 +2679,132 @@ void RasterizerStorageGLES2::update_dirty_multimeshes() {
/* IMMEDIATE API */
RID RasterizerStorageGLES2::immediate_create() {
- return RID();
+ Immediate *im = memnew(Immediate);
+ return immediate_owner.make_rid(im);
}
-void RasterizerStorageGLES2::immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture) {
+void RasterizerStorageGLES2::immediate_begin(RID p_immediate, VS::PrimitiveType p_primitive, RID p_texture) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(im->building);
+
+ Immediate::Chunk ic;
+ ic.texture = p_texture;
+ ic.primitive = p_primitive;
+ im->chunks.push_back(ic);
+ im->mask = 0;
+ im->building = true;
}
void RasterizerStorageGLES2::immediate_vertex(RID p_immediate, const Vector3 &p_vertex) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(!im->building);
+
+ Immediate::Chunk *c = &im->chunks.back()->get();
+
+ if (c->vertices.empty() && im->chunks.size() == 1) {
+ im->aabb.position = p_vertex;
+ im->aabb.size = Vector3();
+ } else {
+ im->aabb.expand_to(p_vertex);
+ }
+
+ if (im->mask & VS::ARRAY_FORMAT_NORMAL)
+ c->normals.push_back(chunk_normal);
+ if (im->mask & VS::ARRAY_FORMAT_TANGENT)
+ c->tangents.push_back(chunk_tangent);
+ if (im->mask & VS::ARRAY_FORMAT_COLOR)
+ c->colors.push_back(chunk_color);
+ if (im->mask & VS::ARRAY_FORMAT_TEX_UV)
+ c->uvs.push_back(chunk_uv);
+ if (im->mask & VS::ARRAY_FORMAT_TEX_UV2)
+ c->uv2s.push_back(chunk_uv2);
+ im->mask |= VS::ARRAY_FORMAT_VERTEX;
+ c->vertices.push_back(p_vertex);
}
void RasterizerStorageGLES2::immediate_normal(RID p_immediate, const Vector3 &p_normal) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(!im->building);
+
+ im->mask |= VS::ARRAY_FORMAT_NORMAL;
+ chunk_normal = p_normal;
}
void RasterizerStorageGLES2::immediate_tangent(RID p_immediate, const Plane &p_tangent) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(!im->building);
+
+ im->mask |= VS::ARRAY_FORMAT_TANGENT;
+ chunk_tangent = p_tangent;
}
void RasterizerStorageGLES2::immediate_color(RID p_immediate, const Color &p_color) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(!im->building);
+
+ im->mask |= VS::ARRAY_FORMAT_COLOR;
+ chunk_color = p_color;
}
void RasterizerStorageGLES2::immediate_uv(RID p_immediate, const Vector2 &tex_uv) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(!im->building);
+
+ im->mask |= VS::ARRAY_FORMAT_TEX_UV;
+ chunk_uv = tex_uv;
}
void RasterizerStorageGLES2::immediate_uv2(RID p_immediate, const Vector2 &tex_uv) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(!im->building);
+
+ im->mask |= VS::ARRAY_FORMAT_TEX_UV2;
+ chunk_uv2 = tex_uv;
}
void RasterizerStorageGLES2::immediate_end(RID p_immediate) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(!im->building);
+
+ im->building = false;
+ im->instance_change_notify();
}
void RasterizerStorageGLES2::immediate_clear(RID p_immediate) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+ ERR_FAIL_COND(im->building);
+
+ im->chunks.clear();
+ im->instance_change_notify();
}
AABB RasterizerStorageGLES2::immediate_get_aabb(RID p_immediate) const {
- return AABB();
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND_V(!im, AABB());
+ return im->aabb;
}
void RasterizerStorageGLES2::immediate_set_material(RID p_immediate, RID p_material) {
+ Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND(!im);
+
+ im->material = p_material;
+ im->instance_material_change_notify();
}
RID RasterizerStorageGLES2::immediate_get_material(RID p_immediate) const {
- return RID();
+ const Immediate *im = immediate_owner.get(p_immediate);
+ ERR_FAIL_COND_V(!im, RID());
+ return im->material;
}
/* SKELETON API */
@@ -3729,15 +3816,15 @@ VS::InstanceType RasterizerStorageGLES2::get_base_type(RID p_rid) const {
if (mesh_owner.owns(p_rid)) {
return VS::INSTANCE_MESH;
- }
- if (light_owner.owns(p_rid)) {
+ } else if (light_owner.owns(p_rid)) {
return VS::INSTANCE_LIGHT;
- }
- if (multimesh_owner.owns(p_rid)) {
+ } else if (multimesh_owner.owns(p_rid)) {
return VS::INSTANCE_MULTIMESH;
+ } else if (immediate_owner.owns(p_rid)) {
+ return VS::INSTANCE_IMMEDIATE;
+ } else {
+ return VS::INSTANCE_NONE;
}
-
- return VS::INSTANCE_NONE;
}
bool RasterizerStorageGLES2::free(RID p_rid) {
@@ -3895,6 +3982,14 @@ bool RasterizerStorageGLES2::free(RID p_rid) {
memdelete(multimesh);
return true;
+ } else if (immediate_owner.owns(p_rid)) {
+ Immediate *im = immediate_owner.get(p_rid);
+ im->instance_remove_deps();
+
+ immediate_owner.free(p_rid);
+ memdelete(im);
+
+ return true;
} else if (light_owner.owns(p_rid)) {
Light *light = light_owner.get(p_rid);
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index 8bc3369dbb..c1fbf73254 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -797,8 +797,40 @@ public:
/* IMMEDIATE API */
+ struct Immediate : public Geometry {
+
+ struct Chunk {
+ RID texture;
+ VS::PrimitiveType primitive;
+ Vector<Vector3> vertices;
+ Vector<Vector3> normals;
+ Vector<Plane> tangents;
+ Vector<Color> colors;
+ Vector<Vector2> uvs;
+ Vector<Vector2> uv2s;
+ };
+
+ List<Chunk> chunks;
+ bool building;
+ int mask;
+ AABB aabb;
+
+ Immediate() {
+ type = GEOMETRY_IMMEDIATE;
+ building = false;
+ }
+ };
+
+ Vector3 chunk_normal;
+ Plane chunk_tangent;
+ Color chunk_color;
+ Vector2 chunk_uv;
+ Vector2 chunk_uv2;
+
+ mutable RID_Owner<Immediate> immediate_owner;
+
virtual RID immediate_create();
- virtual void immediate_begin(RID p_immediate, VS::PrimitiveType p_rimitive, RID p_texture = RID());
+ virtual void immediate_begin(RID p_immediate, VS::PrimitiveType p_primitive, RID p_texture = RID());
virtual void immediate_vertex(RID p_immediate, const Vector3 &p_vertex);
virtual void immediate_normal(RID p_immediate, const Vector3 &p_normal);
virtual void immediate_tangent(RID p_immediate, const Plane &p_tangent);
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index a2f619a6ef..2dcb4ff3d8 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -32,8 +32,6 @@
#include "audio_driver_wasapi.h"
-#include <Functiondiscoverykeys_devpkey.h>
-
#include "os/os.h"
#include "project_settings.h"
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 1ac6eef8b4..60826aa81b 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -718,16 +718,22 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (p_class == edited_class)
return OK; //already there
+ edited_class = p_class;
+ _update_doc();
+ return OK;
+}
+
+void EditorHelp::_update_doc() {
+
scroll_locked = true;
class_desc->clear();
method_line.clear();
section_line.clear();
- edited_class = p_class;
_init_colors();
- DocData::ClassDoc cd = doc->class_list[p_class]; //make a copy, so we can sort without worrying
+ DocData::ClassDoc cd = doc->class_list[edited_class]; //make a copy, so we can sort without worrying
Ref<Font> doc_font = get_font("doc", "EditorFonts");
Ref<Font> doc_title_font = get_font("doc_title", "EditorFonts");
@@ -739,7 +745,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_color(title_color);
class_desc->add_text(TTR("Class:") + " ");
class_desc->push_color(headline_color);
- _add_text(p_class);
+ _add_text(edited_class);
class_desc->pop();
class_desc->pop();
class_desc->pop();
@@ -1458,8 +1464,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
}
scroll_locked = false;
-
- return OK;
}
void EditorHelp::_request_help(const String &p_string) {
@@ -1756,9 +1760,6 @@ void EditorHelp::_add_text(const String &p_bbcode) {
_add_text_to_rt(p_bbcode, class_desc);
}
-void EditorHelp::_update_doc() {
-}
-
void EditorHelp::generate_doc() {
doc = memnew(DocData);
@@ -1781,6 +1782,7 @@ void EditorHelp::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
class_desc->add_color_override("selection_color", get_color("text_editor/theme/selection_color", "Editor"));
+ _update_doc();
} break;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index a14ced1340..8e079b1f67 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -755,7 +755,7 @@ void EditorSettings::create() {
}
if (dir->change_dir(data_dir) != OK) {
- dir->make_dir(data_dir);
+ dir->make_dir_recursive(data_dir);
if (dir->change_dir(data_dir) != OK) {
ERR_PRINT("Cannot create data directory!");
memdelete(dir);
@@ -771,14 +771,8 @@ void EditorSettings::create() {
// Validate/create cache dir
- if (dir->change_dir(cache_path) != OK) {
- ERR_PRINT("Cannot find path for cache directory!");
- memdelete(dir);
- goto fail;
- }
-
if (dir->change_dir(cache_dir) != OK) {
- dir->make_dir(cache_dir);
+ dir->make_dir_recursive(cache_dir);
if (dir->change_dir(cache_dir) != OK) {
ERR_PRINT("Cannot create cache directory!");
memdelete(dir);
@@ -788,14 +782,8 @@ void EditorSettings::create() {
// Validate/create config dir and subdirectories
- if (dir->change_dir(config_path) != OK) {
- ERR_PRINT("Cannot find path for config directory!");
- memdelete(dir);
- goto fail;
- }
-
if (dir->change_dir(config_dir) != OK) {
- dir->make_dir(config_dir);
+ dir->make_dir_recursive(config_dir);
if (dir->change_dir(config_dir) != OK) {
ERR_PRINT("Cannot create config directory!");
memdelete(dir);
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 931785333f..6c9d1568fa 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -178,7 +178,7 @@ void ExportTemplateManager::_uninstall_template_confirm() {
_update_template_list();
}
-void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_progress) {
+bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_progress) {
FileAccess *fa = NULL;
zlib_filefunc_def io = zipio_create_io_from_file(&fa);
@@ -187,7 +187,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
if (!pkg) {
EditorNode::get_singleton()->show_warning(TTR("Can't open export templates zip."));
- return;
+ return false;
}
int ret = unzGoToFirstFile(pkg);
@@ -221,7 +221,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
if (data_str.get_slice_count(".") < 3) {
EditorNode::get_singleton()->show_warning(vformat(TTR("Invalid version.txt format inside templates: %s."), data_str));
unzClose(pkg);
- return;
+ return false;
}
version = data_str;
@@ -237,7 +237,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
if (version == String()) {
EditorNode::get_singleton()->show_warning(TTR("No version.txt found inside templates."));
unzClose(pkg);
- return;
+ return false;
}
String template_path = EditorSettings::get_singleton()->get_templates_dir().plus_file(version);
@@ -247,7 +247,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
if (err != OK) {
EditorNode::get_singleton()->show_warning(TTR("Error creating path for templates:") + "\n" + template_path);
unzClose(pkg);
- return;
+ return false;
}
memdelete(d);
@@ -310,6 +310,8 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
unzClose(pkg);
_update_template_list();
+
+ return true;
}
void ExportTemplateManager::popup_manager() {
@@ -401,7 +403,15 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
String path = download_templates->get_download_file();
template_list_state->set_text(TTR("Download Complete."));
template_downloader->hide();
- _install_from_file(path, false);
+ int ret = _install_from_file(path, false);
+ if (ret) {
+ Error err = OS::get_singleton()->move_to_trash(path);
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + path + "\n");
+ }
+ } else {
+ WARN_PRINTS(vformat(TTR("Templates installation failed. The problematic templates archives can be found at '%s'."), path));
+ }
}
} break;
}
diff --git a/editor/export_template_manager.h b/editor/export_template_manager.h
index 54a645c69f..bd43fe5dc5 100644
--- a/editor/export_template_manager.h
+++ b/editor/export_template_manager.h
@@ -70,7 +70,7 @@ class ExportTemplateManager : public ConfirmationDialog {
void _uninstall_template_confirm();
virtual void ok_pressed();
- void _install_from_file(const String &p_file, bool p_use_progress = true);
+ bool _install_from_file(const String &p_file, bool p_use_progress = true);
void _http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data);
void _http_download_templates_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data);
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 9218fed907..63e89b78ea 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -119,6 +119,9 @@ void VisualShaderEditor::_update_graph() {
if (updating)
return;
+ if (visual_shader.is_null())
+ return;
+
graph->set_scroll_ofs(visual_shader->get_graph_offset() * EDSCALE);
VisualShader::Type type = VisualShader::Type(edit_type->get_selected());
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 7f226443a1..c4f8dcfde8 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -83,7 +83,8 @@ def configure(env):
mono_lib_names = ['mono-2.0-sgen', 'monosgen-2.0']
if env['platform'] == 'windows':
- mono_root = None
+ mono_root = ''
+
if bits == '32':
if os.getenv('MONO32_PREFIX'):
mono_root = os.getenv('MONO32_PREFIX')
diff --git a/modules/mono/glue/cs_files/Array.cs b/modules/mono/glue/cs_files/Array.cs
index 51f57daef4..1ec4d7d20a 100644
--- a/modules/mono/glue/cs_files/Array.cs
+++ b/modules/mono/glue/cs_files/Array.cs
@@ -331,5 +331,10 @@ namespace Godot
{
return GetEnumerator();
}
+
+ internal IntPtr GetPtr()
+ {
+ return objectArray.GetPtr();
+ }
}
}
diff --git a/modules/mono/glue/cs_files/Dictionary.cs b/modules/mono/glue/cs_files/Dictionary.cs
index 57a1960ad9..30d17c2a59 100644
--- a/modules/mono/glue/cs_files/Dictionary.cs
+++ b/modules/mono/glue/cs_files/Dictionary.cs
@@ -397,5 +397,10 @@ namespace Godot
{
return GetEnumerator();
}
+
+ internal IntPtr GetPtr()
+ {
+ return objectDict.GetPtr();
+ }
}
}
diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub
index 15a88773e7..c0985b3245 100644
--- a/modules/websocket/SCsub
+++ b/modules/websocket/SCsub
@@ -7,87 +7,88 @@ Import('env_modules')
env_lws = env_modules.Clone()
-thirdparty_dir = "#thirdparty/libwebsockets/"
-helper_dir = "win32helpers/"
-thirdparty_sources = [
-
- "core/alloc.c",
- "core/context.c",
- "core/libwebsockets.c",
- "core/output.c",
- "core/pollfd.c",
- "core/service.c",
-
- "event-libs/poll/poll.c",
-
- "misc/base64-decode.c",
- "misc/lejp.c",
- "misc/sha-1.c",
-
- "roles/h1/ops-h1.c",
- "roles/http/header.c",
- "roles/http/client/client.c",
- "roles/http/client/client-handshake.c",
- "roles/http/server/fops-zip.c",
- "roles/http/server/lejp-conf.c",
- "roles/http/server/parsers.c",
- "roles/http/server/server.c",
- "roles/listen/ops-listen.c",
- "roles/pipe/ops-pipe.c",
- "roles/raw/ops-raw.c",
-
- "roles/ws/client-ws.c",
- "roles/ws/client-parser-ws.c",
- "roles/ws/ops-ws.c",
- "roles/ws/server-ws.c",
-
- "tls/tls.c",
- "tls/tls-client.c",
- "tls/tls-server.c",
-
- "tls/mbedtls/wrapper/library/ssl_cert.c",
- "tls/mbedtls/wrapper/library/ssl_pkey.c",
- "tls/mbedtls/wrapper/library/ssl_stack.c",
- "tls/mbedtls/wrapper/library/ssl_methods.c",
- "tls/mbedtls/wrapper/library/ssl_lib.c",
- "tls/mbedtls/wrapper/library/ssl_x509.c",
- "tls/mbedtls/wrapper/platform/ssl_port.c",
- "tls/mbedtls/wrapper/platform/ssl_pm.c",
- "tls/mbedtls/lws-genhash.c",
- "tls/mbedtls/mbedtls-client.c",
- "tls/mbedtls/lws-genrsa.c",
- "tls/mbedtls/ssl.c",
- "tls/mbedtls/mbedtls-server.c"
-]
-
-if env_lws["platform"] == "android": # Builtin getifaddrs
- thirdparty_sources += ["misc/getifaddrs.c"]
-
-if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp": # Winsock
- thirdparty_sources += ["plat/lws-plat-win.c", helper_dir + "getopt.c", helper_dir + "getopt_long.c", helper_dir + "gettimeofday.c"]
-else: # Unix socket
- thirdparty_sources += ["plat/lws-plat-unix.c"]
-
-
-thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-
-if env_lws["platform"] == "javascript": # No need to add third party libraries at all
- pass
-else:
- env_lws.add_source_files(env.modules_sources, thirdparty_sources)
- env_lws.Append(CPPPATH=[thirdparty_dir])
-
- wrapper_includes = ["#thirdparty/libwebsockets/tls/mbedtls/wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
- env_lws.Prepend(CPPPATH=wrapper_includes)
-
- if env['builtin_mbedtls']:
- mbedtls_includes = "#thirdparty/mbedtls/include"
- env_lws.Prepend(CPPPATH=[mbedtls_includes])
-
- if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp":
- env_lws.Append(CPPPATH=[thirdparty_dir + helper_dir])
-
- if env_lws["platform"] == "uwp":
- env_lws.Append(CCFLAGS=["/DLWS_MINGW_SUPPORT"])
+if env['builtin_libwebsockets']:
+ thirdparty_dir = "#thirdparty/libwebsockets/"
+ helper_dir = "win32helpers/"
+ thirdparty_sources = [
+
+ "core/alloc.c",
+ "core/context.c",
+ "core/libwebsockets.c",
+ "core/output.c",
+ "core/pollfd.c",
+ "core/service.c",
+
+ "event-libs/poll/poll.c",
+
+ "misc/base64-decode.c",
+ "misc/lejp.c",
+ "misc/sha-1.c",
+
+ "roles/h1/ops-h1.c",
+ "roles/http/header.c",
+ "roles/http/client/client.c",
+ "roles/http/client/client-handshake.c",
+ "roles/http/server/fops-zip.c",
+ "roles/http/server/lejp-conf.c",
+ "roles/http/server/parsers.c",
+ "roles/http/server/server.c",
+ "roles/listen/ops-listen.c",
+ "roles/pipe/ops-pipe.c",
+ "roles/raw/ops-raw.c",
+
+ "roles/ws/client-ws.c",
+ "roles/ws/client-parser-ws.c",
+ "roles/ws/ops-ws.c",
+ "roles/ws/server-ws.c",
+
+ "tls/tls.c",
+ "tls/tls-client.c",
+ "tls/tls-server.c",
+
+ "tls/mbedtls/wrapper/library/ssl_cert.c",
+ "tls/mbedtls/wrapper/library/ssl_pkey.c",
+ "tls/mbedtls/wrapper/library/ssl_stack.c",
+ "tls/mbedtls/wrapper/library/ssl_methods.c",
+ "tls/mbedtls/wrapper/library/ssl_lib.c",
+ "tls/mbedtls/wrapper/library/ssl_x509.c",
+ "tls/mbedtls/wrapper/platform/ssl_port.c",
+ "tls/mbedtls/wrapper/platform/ssl_pm.c",
+ "tls/mbedtls/lws-genhash.c",
+ "tls/mbedtls/mbedtls-client.c",
+ "tls/mbedtls/lws-genrsa.c",
+ "tls/mbedtls/ssl.c",
+ "tls/mbedtls/mbedtls-server.c"
+ ]
+
+ if env_lws["platform"] == "android": # Builtin getifaddrs
+ thirdparty_sources += ["misc/getifaddrs.c"]
+
+ if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp": # Winsock
+ thirdparty_sources += ["plat/lws-plat-win.c", helper_dir + "getopt.c", helper_dir + "getopt_long.c", helper_dir + "gettimeofday.c"]
+ else: # Unix socket
+ thirdparty_sources += ["plat/lws-plat-unix.c"]
+
+
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ if env_lws["platform"] == "javascript": # No need to add third party libraries at all
+ pass
+ else:
+ env_lws.add_source_files(env.modules_sources, thirdparty_sources)
+ env_lws.Append(CPPPATH=[thirdparty_dir])
+
+ wrapper_includes = ["#thirdparty/libwebsockets/tls/mbedtls/wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
+ env_lws.Prepend(CPPPATH=wrapper_includes)
+
+ if env['builtin_mbedtls']:
+ mbedtls_includes = "#thirdparty/mbedtls/include"
+ env_lws.Prepend(CPPPATH=[mbedtls_includes])
+
+ if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp":
+ env_lws.Append(CPPPATH=[thirdparty_dir + helper_dir])
+
+ if env_lws["platform"] == "uwp":
+ env_lws.Append(CCFLAGS=["/DLWS_MINGW_SUPPORT"])
env_lws.add_source_files(env.modules_sources, "*.cpp")
diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp
index 1f901c4919..aeaf698015 100644
--- a/platform/haiku/audio_driver_media_kit.cpp
+++ b/platform/haiku/audio_driver_media_kit.cpp
@@ -100,7 +100,7 @@ int AudioDriverMediaKit::get_mix_rate() const {
return mix_rate;
}
-AudioDriverSW::SpeakerMode AudioDriverMediaKit::get_speaker_mode() const {
+AudioDriverMediaKit::SpeakerMode AudioDriverMediaKit::get_speaker_mode() const {
return speaker_mode;
}
diff --git a/platform/haiku/audio_driver_media_kit.h b/platform/haiku/audio_driver_media_kit.h
index a09403e7d6..02fefcf52a 100644
--- a/platform/haiku/audio_driver_media_kit.h
+++ b/platform/haiku/audio_driver_media_kit.h
@@ -35,9 +35,10 @@
#include "core/os/mutex.h"
#include "core/os/thread.h"
-#include <SoundPlayer.h>
#include <kernel/image.h> // needed for image_id
+#include <SoundPlayer.h>
+
class AudioDriverMediaKit : public AudioDriver {
Mutex *mutex;
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index 2959023204..7ecdd2bb11 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -64,6 +64,87 @@ def configure(env):
env["CC"] = "gcc-x86"
env["CXX"] = "g++-x86"
+ ## Dependencies
+
+ if not env['builtin_libwebp']:
+ env.ParseConfig('pkg-config libwebp --cflags --libs')
+
+ # freetype depends on libpng and zlib, so bundling one of them while keeping others
+ # as shared libraries leads to weird issues
+ if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
+ env['builtin_freetype'] = True
+ env['builtin_libpng'] = True
+ env['builtin_zlib'] = True
+
+ if not env['builtin_freetype']:
+ env.ParseConfig('pkg-config freetype2 --cflags --libs')
+
+ if not env['builtin_libpng']:
+ env.ParseConfig('pkg-config libpng --cflags --libs')
+
+ if not env['builtin_bullet']:
+ # We need at least version 2.88
+ import subprocess
+ bullet_version = subprocess.check_output(['pkg-config', 'bullet', '--modversion']).strip()
+ if bullet_version < "2.88":
+ # Abort as system bullet was requested but too old
+ print("Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(bullet_version, "2.88"))
+ sys.exit(255)
+ env.ParseConfig('pkg-config bullet --cflags --libs')
+
+ if not env['builtin_enet']:
+ env.ParseConfig('pkg-config libenet --cflags --libs')
+
+ if not env['builtin_squish'] and env['tools']:
+ env.ParseConfig('pkg-config libsquish --cflags --libs')
+
+ if not env['builtin_zstd']:
+ env.ParseConfig('pkg-config libzstd --cflags --libs')
+
+ # Sound and video libraries
+ # Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
+
+ if not env['builtin_libtheora']:
+ env['builtin_libogg'] = False # Needed to link against system libtheora
+ env['builtin_libvorbis'] = False # Needed to link against system libtheora
+ env.ParseConfig('pkg-config theora theoradec --cflags --libs')
+
+ if not env['builtin_libvpx']:
+ env.ParseConfig('pkg-config vpx --cflags --libs')
+
+ if not env['builtin_libvorbis']:
+ env['builtin_libogg'] = False # Needed to link against system libvorbis
+ env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
+
+ if not env['builtin_opus']:
+ env['builtin_libogg'] = False # Needed to link against system opus
+ env.ParseConfig('pkg-config opus opusfile --cflags --libs')
+
+ if not env['builtin_libogg']:
+ env.ParseConfig('pkg-config ogg --cflags --libs')
+
+ if env['builtin_libtheora']:
+ list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
+ if any(platform.machine() in s for s in list_of_x86):
+ env["x86_libtheora_opt_gcc"] = True
+
+ if not env['builtin_libwebsockets']:
+ env.ParseConfig('pkg-config libwebsockets --cflags --libs')
+
+ if not env['builtin_mbedtls']:
+ # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228
+ env.Append(LIBS=['mbedtls', 'mbedcrypto', 'mbedx509'])
+
+ if not env['builtin_miniupnpc']:
+ # No pkgconfig file so far, hardcode default paths.
+ env.Append(CPPPATH=["/system/develop/headers/x86/miniupnpc"])
+ env.Append(LIBS=["miniupnpc"])
+
+ # On Linux wchar_t should be 32-bits
+ # 16-bit library shouldn't be required due to compiler optimisations
+ if not env['builtin_pcre2']:
+ env.ParseConfig('pkg-config libpcre2-32 --cflags --libs')
+
## Flags
env.Append(CPPPATH=['#platform/haiku'])
diff --git a/platform/haiku/haiku_application.h b/platform/haiku/haiku_application.h
index f92969bbb1..a870037985 100644
--- a/platform/haiku/haiku_application.h
+++ b/platform/haiku/haiku_application.h
@@ -31,9 +31,10 @@
#ifndef HAIKU_APPLICATION_H
#define HAIKU_APPLICATION_H
-#include <Application.h>
#include <kernel/image.h> // needed for image_id
+#include <Application.h>
+
class HaikuApplication : public BApplication {
public:
HaikuApplication();
diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp
index b234a2ff91..7eeb226167 100644
--- a/platform/haiku/haiku_direct_window.cpp
+++ b/platform/haiku/haiku_direct_window.cpp
@@ -41,10 +41,14 @@ HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) :
last_buttons_state = 0;
last_button_mask = 0;
last_key_modifier_state = 0;
+
+ view = NULL;
+ update_runner = NULL;
+ input = NULL;
+ main_loop = NULL;
}
HaikuDirectWindow::~HaikuDirectWindow() {
- delete update_runner;
}
void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) {
@@ -53,7 +57,7 @@ void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) {
void HaikuDirectWindow::StartMessageRunner() {
update_runner = new BMessageRunner(BMessenger(this),
- new BMessage(REDRAW_MSG), 1000000 / 30 /* 30 fps */);
+ new BMessage(REDRAW_MSG), 1000000 / 60 /* 60 fps */);
}
void HaikuDirectWindow::StopMessageRunner() {
@@ -69,6 +73,7 @@ void HaikuDirectWindow::SetMainLoop(MainLoop *p_main_loop) {
}
bool HaikuDirectWindow::QuitRequested() {
+ StopMessageRunner();
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
return false;
}
@@ -152,39 +157,36 @@ void HaikuDirectWindow::HandleMouseButton(BMessage *message) {
}
*/
- Ref<InputEvent> mouse_event;
- mouse_event.type = Ref<InputEvent>::MOUSE_BUTTON;
- mouse_event.device = 0;
+ Ref<InputEventMouseButton> mouse_event;
+ mouse_event.instance();
- mouse_event.mouse_button.mod = GetKeyModifierState(modifiers);
- mouse_event->get_button_mask() = GetMouseButtonState(buttons);
- mouse_event->get_position().x = where.x;
- mouse_event->get_position().y = where.y;
- mouse_event.mouse_button.global_x = where.x;
- mouse_event.mouse_button.global_y = where.y;
+ mouse_event->set_button_mask(GetMouseButtonState(buttons));
+ mouse_event->set_position({ where.x, where.y });
+ mouse_event->set_global_position({ where.x, where.y });
+ GetKeyModifierState(mouse_event, modifiers);
switch (button) {
default:
case B_PRIMARY_MOUSE_BUTTON:
- mouse_event->get_button_index() = 1;
+ mouse_event->set_button_index(1);
break;
case B_SECONDARY_MOUSE_BUTTON:
- mouse_event->get_button_index() = 2;
+ mouse_event->set_button_index(2);
break;
case B_TERTIARY_MOUSE_BUTTON:
- mouse_event->get_button_index() = 3;
+ mouse_event->set_button_index(3);
break;
}
- mouse_event->is_pressed() = (message->what == B_MOUSE_DOWN);
+ mouse_event->set_pressed(message->what == B_MOUSE_DOWN);
if (message->what == B_MOUSE_DOWN && mouse_event->get_button_index() == 1) {
int32 clicks = message->FindInt32("clicks");
if (clicks > 1) {
- mouse_event.mouse_button.doubleclick = true;
+ mouse_event->set_doubleclick(true);
}
}
@@ -208,22 +210,18 @@ void HaikuDirectWindow::HandleMouseMoved(BMessage *message) {
Point2i rel = pos - last_mouse_position;
- Ref<InputEvent> motion_event;
- motion_event.type = Ref<InputEvent>::MOUSE_MOTION;
- motion_event.device = 0;
+ Ref<InputEventMouseMotion> motion_event;
+ motion_event.instance();
+ GetKeyModifierState(motion_event, modifiers);
- motion_event.mouse_motion.mod = GetKeyModifierState(modifiers);
- motion_event->get_button_mask() = GetMouseButtonState(buttons);
- motion_event.mouse_motion.x = pos.x;
- motion_event.mouse_motion.y = pos.y;
+ motion_event->set_button_mask(GetMouseButtonState(buttons));
+ motion_event->set_position({ pos.x, pos.y });
input->set_mouse_position(pos);
- motion_event.mouse_motion.global_x = pos.x;
- motion_event.mouse_motion.global_y = pos.y;
- motion_event.mouse_motion.speed_x = input->get_last_mouse_speed().x;
- motion_event.mouse_motion.speed_y = input->get_last_mouse_speed().y;
+ motion_event->set_global_position({ pos.x, pos.y });
+ motion_event->set_speed({ input->get_last_mouse_speed().x,
+ input->get_last_mouse_speed().y });
- motion_event->get_relative().x = rel.x;
- motion_event->get_relative().y = rel.y;
+ motion_event->set_relative({ rel.x, rel.y });
last_mouse_position = pos;
@@ -236,22 +234,21 @@ void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) {
return;
}
- Ref<InputEvent> mouse_event;
- mouse_event.type = Ref<InputEvent>::MOUSE_BUTTON;
- mouse_event.device = 0;
+ Ref<InputEventMouseButton> mouse_event;
+ mouse_event.instance();
+ //GetKeyModifierState(mouse_event, modifiers);
- mouse_event->get_button_index() = wheel_delta_y < 0 ? 4 : 5;
- mouse_event.mouse_button.mod = GetKeyModifierState(last_key_modifier_state);
- mouse_event->get_button_mask() = last_button_mask;
- mouse_event->get_position().x = last_mouse_position.x;
- mouse_event->get_position().y = last_mouse_position.y;
- mouse_event.mouse_button.global_x = last_mouse_position.x;
- mouse_event.mouse_button.global_y = last_mouse_position.y;
+ mouse_event->set_button_index(wheel_delta_y < 0 ? 4 : 5);
+ mouse_event->set_button_mask(last_button_mask);
+ mouse_event->set_position({ last_mouse_position.x,
+ last_mouse_position.y });
+ mouse_event->set_global_position({ last_mouse_position.x,
+ last_mouse_position.y });
- mouse_event->is_pressed() = true;
+ mouse_event->set_pressed(true);
input->parse_input_event(mouse_event);
- mouse_event->is_pressed() = false;
+ mouse_event->set_pressed(false);
input->parse_input_event(mouse_event);
}
@@ -272,24 +269,23 @@ void HaikuDirectWindow::HandleKeyboardEvent(BMessage *message) {
return;
}
- Ref<InputEvent> event;
- event.type = Ref<InputEvent>::KEY;
- event.device = 0;
- event.key.mod = GetKeyModifierState(modifiers);
- event->is_pressed() = (message->what == B_KEY_DOWN);
- event->get_scancode() = KeyMappingHaiku::get_keysym(raw_char, key);
- event->is_echo() = message->HasInt32("be:key_repeat");
- event.key.unicode = 0;
+ Ref<InputEventKey> event;
+ event.instance();
+ GetKeyModifierState(event, modifiers);
+ event->set_pressed(message->what == B_KEY_DOWN);
+ event->set_scancode(KeyMappingHaiku::get_keysym(raw_char, key));
+ event->set_echo(message->HasInt32("be:key_repeat"));
+ event->set_unicode(0);
const char *bytes = NULL;
if (message->FindString("bytes", &bytes) == B_OK) {
- event.key.unicode = BUnicodeChar::FromUTF8(&bytes);
+ event->set_unicode(BUnicodeChar::FromUTF8(&bytes));
}
//make it consistent across platforms.
if (event->get_scancode() == KEY_BACKTAB) {
- event->get_scancode() = KEY_TAB;
- event->get_shift() = true;
+ event->set_scancode(KEY_TAB);
+ event->set_shift(true);
}
input->parse_input_event(event);
@@ -309,14 +305,14 @@ void HaikuDirectWindow::HandleKeyboardModifierEvent(BMessage *message) {
int32 key = old_modifiers ^ modifiers;
- Ref<InputEvent> event;
- event.type = Ref<InputEvent>::KEY;
- event.device = 0;
- event.key.mod = GetKeyModifierState(modifiers);
- event->is_pressed() = ((modifiers & key) != 0);
- event->get_scancode() = KeyMappingHaiku::get_modifier_keysym(key);
- event->is_echo() = false;
- event.key.unicode = 0;
+ Ref<InputEventWithModifiers> event;
+ event.instance();
+ GetKeyModifierState(event, modifiers);
+
+ event->set_shift(key & B_SHIFT_KEY);
+ event->set_alt(key & B_OPTION_KEY);
+ event->set_control(key & B_CONTROL_KEY);
+ event->set_command(key & B_COMMAND_KEY);
input->parse_input_event(event);
}
@@ -333,14 +329,13 @@ void HaikuDirectWindow::HandleWindowResized(BMessage *message) {
current_video_mode->height = height;
}
-inline InputModifierState HaikuDirectWindow::GetKeyModifierState(uint32 p_state) {
+inline void HaikuDirectWindow::GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state) {
last_key_modifier_state = p_state;
- InputModifierState state;
- state.shift = (p_state & B_SHIFT_KEY) != 0;
- state.control = (p_state & B_CONTROL_KEY) != 0;
- state.alt = (p_state & B_OPTION_KEY) != 0;
- state.meta = (p_state & B_COMMAND_KEY) != 0;
+ event->set_shift(p_state & B_SHIFT_KEY);
+ event->set_control(p_state & B_CONTROL_KEY);
+ event->set_alt(p_state & B_OPTION_KEY);
+ event->set_metakey(p_state & B_COMMAND_KEY);
return state;
}
diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h
index 55c2f5fccc..eee09191fa 100644
--- a/platform/haiku/haiku_direct_window.h
+++ b/platform/haiku/haiku_direct_window.h
@@ -31,9 +31,10 @@
#ifndef HAIKU_DIRECT_WINDOW_H
#define HAIKU_DIRECT_WINDOW_H
-#include <DirectWindow.h>
#include <kernel/image.h> // needed for image_id
+#include <DirectWindow.h>
+
#include "core/os/os.h"
#include "main/input_default.h"
@@ -63,7 +64,7 @@ private:
void HandleWindowResized(BMessage *message);
void HandleKeyboardEvent(BMessage *message);
void HandleKeyboardModifierEvent(BMessage *message);
- inline InputModifierState GetKeyModifierState(uint32 p_state);
+ inline void GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state);
inline int GetMouseButtonState(uint32 p_state);
public:
diff --git a/platform/haiku/haiku_gl_view.h b/platform/haiku/haiku_gl_view.h
index 1a694dc13b..6869cb7de7 100644
--- a/platform/haiku/haiku_gl_view.h
+++ b/platform/haiku/haiku_gl_view.h
@@ -31,9 +31,10 @@
#ifndef HAIKU_GL_VIEW_H
#define HAIKU_GL_VIEW_H
-#include <GLView.h>
#include <kernel/image.h> // needed for image_id
+#include <GLView.h>
+
class HaikuGLView : public BGLView {
public:
HaikuGLView(BRect frame, uint32 type);
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index 209cb5cec4..c80365f1f3 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -28,9 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "drivers/gles3/rasterizer_gles3.h"
+
#include "os_haiku.h"
-#include "drivers/gles3/rasterizer_gles3.h"
#include "main/main.h"
#include "servers/physics/physics_server_sw.h"
#include "servers/visual/visual_server_raster.h"
@@ -111,13 +112,12 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
context_gl->initialize();
context_gl->make_current();
context_gl->set_use_vsync(current_video_mode.use_vsync);
-
- /* Port to GLES 3 rasterizer */
- //rasterizer = memnew(RasterizerGLES2);
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
#endif
- visual_server = memnew(VisualServerRaster(rasterizer));
+ visual_server = memnew(VisualServerRaster());
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
@@ -138,8 +138,6 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
AudioDriverManager::initialize(p_audio_driver);
- power_manager = memnew(PowerHaiku);
-
return OK;
}
@@ -152,7 +150,6 @@ void OS_Haiku::finalize() {
visual_server->finish();
memdelete(visual_server);
- memdelete(rasterizer);
memdelete(input);
@@ -336,7 +333,7 @@ String OS_Haiku::get_config_path() const {
if (has_environment("XDG_CONFIG_HOME")) {
return get_environment("XDG_CONFIG_HOME");
} else if (has_environment("HOME")) {
- return get_environment("HOME").plus_file(".config");
+ return get_environment("HOME").plus_file("config/settings");
} else {
return ".";
}
@@ -347,7 +344,7 @@ String OS_Haiku::get_data_path() const {
if (has_environment("XDG_DATA_HOME")) {
return get_environment("XDG_DATA_HOME");
} else if (has_environment("HOME")) {
- return get_environment("HOME").plus_file(".local/share");
+ return get_environment("HOME").plus_file("config/data");
} else {
return get_config_path();
}
@@ -358,8 +355,23 @@ String OS_Haiku::get_cache_path() const {
if (has_environment("XDG_CACHE_HOME")) {
return get_environment("XDG_CACHE_HOME");
} else if (has_environment("HOME")) {
- return get_environment("HOME").plus_file(".cache");
+ return get_environment("HOME").plus_file("config/cache");
} else {
return get_config_path();
}
}
+
+OS::PowerState OS_Haiku::get_power_state() {
+ WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
+ return OS::POWERSTATE_UNKNOWN;
+}
+
+int OS_Haiku::get_power_seconds_left() {
+ WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
+ return -1;
+}
+
+int OS_Haiku::get_power_percent_left() {
+ WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
+ return -1;
+}
diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h
index 13d4420bde..e862eb44c3 100644
--- a/platform/haiku/os_haiku.h
+++ b/platform/haiku/os_haiku.h
@@ -37,9 +37,7 @@
#include "haiku_application.h"
#include "haiku_direct_window.h"
#include "main/input_default.h"
-#include "power_haiku.h"
#include "servers/audio_server.h"
-#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
class OS_Haiku : public OS_Unix {
@@ -48,11 +46,9 @@ private:
HaikuDirectWindow *window;
MainLoop *main_loop;
InputDefault *input;
- Rasterizer *rasterizer;
VisualServer *visual_server;
VideoMode current_video_mode;
int video_driver_index;
- PowerHaiku *power_manager;
#ifdef MEDIA_KIT_ENABLED
AudioDriverMediaKit driver_media_kit;
diff --git a/platform/haiku/platform_config.h b/platform/haiku/platform_config.h
index bbd72dfeb6..72c8ee2535 100644
--- a/platform/haiku/platform_config.h
+++ b/platform/haiku/platform_config.h
@@ -34,3 +34,4 @@
#define _BSD_SOURCE 1
#define GLES3_INCLUDE_H "glad/glad.h"
+#define GLES2_INCLUDE_H "glad/glad.h"
diff --git a/platform/haiku/power_haiku.cpp b/platform/haiku/power_haiku.cpp
deleted file mode 100644
index 2a26dd0f9c..0000000000
--- a/platform/haiku/power_haiku.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*************************************************************************/
-/* power_haiku.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "core/error_macros.h"
-
-#include "power_haiku.h"
-
-bool PowerHaiku::UpdatePowerInfo() {
-
- return false;
-}
-
-OS::PowerState PowerHaiku::get_power_state() {
- if (UpdatePowerInfo()) {
- return power_state;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
- return OS::POWERSTATE_UNKNOWN;
- }
-}
-
-int PowerX11::get_power_seconds_left() {
- if (UpdatePowerInfo()) {
- return nsecs_left;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
- return -1;
- }
-}
-
-int PowerX11::get_power_percent_left() {
- if (UpdatePowerInfo()) {
- return percent_left;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
- return -1;
- }
-}
-
-PowerHaiku::PowerHaiku() :
- nsecs_left(-1),
- percent_left(-1),
- power_state(OS::POWERSTATE_UNKNOWN) {
-}
-
-PowerHaiku::~PowerHaiku() {
-}
diff --git a/platform/haiku/power_haiku.h b/platform/haiku/power_haiku.h
deleted file mode 100644
index 2fe85cd23d..0000000000
--- a/platform/haiku/power_haiku.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*************************************************************************/
-/* power_haiku.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef PLATFORM_HAIKU_POWER_HAIKU_H_
-#define PLATFORM_HAIKU_POWER_HAIKU_H_
-
-#include <os/os.h>
-
-class PowerHaiku {
-private:
- int nsecs_left;
- int percent_left;
- OS::PowerState power_state;
-
- bool UpdatePowerInfo();
-
-public:
- PowerHaiku();
- virtual ~PowerHaiku();
-
- OS::PowerState get_power_state();
- int get_power_seconds_left();
- int get_power_percent_left();
-};
-
-#endif /* PLATFORM_HAIKU_POWER_HAIKU_H_ */
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 84a0fb9b1d..e53ccb4cf4 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -2042,6 +2042,8 @@ void PhysicalBone::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_simulating_physics"), &PhysicalBone::is_simulating_physics);
+ ClassDB::bind_method(D_METHOD("get_bone_id"), &PhysicalBone::get_bone_id);
+
ClassDB::bind_method(D_METHOD("set_mass", "mass"), &PhysicalBone::set_mass);
ClassDB::bind_method(D_METHOD("get_mass"), &PhysicalBone::get_mass);
diff --git a/thirdparty/glad/glad.c b/thirdparty/glad/glad.c
index dd6fe8b8f3..35469e9031 100644
--- a/thirdparty/glad/glad.c
+++ b/thirdparty/glad/glad.c
@@ -77,7 +77,7 @@ void close_gl(void) {
#include <dlfcn.h>
static void* libGL;
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__HAIKU__)
typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);
static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
#endif
@@ -100,7 +100,7 @@ int open_gl(void) {
libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);
if(libGL != NULL) {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__HAIKU__)
return 1;
#else
gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,
@@ -127,7 +127,7 @@ void* get_proc(const char *namez) {
void* result = NULL;
if(libGL == NULL) return NULL;
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__HAIKU__)
if(gladGetProcAddressPtr != NULL) {
result = gladGetProcAddressPtr(namez);
}
diff --git a/thirdparty/libwebsockets/lws_config.h b/thirdparty/libwebsockets/lws_config.h
index 7185a806a5..e5e15cc2fd 100644
--- a/thirdparty/libwebsockets/lws_config.h
+++ b/thirdparty/libwebsockets/lws_config.h
@@ -174,7 +174,7 @@
#define LWS_HAVE_MALLOC_H
#endif
-#if !defined(IPHONE_ENABLED) && !defined(OSX_ENABLED)
+#if !defined(IPHONE_ENABLED) && !defined(OSX_ENABLED) && !defined(__HAIKU__)
#define LWS_HAVE_PIPE2
#endif
diff --git a/thirdparty/libwebsockets/lws_config_private.h b/thirdparty/libwebsockets/lws_config_private.h
index 9d04078fef..b26d225afa 100644
--- a/thirdparty/libwebsockets/lws_config_private.h
+++ b/thirdparty/libwebsockets/lws_config_private.h
@@ -81,7 +81,7 @@
/* Define to 1 if you have the <sys/prctl.h> header file. */
#define LWS_HAVE_SYS_PRCTL_H
-#if defined(OSX_ENABLED) || defined(IPHONE_ENABLED) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(OSX_ENABLED) || defined(IPHONE_ENABLED) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__)
#undef LWS_HAVE_SYS_PRCTL_H
#endif
diff --git a/thirdparty/thekla_atlas/nvcore/nvcore.h b/thirdparty/thekla_atlas/nvcore/nvcore.h
index a3deb66be2..5ef69668d9 100644
--- a/thirdparty/thekla_atlas/nvcore/nvcore.h
+++ b/thirdparty/thekla_atlas/nvcore/nvcore.h
@@ -44,6 +44,9 @@
#elif defined POSH_OS_FREEBSD
# define NV_OS_FREEBSD 1
# define NV_OS_UNIX 1
+#elif defined POSH_OS_HAIKU
+# define NV_OS_HAIKU 1
+# define NV_OS_UNIX 1
#elif defined POSH_OS_OPENBSD
# define NV_OS_OPENBSD 1
# define NV_OS_UNIX 1
@@ -341,7 +344,7 @@ template <typename T, size_t N> char (&ArraySizeHelper(T (&array)[N]))[N];
#elif NV_CC_GNUC
# if NV_OS_LINUX
# include "DefsGnucLinux.h"
-# elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
+# elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD || NV_OS_HAIKU
# include "DefsGnucDarwin.h"
# elif NV_OS_ORBIS
# include "DefsOrbis.h"
diff --git a/thirdparty/thekla_atlas/poshlib/posh.h b/thirdparty/thekla_atlas/poshlib/posh.h
index 3038297b39..72acd20ce0 100644
--- a/thirdparty/thekla_atlas/poshlib/posh.h
+++ b/thirdparty/thekla_atlas/poshlib/posh.h
@@ -298,6 +298,11 @@ Metrowerks:
# define POSH_OS_STRING "Linux"
#endif
+#if defined __HAIKU__
+# define POSH_OS_HAIKU 1
+# define POSH_OS_STRING "Haiku"
+#endif
+
#if defined __FreeBSD__
# define POSH_OS_FREEBSD 1
# define POSH_OS_STRING "FreeBSD"