summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/pck_packer.cpp2
-rw-r--r--core/register_core_types.cpp1
-rw-r--r--doc/classes/Control.xml8
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp74
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp2
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp222
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h1
-rw-r--r--drivers/gles2/shader_gles2.cpp5
-rw-r--r--drivers/gles2/shader_gles2.h2
-rw-r--r--drivers/gles2/shaders/canvas.glsl32
-rw-r--r--drivers/gles2/shaders/copy.glsl11
-rw-r--r--drivers/gles2/shaders/cubemap_filter.glsl20
-rw-r--r--drivers/gles2/shaders/scene.glsl29
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp125
-rw-r--r--drivers/gles3/shaders/copy.glsl23
-rw-r--r--editor/editor_sectioned_inspector.cpp2
-rw-r--r--editor/plugin_config_dialog.cpp29
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp2
-rw-r--r--main/main.cpp11
-rw-r--r--main/main.h2
-rw-r--r--modules/gdscript/gdscript.cpp3
-rw-r--r--modules/gdscript/gdscript_parser.cpp38
-rw-r--r--platform/windows/detect.py8
-rw-r--r--platform/windows/os_windows.cpp24
-rw-r--r--scene/2d/canvas_item.cpp7
-rw-r--r--scene/2d/canvas_item.h4
-rw-r--r--scene/3d/physics_body.cpp8
-rw-r--r--scene/gui/base_button.cpp12
-rw-r--r--scene/gui/box_container.cpp4
-rw-r--r--scene/gui/graph_node.cpp159
-rw-r--r--scene/gui/grid_container.cpp4
-rw-r--r--scene/gui/margin_container.cpp38
-rw-r--r--scene/gui/progress_bar.cpp1
-rw-r--r--scene/gui/split_container.cpp4
-rw-r--r--scene/gui/tab_container.cpp1
-rw-r--r--scene/resources/dynamic_font.cpp2
-rw-r--r--scene/resources/style_box.cpp7
-rw-r--r--scene/resources/style_box.h4
-rw-r--r--scene/resources/surface_tool.cpp2
-rw-r--r--scene/resources/surface_tool.h2
-rw-r--r--scene/resources/texture.cpp4
-rw-r--r--thirdparty/README.md3
-rw-r--r--thirdparty/libtheora/decode.c8
-rw-r--r--thirdparty/libtheora/patches/theora.git-0ae66d565e6bead8604d312bc1a4e9dccf245c88.patch38
44 files changed, 821 insertions, 167 deletions
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 36bd429bc0..8920bbfb81 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -175,7 +175,7 @@ Error PCKPacker::flush(bool p_verbose) {
printf("\n");
file->close();
- memdelete(buf);
+ memdelete_arr(buf);
return OK;
};
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 666384b093..a31aa9cb01 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -142,6 +142,7 @@ void register_core_types() {
ClassDB::register_virtual_class<InputEventGesture>();
ClassDB::register_class<InputEventMagnifyGesture>();
ClassDB::register_class<InputEventPanGesture>();
+ ClassDB::register_class<InputEventMIDI>();
ClassDB::register_class<FuncRef>();
ClassDB::register_virtual_class<StreamPeer>();
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index f067b50c72..d27839e0a6 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -681,7 +681,7 @@
[b]Note:[/b] On Linux, shapes may vary depending on the cursor theme of the system.
</member>
<member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" enum="Control.MouseFilter">
- Controls whether the control will be able to receive mouse button input events through [method _gui_input] and how these events should be handled. See the constants to learn what each does.
+ Controls whether the control will be able to receive mouse button input events through [method _gui_input] and how these events should be handled. Also controls whether the control can receive the [signal mouse_entered], and [signal mouse_exited] signals. See the constants to learn what each does.
</member>
<member name="rect_clip_content" type="bool" setter="set_clip_contents" getter="is_clipping_contents">
Enables whether rendering of children should be clipped to this control's rectangle. If true, parts of a child which would be visibly outside of this control's rectangle will not be rendered.
@@ -929,13 +929,13 @@
Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical].
</constant>
<constant name="MOUSE_FILTER_STOP" value="0" enum="MouseFilter">
- The control will receive mouse button input events through [method _gui_input] if clicked on. These events are automatically marked as handled and they will not propagate further to other controls.
+ The control will receive mouse button input events through [method _gui_input] if clicked on. And the control will receive the [signal mouse_entered] and [signal mouse_exited] signals. These events are automatically marked as handled and they will not propagate further to other controls. This also results in blocking signals in other controls.
</constant>
<constant name="MOUSE_FILTER_PASS" value="1" enum="MouseFilter">
- The control will receive mouse button input events through [method _gui_input] if clicked on. If this control does not handle the event, the parent control (if any) will be considered for a mouse click, and so on until there is no more parent control to potentially handle it. Even if no control handled it at all, the event will still be handled automatically, so unhandled input will not be fired.
+ The control will receive mouse button input events through [method _gui_input] if clicked on. And the control will receive the [signal mouse_entered] and [signal mouse_exited] signals. If this control does not handle the event, the parent control (if any) will be considered, and so on until there is no more parent control to potentially handle it. This also allows signals to fire in other controls. Even if no control handled it at all, the event will still be handled automatically, so unhandled input will not be fired.
</constant>
<constant name="MOUSE_FILTER_IGNORE" value="2" enum="MouseFilter">
- The control will not receive mouse button input events through [method _gui_input] and will not block other controls from receiving these events. These events will also not be handled automatically.
+ The control will not receive mouse button input events through [method _gui_input]. Also the control will not receive the [signal mouse_entered] nor [signal mouse_exited] signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically.
</constant>
<constant name="GROW_DIRECTION_BEGIN" value="0" enum="GrowDirection">
The control will grow to the left or top to make up if its minimum size is changed to be greater than its current size on the respective axis.
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 047eaaf0ac..6f686690bf 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -1162,7 +1162,65 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
void RasterizerCanvasGLES2::_copy_texscreen(const Rect2 &p_rect) {
- // This isn't really working yet, so disabling for now.
+ if (storage->frame.current_rt->copy_screen_effect.color == 0) {
+ ERR_EXPLAIN("Can't use screen texture copying in a render target configured without copy buffers");
+ ERR_FAIL();
+ }
+
+ glDisable(GL_BLEND);
+
+ state.canvas_texscreen_used = true;
+
+ Vector2 wh(storage->frame.current_rt->width, storage->frame.current_rt->height);
+
+ Color copy_section(p_rect.position.x / wh.x, p_rect.position.y / wh.y, p_rect.size.x / wh.x, p_rect.size.y / wh.y);
+
+ if (p_rect != Rect2()) {
+ storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_COPY_SECTION, true);
+ }
+
+ glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->copy_screen_effect.fbo);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
+
+ glClearColor(1, 0, 1, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ storage->shaders.copy.bind();
+ storage->shaders.copy.set_uniform(CopyShaderGLES2::COPY_SECTION, copy_section);
+
+ const Vector2 vertpos[4] = {
+ Vector2(-1, -1),
+ Vector2(-1, 1),
+ Vector2(1, 1),
+ Vector2(1, -1),
+ };
+
+ const Vector2 uvpos[4] = {
+ Vector2(0, 0),
+ Vector2(0, 1),
+ Vector2(1, 1),
+ Vector2(1, 0)
+ };
+
+ const int indexpos[6] = {
+ 0, 1, 2,
+ 2, 3, 0
+ };
+
+ _draw_polygon(indexpos, 6, 4, vertpos, uvpos, NULL, false);
+
+ storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_COPY_SECTION, false);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo); //back to front
+
+ // back to canvas, force rebind
+ state.using_texture_rect = false;
+ state.canvas_shader.bind();
+ _bind_canvas_texture(state.current_tex, state.current_normal);
+ _set_uniforms();
+
+ glEnable(GL_BLEND);
}
void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_base_transform) {
@@ -1178,6 +1236,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
state.current_tex = RID();
state.current_tex_ptr = NULL;
state.current_normal = RID();
+ state.canvas_texscreen_used = false;
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
@@ -1265,7 +1324,18 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
if (shader_ptr) {
if (shader_ptr->canvas_item.uses_screen_texture) {
- _copy_texscreen(Rect2());
+ if (!state.canvas_texscreen_used) {
+ //copy if not copied before
+ _copy_texscreen(Rect2());
+
+ // blend mode will have been enabled so make sure we disable it again later on
+ //last_blend_mode = last_blend_mode != RasterizerStorageGLES2::Shader::CanvasItem::BLEND_MODE_DISABLED ? last_blend_mode : -1;
+ }
+
+ if (storage->frame.current_rt->copy_screen_effect.color) {
+ glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 4);
+ glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->copy_screen_effect.color);
+ }
}
if (shader_ptr != shader_cache) {
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index ce2961170a..47a4f8bc27 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -3135,7 +3135,7 @@ void RasterizerSceneGLES2::initialize() {
}
// cubemaps for shadows
- if (!storage->config.support_write_depth) { //not going to be used
+ if (storage->config.support_write_depth) { //not going to be used
int max_shadow_cubemap_sampler_size = 512;
int cube_size = max_shadow_cubemap_sampler_size;
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 0d643370e0..f0deff4791 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -1715,8 +1715,196 @@ RID RasterizerStorageGLES2::mesh_create() {
return mesh_owner.make_rid(mesh);
}
+static PoolVector<uint8_t> _unpack_half_floats(const PoolVector<uint8_t> &array, uint32_t &format, int p_vertices) {
+
+ uint32_t p_format = format;
+
+ static int src_size[VS::ARRAY_MAX];
+ static int dst_size[VS::ARRAY_MAX];
+ static int to_convert[VS::ARRAY_MAX];
+
+ int src_stride = 0;
+ int dst_stride = 0;
+
+ for (int i = 0; i < VS::ARRAY_MAX; i++) {
+
+ to_convert[i] = 0;
+ if (!(p_format & (1 << i))) {
+ src_size[i] = 0;
+ dst_size[i] = 0;
+ continue;
+ }
+
+ switch (i) {
+
+ case VS::ARRAY_VERTEX: {
+
+ if (p_format & VS::ARRAY_COMPRESS_VERTEX) {
+
+ if (p_format & VS::ARRAY_FLAG_USE_2D_VERTICES) {
+ src_size[i] = 4;
+ dst_size[i] = 8;
+ to_convert[i] = 2;
+ } else {
+ src_size[i] = 8;
+ dst_size[i] = 12;
+ to_convert[i] = 3;
+ }
+
+ format &= ~VS::ARRAY_COMPRESS_VERTEX;
+ } else {
+
+ if (p_format & VS::ARRAY_FLAG_USE_2D_VERTICES) {
+ src_size[i] = 8;
+ dst_size[i] = 8;
+ } else {
+ src_size[i] = 12;
+ dst_size[i] = 12;
+ }
+ }
+
+ } break;
+ case VS::ARRAY_NORMAL: {
+
+ if (p_format & VS::ARRAY_COMPRESS_NORMAL) {
+ src_size[i] = 4;
+ dst_size[i] = 4;
+ } else {
+ src_size[i] = 12;
+ dst_size[i] = 12;
+ }
+
+ } break;
+ case VS::ARRAY_TANGENT: {
+
+ if (p_format & VS::ARRAY_COMPRESS_TANGENT) {
+ src_size[i] = 4;
+ dst_size[i] = 4;
+ } else {
+ src_size[i] = 16;
+ dst_size[i] = 16;
+ }
+
+ } break;
+ case VS::ARRAY_COLOR: {
+
+ if (p_format & VS::ARRAY_COMPRESS_COLOR) {
+ src_size[i] = 4;
+ dst_size[i] = 4;
+ } else {
+ src_size[i] = 16;
+ dst_size[i] = 16;
+ }
+
+ } break;
+ case VS::ARRAY_TEX_UV: {
+
+ if (p_format & VS::ARRAY_COMPRESS_TEX_UV) {
+ src_size[i] = 4;
+ to_convert[i] = 2;
+ format &= ~VS::ARRAY_COMPRESS_TEX_UV;
+ } else {
+ src_size[i] = 8;
+ }
+
+ dst_size[i] = 8;
+
+ } break;
+ case VS::ARRAY_TEX_UV2: {
+
+ if (p_format & VS::ARRAY_COMPRESS_TEX_UV2) {
+ src_size[i] = 4;
+ to_convert[i] = 2;
+ format &= ~VS::ARRAY_COMPRESS_TEX_UV2;
+ } else {
+ src_size[i] = 8;
+ }
+
+ dst_size[i] = 8;
+
+ } break;
+ case VS::ARRAY_BONES: {
+
+ if (p_format & VS::ARRAY_FLAG_USE_16_BIT_BONES) {
+ src_size[i] = 8;
+ dst_size[i] = 8;
+ } else {
+ src_size[i] = 4;
+ dst_size[i] = 4;
+ }
+
+ } break;
+ case VS::ARRAY_WEIGHTS: {
+
+ if (p_format & VS::ARRAY_COMPRESS_WEIGHTS) {
+ src_size[i] = 8;
+ dst_size[i] = 8;
+ } else {
+ src_size[i] = 16;
+ dst_size[i] = 16;
+ }
+
+ } break;
+ case VS::ARRAY_INDEX: {
+
+ src_size[i] = 0;
+ dst_size[i] = 0;
+
+ } break;
+ }
+
+ src_stride += src_size[i];
+ dst_stride += dst_size[i];
+ }
+
+ PoolVector<uint8_t> ret;
+ ret.resize(p_vertices * dst_stride);
+
+ PoolVector<uint8_t>::Read r = array.read();
+ PoolVector<uint8_t>::Write w = ret.write();
+
+ int src_offset = 0;
+ int dst_offset = 0;
+
+ for (int i = 0; i < VS::ARRAY_MAX; i++) {
+
+ if (src_size[i] == 0) {
+ continue; //no go
+ }
+ const uint8_t *rptr = r.ptr();
+ uint8_t *wptr = w.ptr();
+ if (to_convert[i]) { //converting
+
+ for (int j = 0; j < p_vertices; j++) {
+ const uint16_t *src = (const uint16_t *)&rptr[src_stride * j + src_offset];
+ float *dst = (float *)&wptr[dst_stride * j + dst_offset];
+
+ for (int k = 0; k < to_convert[i]; k++) {
+
+ dst[k] = Math::half_to_float(src[k]);
+ }
+ }
+
+ } else {
+ //just copy
+ for (int j = 0; j < p_vertices; j++) {
+ for (int k = 0; k < src_size[i]; k++) {
+ wptr[dst_stride * j + dst_offset + k] = rptr[src_stride * j + src_offset + k];
+ }
+ }
+ }
+
+ src_offset += src_size[i];
+ dst_offset += dst_size[i];
+ }
+
+ r = PoolVector<uint8_t>::Read();
+ w = PoolVector<uint8_t>::Write();
+
+ return ret;
+}
+
void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS::PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabbs) {
- PoolVector<uint8_t> array = p_array;
Mesh *mesh = mesh_owner.getornull(p_mesh);
ERR_FAIL_COND(!mesh);
@@ -1735,6 +1923,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
Surface::Attrib attribs[VS::ARRAY_MAX];
int stride = 0;
+ bool uses_half_float = false;
for (int i = 0; i < VS::ARRAY_MAX; i++) {
@@ -1763,6 +1952,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
if (p_format & VS::ARRAY_COMPRESS_VERTEX) {
attribs[i].type = _GL_HALF_FLOAT_OES;
stride += attribs[i].size * 2;
+ uses_half_float = true;
} else {
attribs[i].type = GL_FLOAT;
stride += attribs[i].size * 4;
@@ -1823,6 +2013,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
if (p_format & VS::ARRAY_COMPRESS_TEX_UV) {
attribs[i].type = _GL_HALF_FLOAT_OES;
stride += 4;
+ uses_half_float = true;
} else {
attribs[i].type = GL_FLOAT;
stride += 8;
@@ -1838,6 +2029,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
if (p_format & VS::ARRAY_COMPRESS_TEX_UV2) {
attribs[i].type = _GL_HALF_FLOAT_OES;
stride += 4;
+ uses_half_float = true;
} else {
attribs[i].type = GL_FLOAT;
stride += 8;
@@ -1900,6 +2092,7 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
}
//validate sizes
+ PoolVector<uint8_t> array = p_array;
int array_size = stride * p_vertex_count;
int index_array_size = 0;
@@ -1931,6 +2124,15 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
ERR_FAIL_COND(array.size() != array_size);
+ if (!config.support_half_float_vertices && uses_half_float) {
+
+ uint32_t new_format = p_format;
+ PoolVector<uint8_t> unpacked_array = _unpack_half_floats(array, new_format, p_vertex_count);
+
+ mesh_add_surface(p_mesh, new_format, p_primitive, unpacked_array, p_vertex_count, p_index_array, p_index_count, p_aabb, p_blend_shapes, p_bone_aabbs);
+ return; //do not go any further, above function used unpacked stuff will be used instead.
+ }
+
if (p_format & VS::ARRAY_FORMAT_INDEX) {
index_array_size = attribs[VS::ARRAY_INDEX].stride * p_index_count;
@@ -4049,7 +4251,8 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// copy texscreen buffers
- {
+ if (!(rt->flags[RasterizerStorage::RENDER_TARGET_NO_SAMPLING])) {
+
int w = rt->width;
int h = rt->height;
@@ -4057,10 +4260,17 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glBindTexture(GL_TEXTURE_2D, rt->copy_screen_effect.color);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glGenFramebuffers(1, &rt->copy_screen_effect.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, rt->copy_screen_effect.fbo);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->copy_screen_effect.color, 0);
+
+ glClearColor(0, 0, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
@@ -4679,6 +4889,12 @@ void RasterizerStorageGLES2::initialize() {
config.support_write_depth = config.extensions.has("GL_EXT_frag_depth");
#endif
+#ifdef JAVASCRIPT_ENABLED
+ config.support_half_float_vertices = false;
+#else
+ //every other platform, be it mobile or desktop, supports this (even if not in the GLES2 spec).
+ config.support_half_float_vertices = true;
+#endif
frame.count = 0;
frame.delta = 0;
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index 0e0804eef2..ed21238db6 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -81,6 +81,7 @@ public:
bool support_32_bits_indices;
bool support_write_depth;
+ bool support_half_float_vertices;
} config;
struct Resources {
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index 65d4b63bb9..b50da3e9fe 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -242,6 +242,11 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
strings.push_back("#define USE_GLES_OVER_GL\n");
#else
strings.push_back("#version 100\n");
+//angle does not like
+#ifdef JAVASCRIPT_ENABLED
+ strings.push_back("#define USE_HIGHP_PRECISION\n");
+#endif
+
#endif
int define_line_ofs = 1;
diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h
index 468971471c..5805432d09 100644
--- a/drivers/gles2/shader_gles2.h
+++ b/drivers/gles2/shader_gles2.h
@@ -465,6 +465,8 @@ public:
void set_custom_shader(uint32_t p_code_id);
void free_custom_shader(uint32_t p_code_id);
+ uint32_t get_version_key() const { return conditional_version.version; }
+
void set_uniform_default(int p_idx, const Variant &p_value) {
if (p_value.get_type() == Variant::NIL) {
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index d483659e4d..c4a8c8b990 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -6,8 +6,8 @@
#define mediump
#define highp
#else
-precision mediump float;
-precision mediump int;
+precision highp float;
+precision highp int;
#endif
uniform highp mat4 projection_matrix;
@@ -215,14 +215,42 @@ VERTEX_SHADER_CODE
/* clang-format off */
[fragment]
+#ifndef USE_GLES_OVER_GL
+
+#ifdef GL_EXT_shader_texture_lod
+#extension GL_EXT_shader_texture_lod : enable
+#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
+#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
+#endif
+
+#endif
+
+#ifdef GL_ARB_shader_texture_lod
+#extension GL_ARB_shader_texture_lod : enable
+#endif
+
+
+#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
+#define texture2DLod(img, coord, lod) texture2D(img, coord, lod)
+#define textureCubeLod(img, coord, lod) textureCube(img, coord, lod)
+#endif
+
+
+
+
#ifdef USE_GLES_OVER_GL
#define lowp
#define mediump
#define highp
#else
+#if defined(USE_HIGHP_PRECISION)
+precision highp float;
+precision highp int;
+#else
precision mediump float;
precision mediump int;
#endif
+#endif
uniform sampler2D color_texture; // texunit:-1
/* clang-format on */
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl
index f3c2a7eec4..931b3f3708 100644
--- a/drivers/gles2/shaders/copy.glsl
+++ b/drivers/gles2/shaders/copy.glsl
@@ -6,8 +6,8 @@
#define mediump
#define highp
#else
-precision mediump float;
-precision mediump int;
+precision highp float;
+precision highp int;
#endif
attribute highp vec4 vertex_attrib; // attrib:0
@@ -29,7 +29,7 @@ varying vec2 uv_interp;
varying vec2 uv2_interp;
#ifdef USE_COPY_SECTION
-uniform vec4 copy_section;
+uniform highp vec4 copy_section;
#endif
void main() {
@@ -61,9 +61,14 @@ void main() {
#define mediump
#define highp
#else
+#if defined(USE_HIGHP_PRECISION)
+precision highp float;
+precision highp int;
+#else
precision mediump float;
precision mediump int;
#endif
+#endif
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
varying vec3 cube_interp;
diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl
index f551cdb52b..7643297a14 100644
--- a/drivers/gles2/shaders/cubemap_filter.glsl
+++ b/drivers/gles2/shaders/cubemap_filter.glsl
@@ -6,8 +6,8 @@
#define mediump
#define highp
#else
-precision mediump float;
-precision mediump int;
+precision highp float;
+precision highp int;
#endif
attribute highp vec2 vertex; // attrib:0
@@ -25,30 +25,42 @@ void main() {
/* clang-format off */
[fragment]
+#ifndef USE_GLES_OVER_GL
+
#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
#endif
+#endif
+
#ifdef GL_ARB_shader_texture_lod
#extension GL_ARB_shader_texture_lod : enable
#endif
#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
-#define texture2DLod(img, coord, lod) texture2D(img, coord)
-#define textureCubeLod(img, coord, lod) textureCube(img, coord)
+#define texture2DLod(img, coord, lod) texture2D(img, coord, lod)
+#define textureCubeLod(img, coord, lod) textureCube(img, coord, lod)
#endif
+
+
#ifdef USE_GLES_OVER_GL
#define lowp
#define mediump
#define highp
#else
+#if defined(USE_HIGHP_PRECISION)
+precision highp float;
+precision highp int;
+#else
precision mediump float;
precision mediump int;
#endif
+#endif
+
#ifdef USE_SOURCE_PANORAMA
uniform sampler2D source_panorama; //texunit:0
#else
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index b2b9458ed2..c7f5c97133 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -655,20 +655,41 @@ VERTEX_SHADER_CODE
/* clang-format off */
[fragment]
+
+#ifndef USE_GLES_OVER_GL
+
+#ifdef GL_EXT_shader_texture_lod
+#extension GL_EXT_shader_texture_lod : enable
+#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
+#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
+#endif
+
+#endif
+
+#ifdef GL_ARB_shader_texture_lod
#extension GL_ARB_shader_texture_lod : enable
+#endif
-#ifndef GL_ARB_shader_texture_lod
-#define texture2DLod(img, coord, lod) texture2D(img, coord)
-#define textureCubeLod(img, coord, lod) textureCube(img, coord)
+#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
+#define texture2DLod(img, coord, lod) texture2D(img, coord, lod)
+#define textureCubeLod(img, coord, lod) textureCube(img, coord, lod)
#endif
+
+
+
#ifdef USE_GLES_OVER_GL
#define lowp
#define mediump
#define highp
#else
-precision mediump float;
+#if defined(USE_HIGHP_PRECISION)
+precision highp float;
precision highp int;
+#else
+precision mediump float;
+precision mediump int;
+#endif
#endif
#include "stdlib.glsl"
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 24673c8755..8b3f1a1b77 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1056,6 +1056,128 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
return texture->images[p_layer];
}
+ // 3D textures and 2D texture arrays need special treatment, as the glGetTexImage reads **the whole**
+ // texture to host-memory. 3D textures and 2D texture arrays are potentially very big, so reading
+ // everything just to throw everything but one layer away is A Bad Idea.
+ //
+ // Unfortunately, to solve this, the copy shader has to read the data out via a shader and store it
+ // in a temporary framebuffer. The data from the framebuffer can then be read using glReadPixels.
+ if (texture->type == VS::TEXTURE_TYPE_2D_ARRAY || texture->type == VS::TEXTURE_TYPE_3D) {
+ // can't read a layer that doesn't exist
+ ERR_FAIL_INDEX_V(p_layer, texture->alloc_depth, Ref<Image>());
+
+ // get some information about the texture
+ Image::Format real_format;
+ GLenum gl_format;
+ GLenum gl_internal_format;
+ GLenum gl_type;
+
+ bool compressed;
+ bool srgb;
+
+ _get_gl_image_and_format(
+ Ref<Image>(),
+ texture->format,
+ texture->flags,
+ real_format,
+ gl_format,
+ gl_internal_format,
+ gl_type,
+ compressed,
+ srgb);
+
+ PoolVector<uint8_t> data;
+
+ // TODO need to decide between RgbaUnorm and RgbaFloat32 for output
+ int data_size = Image::get_image_data_size(texture->alloc_width, texture->alloc_height, Image::FORMAT_RGBA8, false);
+
+ data.resize(data_size * 2); // add some more memory at the end, just in case for buggy drivers
+ PoolVector<uint8_t>::Write wb = data.write();
+
+ // generate temporary resources
+ GLuint tmp_fbo;
+ glGenFramebuffers(1, &tmp_fbo);
+
+ GLuint tmp_color_attachment;
+ glGenTextures(1, &tmp_color_attachment);
+
+ // now bring the OpenGL context into the correct state
+ {
+ glBindFramebuffer(GL_FRAMEBUFFER, tmp_fbo);
+
+ // back color attachment with memory, then set properties
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, tmp_color_attachment);
+ // TODO support HDR properly
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ // use the color texture as color attachment for this render pass
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmp_color_attachment, 0);
+
+ // more GL state, wheeeey
+ glDepthMask(GL_FALSE);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthFunc(GL_LEQUAL);
+ glColorMask(1, 1, 1, 1);
+
+ // use volume tex for reading
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(texture->target, texture->tex_id);
+
+ glViewport(0, 0, texture->alloc_width, texture->alloc_height);
+
+ // set up copy shader for proper use
+ shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, !srgb);
+ shaders.copy.set_conditional(CopyShaderGLES3::USE_TEXTURE3D, texture->type == VS::TEXTURE_TYPE_3D);
+ shaders.copy.set_conditional(CopyShaderGLES3::USE_TEXTURE2DARRAY, texture->type == VS::TEXTURE_TYPE_2D_ARRAY);
+ shaders.copy.bind();
+
+ // calculate the normalized z coordinate for the layer
+ float layer = (float)p_layer / (float)texture->alloc_depth;
+
+ shaders.copy.set_uniform(CopyShaderGLES3::LAYER, layer);
+
+ glBindVertexArray(resources.quadie_array);
+ }
+
+ // clear color attachment, then perform copy
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ // read the image into the host buffer
+ glReadPixels(0, 0, texture->alloc_width, texture->alloc_height, GL_RGBA, GL_UNSIGNED_BYTE, &wb[0]);
+
+ // remove temp resources and unset some GL state
+ {
+ shaders.copy.set_conditional(CopyShaderGLES3::USE_TEXTURE3D, false);
+ shaders.copy.set_conditional(CopyShaderGLES3::USE_TEXTURE2DARRAY, false);
+ shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, false);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+ glDeleteTextures(1, &tmp_color_attachment);
+ glDeleteFramebuffers(1, &tmp_fbo);
+ }
+
+ wb = PoolVector<uint8_t>::Write();
+
+ data.resize(data_size);
+
+ Image *img = memnew(Image(texture->alloc_width, texture->alloc_height, false, Image::FORMAT_RGBA8, data));
+ if (!texture->compressed) {
+ img->convert(real_format);
+ }
+
+ return Ref<Image>(img);
+ }
+
#ifdef GLES_OVER_GL
Image::Format real_format;
@@ -1172,9 +1294,8 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer)
glViewport(0, 0, texture->alloc_width, texture->alloc_height);
- shaders.copy.bind();
-
shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, !srgb);
+ shaders.copy.bind();
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl
index 3b36bc7cc1..e1a0813efc 100644
--- a/drivers/gles3/shaders/copy.glsl
+++ b/drivers/gles3/shaders/copy.glsl
@@ -61,19 +61,35 @@ in vec3 cube_interp;
#else
in vec2 uv_interp;
#endif
-/* clang-format on */
#ifdef USE_ASYM_PANO
uniform highp mat4 pano_transform;
uniform highp vec4 asym_proj;
#endif
+// These definitions are here because the shader-wrapper builder does
+// not understand `#elif defined()`
+#ifdef USE_TEXTURE3D
+#endif
+#ifdef USE_TEXTURE2DARRAY
+#endif
+
#ifdef USE_CUBEMAP
uniform samplerCube source_cube; //texunit:0
+#elif defined(USE_TEXTURE3D)
+uniform sampler3D source_3d; //texunit:0
+#elif defined(USE_TEXTURE2DARRAY)
+uniform sampler2DArray source_2d_array; //texunit:0
#else
uniform sampler2D source; //texunit:0
#endif
+/* clang-format on */
+
+#if defined(USE_TEXTURE3D) || defined(USE_TEXTURE2DARRAY)
+uniform float layer;
+#endif
+
#ifdef USE_MULTIPLIER
uniform float multiplier;
#endif
@@ -97,7 +113,6 @@ vec4 texturePanorama(vec3 normal, sampler2D pano) {
#endif
-uniform float stuff;
uniform vec2 pixel_size;
in vec2 uv2_interp;
@@ -147,6 +162,10 @@ void main() {
#elif defined(USE_CUBEMAP)
vec4 color = texture(source_cube, normalize(cube_interp));
+#elif defined(USE_TEXTURE3D)
+ vec4 color = textureLod(source_3d, vec3(uv_interp, layer), 0.0);
+#elif defined(USE_TEXTURE2DARRAY)
+ vec4 color = textureLod(source_2d_array, vec3(uv_interp, layer), 0.0);
#else
vec4 color = textureLod(source, uv_interp, 0.0);
#endif
diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp
index a2883690da..acc7637c0b 100644
--- a/editor/editor_sectioned_inspector.cpp
+++ b/editor/editor_sectioned_inspector.cpp
@@ -241,7 +241,7 @@ void SectionedInspector::update_category_list() {
int sp = pi.name.find("/");
if (sp == -1)
- pi.name = "Global/" + pi.name;
+ pi.name = "global/" + pi.name;
Vector<String> sectionarr = pi.name.split("/");
String metasection;
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp
index 1b99059f32..88672bdf34 100644
--- a/editor/plugin_config_dialog.cpp
+++ b/editor/plugin_config_dialog.cpp
@@ -65,11 +65,16 @@ void PluginConfigDialog::_on_confirmed() {
cf->save(path.plus_file("plugin.cfg"));
if (!_edit_mode) {
- String type = script_option_edit->get_item_text(script_option_edit->get_selected());
+ int lang_idx = script_option_edit->get_selected();
+ String lang_name = ScriptServer::get_language(lang_idx)->get_name();
Ref<Script> script;
- if (type == GDScriptLanguage::get_singleton()->get_name()) {
+ // TODO Use script templates. Right now, this code won't add the 'tool' annotation to other languages.
+ // TODO Better support script languages with named classes (has_named_classes).
+
+ if (lang_name == GDScriptLanguage::get_singleton()->get_name()) {
+ // Hard-coded GDScript template to keep usability until we use script templates.
Ref<GDScript> gdscript = memnew(GDScript);
gdscript->set_source_code(
"tool\n"
@@ -84,8 +89,13 @@ void PluginConfigDialog::_on_confirmed() {
gdscript->set_path(script_path);
ResourceSaver::save(script_path, gdscript);
script = gdscript;
+ } else {
+ String script_path = path.plus_file(script_edit->get_text());
+ String class_name = script_path.get_file().get_basename();
+ script = ScriptServer::get_language(lang_idx)->get_template(class_name, "EditorPlugin");
+ script->set_path(script_path);
+ ResourceSaver::save(script_path, script);
}
- //TODO: other languages
emit_signal("plugin_ready", script.operator->(), active_edit->is_pressed() ? subfolder_edit->get_text() : "");
} else {
@@ -98,8 +108,9 @@ void PluginConfigDialog::_on_cancelled() {
_clear_fields();
}
-void PluginConfigDialog::_on_required_text_changed(const String &p_text) {
- String ext = script_option_edit->get_item_metadata(script_option_edit->get_selected());
+void PluginConfigDialog::_on_required_text_changed(const String &) {
+ int lang_idx = script_option_edit->get_selected();
+ String ext = ScriptServer::get_language(lang_idx)->get_extension();
get_ok()->set_disabled(script_edit->get_text().get_basename().empty() || script_edit->get_text().get_extension() != ext || name_edit->get_text().empty());
}
@@ -204,10 +215,11 @@ PluginConfigDialog::PluginConfigDialog() {
grid->add_child(script_option_lb);
script_option_edit = memnew(OptionButton);
- script_option_edit->add_item(GDScriptLanguage::get_singleton()->get_name());
- script_option_edit->set_item_metadata(0, GDScriptLanguage::get_singleton()->get_extension());
+ for (int i = 0; i < ScriptServer::get_language_count(); i++) {
+ ScriptLanguage *lang = ScriptServer::get_language(i);
+ script_option_edit->add_item(lang->get_name());
+ }
script_option_edit->select(0);
- //TODO: add other languages
grid->add_child(script_option_edit);
Label *script_lb = memnew(Label);
@@ -219,6 +231,7 @@ PluginConfigDialog::PluginConfigDialog() {
script_edit->set_placeholder("\"plugin.gd\" -> res://addons/my_plugin/plugin.gd");
grid->add_child(script_edit);
+ // TODO Make this option work better with languages like C#. Right now, it does not work because the C# project must be compiled first.
Label *active_lb = memnew(Label);
active_lb->set_text(TTR("Activate now?"));
grid->add_child(active_lb);
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 02f6263887..2913c4ce56 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -474,7 +474,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
if (canvas_item && canvas_item->is_visible_in_tree()) {
Transform2D xform = (p_parent_xform * p_canvas_xform * canvas_item->get_transform()).affine_inverse();
- const real_t local_grab_distance = xform.basis_xform(Vector2(grab_distance, 0)).length();
+ const real_t local_grab_distance = xform.basis_xform(Vector2(grab_distance, 0)).length() / zoom;
if (canvas_item->_edit_is_selected_on_click(xform.xform(p_pos), local_grab_distance)) {
Node2D *node = Object::cast_to<Node2D>(canvas_item);
diff --git a/main/main.cpp b/main/main.cpp
index b94130002d..f9044b61cd 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1789,9 +1789,9 @@ uint64_t Main::target_ticks = 0;
uint32_t Main::frames = 0;
uint32_t Main::frame = 0;
bool Main::force_redraw_requested = false;
-bool Main::iterating = false;
+int Main::iterating = 0;
bool Main::is_iterating() {
- return iterating;
+ return iterating > 0;
}
// For performance metrics
@@ -1800,9 +1800,10 @@ static uint64_t idle_process_max = 0;
bool Main::iteration() {
- ERR_FAIL_COND_V(iterating, false);
+ //for now do not error on this
+ //ERR_FAIL_COND_V(iterating, false);
- iterating = true;
+ iterating++;
uint64_t ticks = OS::get_singleton()->get_ticks_usec();
Engine::get_singleton()->_frame_ticks = ticks;
@@ -1931,7 +1932,7 @@ bool Main::iteration() {
frames = 0;
}
- iterating = false;
+ iterating--;
if (fixed_fps != -1)
return exit;
diff --git a/main/main.h b/main/main.h
index 1bdce7d17f..694305526a 100644
--- a/main/main.h
+++ b/main/main.h
@@ -47,7 +47,7 @@ class Main {
static uint32_t frames;
static uint32_t frame;
static bool force_redraw_requested;
- static bool iterating;
+ static int iterating;
public:
static bool is_project_manager();
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 9d263aa5e1..ae70525de5 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -642,7 +642,8 @@ Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p
if (E) {
if (!E->get()->is_static()) {
- WARN_PRINT(String("Can't call non-static function: '" + String(p_method) + "' in script.").utf8().get_data());
+ ERR_EXPLAIN("Can't call non-static function: '" + String(p_method) + "' in script.");
+ ERR_FAIL_V(Variant());
}
return E->get()->call(NULL, p_args, p_argcount, r_error);
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index a012ccad30..af189fdb7e 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -811,6 +811,21 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
expr = constant;
bfn = true;
}
+
+ // Check parents for the constant
+ if (!bfn && cln->extends_file != StringName()) {
+ Ref<GDScript> parent = ResourceLoader::load(cln->extends_file);
+ if (parent.is_valid() && parent->is_valid()) {
+ Map<StringName, Variant> parent_constants;
+ parent->get_constants(&parent_constants);
+ if (parent_constants.has(identifier)) {
+ ConstantNode *constant = alloc_node<ConstantNode>();
+ constant->value = parent_constants[identifier];
+ expr = constant;
+ bfn = true;
+ }
+ }
+ }
}
if (!bfn) {
@@ -4667,7 +4682,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
}
#ifdef TOOLS_ENABLED
- if (subexpr->type == Node::TYPE_CONSTANT && member._export.type != Variant::NIL) {
+ if (subexpr->type == Node::TYPE_CONSTANT && (member._export.type != Variant::NIL || member.data_type.has_type)) {
ConstantNode *cn = static_cast<ConstantNode *>(subexpr);
if (cn->value.get_type() != Variant::NIL) {
@@ -5438,6 +5453,12 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source,
// Inner classes
ClassNode *outer_class = p;
while (outer_class) {
+ if (outer_class->name == id) {
+ found = true;
+ result.kind = DataType::CLASS;
+ result.class_type = outer_class;
+ break;
+ }
for (int i = 0; i < outer_class->subclasses.size(); i++) {
if (outer_class->subclasses[i] == p) {
continue;
@@ -7277,7 +7298,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
DataType cont = _resolve_type(c.type, c.expression->line);
DataType expr = _resolve_type(c.expression->get_datatype(), c.expression->line);
- if (!_is_type_compatible(cont, expr)) {
+ if (check_types && !_is_type_compatible(cont, expr)) {
_set_error("Constant value type (" + expr.to_string() + ") is not compatible with declared type (" + cont.to_string() + ").",
c.expression->line);
return;
@@ -7321,7 +7342,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
if (v.expression) {
DataType expr_type = _reduce_node_type(v.expression);
- if (!_is_type_compatible(v.data_type, expr_type)) {
+ if (check_types && !_is_type_compatible(v.data_type, expr_type)) {
// Try supertype test
if (_is_type_compatible(expr_type, v.data_type)) {
_mark_line_as_unsafe(v.line);
@@ -7783,7 +7804,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
return;
}
- if (!lh_type.has_type) {
+ if (!lh_type.has_type && check_types) {
if (op->arguments[0]->type == Node::TYPE_OPERATOR) {
_mark_line_as_unsafe(op->line);
}
@@ -7805,7 +7826,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
bool valid = false;
rh_type = _get_operation_type(oper, lh_type, arg_type, valid);
- if (!valid) {
+ if (check_types && !valid) {
_set_error("Invalid operand types ('" + lh_type.to_string() + "' and '" + arg_type.to_string() +
"') to assignment operator '" + Variant::get_operator_name(oper) + "'.",
op->line);
@@ -7828,7 +7849,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
}
#endif // DEBUG_ENABLED
- if (!_is_type_compatible(lh_type, rh_type)) {
+ if (check_types && !_is_type_compatible(lh_type, rh_type)) {
// Try supertype test
if (_is_type_compatible(rh_type, lh_type)) {
_mark_line_as_unsafe(op->line);
@@ -7864,9 +7885,11 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
#endif // DEBUG_ENABLED
}
}
+#ifdef DEBUG_ENABLED
if (!rh_type.has_type && (op->op != OperatorNode::OP_ASSIGN || lh_type.has_type || op->arguments[0]->type == Node::TYPE_OPERATOR)) {
_mark_line_as_unsafe(op->line);
}
+#endif // DEBUG_ENABLED
} break;
case OperatorNode::OP_CALL:
case OperatorNode::OP_PARENT_CALL: {
@@ -8103,7 +8126,6 @@ Error GDScriptParser::_parse(const String &p_base_path) {
check_types = false;
#endif
-#ifdef DEBUG_ENABLED
// Resolve all class-level stuff before getting into function blocks
_check_class_level_types(main_class);
@@ -8118,6 +8140,8 @@ Error GDScriptParser::_parse(const String &p_base_path) {
return ERR_PARSE_ERROR;
}
+#ifdef DEBUG_ENABLED
+
// Resolve warning ignores
Vector<Pair<int, String> > warning_skips = tokenizer->get_warning_skips();
bool warning_is_error = GLOBAL_GET("debug/gdscript/warnings/treat_warnings_as_errors").booleanize();
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index e14db9a201..0662bc2edc 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -208,8 +208,8 @@ def configure_msvc(env, manual_msvc_config):
'RTAUDIO_ENABLED', 'WASAPI_ENABLED',
'WINMIDI_ENABLED', 'TYPED_METHOD_BIND',
'WIN32', 'MSVC',
- 'WINVER=$target_win_version',
- '_WIN32_WINNT=$target_win_version'])
+ 'WINVER=%s' % env["target_win_version"],
+ '_WIN32_WINNT=%s' % env["target_win_version"]])
env.AppendUnique(CPPDEFINES=['NOMINMAX']) # disable bogus min/max WinDef.h macros
if env["bits"] == "64":
env.AppendUnique(CPPDEFINES=['_WIN64'])
@@ -218,7 +218,7 @@ def configure_msvc(env, manual_msvc_config):
LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32',
'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32',
- 'shell32', 'advapi32', 'dinput8', 'dxguid', 'imm32', 'bcrypt']
+ 'shell32', 'advapi32', 'dinput8', 'dxguid', 'imm32', 'bcrypt','Avrt']
env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
if manual_msvc_config:
@@ -329,7 +329,7 @@ def configure_mingw(env):
env.Append(CCFLAGS=['-DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
env.Append(CCFLAGS=['-DWINVER=%s' % env['target_win_version'], '-D_WIN32_WINNT=%s' % env['target_win_version']])
- env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt'])
+ env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt','avrt'])
env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index d1693cb0b4..35f9d541ef 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -50,6 +50,7 @@
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
#include "windows_terminal_logger.h"
+#include <avrt.h>
#include <process.h>
#include <regstr.h>
@@ -804,6 +805,13 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
gr_mem = alt_mem;
}
+ if (mouse_mode == MOUSE_MODE_CAPTURED) {
+ // When SetCapture is used, ALT+F4 hotkey is ignored by Windows, so handle it ourselves
+ if (wParam == VK_F4 && alt_mem && (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN)) {
+ if (main_loop)
+ main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
+ }
+ }
/*
if (wParam==VK_WIN) TODO wtf is this?
meta_mem=uMsg==WM_KEYDOWN;
@@ -1373,6 +1381,19 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
set_ime_active(false);
+ if (!OS::get_singleton()->is_in_low_processor_usage_mode()) {
+ //SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);
+ SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);
+ DWORD index = 0;
+ HANDLE handle = AvSetMmThreadCharacteristics("Games", &index);
+ if (handle)
+ AvSetMmThreadPriority(handle, AVRT_PRIORITY_CRITICAL);
+
+ // This is needed to make sure that background work does not starve the main thread.
+ // This is only setting priority of this thread, not the whole process.
+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
+ }
+
return OK;
}
@@ -2321,6 +2342,9 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
iconinfo.hbmMask = hAndMask;
iconinfo.hbmColor = hXorMask;
+ if (cursors[p_shape])
+ DestroyIcon(cursors[p_shape]);
+
cursors[p_shape] = CreateIconIndirect(&iconinfo);
if (p_shape == cursor_shape) {
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 6ed008cf9c..dced688899 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -434,6 +434,11 @@ void CanvasItem::hide() {
_change_notify("visible");
}
+CanvasItem *CanvasItem::current_item_drawn = NULL;
+CanvasItem *CanvasItem::get_current_item_drawn() {
+ return current_item_drawn;
+}
+
void CanvasItem::_update_callback() {
if (!is_inside_tree()) {
@@ -449,11 +454,13 @@ void CanvasItem::_update_callback() {
first_draw = false;
}
drawing = true;
+ current_item_drawn = this;
notification(NOTIFICATION_DRAW);
emit_signal(SceneStringNames::get_singleton()->draw);
if (get_script_instance()) {
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw, NULL, 0);
}
+ current_item_drawn = NULL;
drawing = false;
}
//todo updating = false
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index a02e792cf2..bf7cfa8e75 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -222,6 +222,8 @@ private:
void _set_on_top(bool p_on_top) { set_draw_behind_parent(!p_on_top); }
bool _is_on_top() const { return !is_draw_behind_parent_enabled(); }
+ static CanvasItem *current_item_drawn;
+
protected:
_FORCE_INLINE_ void _notify_transform() {
if (!is_inside_tree()) return;
@@ -324,6 +326,8 @@ public:
void draw_set_transform(const Point2 &p_offset, float p_rot, const Size2 &p_scale);
void draw_set_transform_matrix(const Transform2D &p_matrix);
+ static CanvasItem *get_current_item_drawn();
+
/* RECT / TRANSFORM */
void set_as_toplevel(bool p_toplevel);
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 22da51ac30..50abbd483a 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -188,7 +188,7 @@ PhysicsBody::PhysicsBody(PhysicsServer::BodyMode p_mode) :
#ifndef DISABLE_DEPRECATED
void StaticBody::set_friction(real_t p_friction) {
- if (p_friction == 1.0) { // default value, don't create an override for that
+ if (p_friction == 1.0 && physics_material_override.is_null()) { // default value, don't create an override for that
return;
}
@@ -218,7 +218,7 @@ real_t StaticBody::get_friction() const {
void StaticBody::set_bounce(real_t p_bounce) {
- if (p_bounce == 0.0) { // default value, don't create an override for that
+ if (p_bounce == 0.0 && physics_material_override.is_null()) { // default value, don't create an override for that
return;
}
@@ -632,7 +632,7 @@ real_t RigidBody::get_weight() const {
#ifndef DISABLE_DEPRECATED
void RigidBody::set_friction(real_t p_friction) {
- if (p_friction == 1.0) { // default value, don't create an override for that
+ if (p_friction == 1.0 && physics_material_override.is_null()) { // default value, don't create an override for that
return;
}
@@ -661,7 +661,7 @@ real_t RigidBody::get_friction() const {
void RigidBody::set_bounce(real_t p_bounce) {
- if (p_bounce == 0.0) { // default value, don't create an override for that
+ if (p_bounce == 0.0 && physics_material_override.is_null()) { // default value, don't create an override for that
return;
}
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index a6b4d475ba..806c8afa5b 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -82,16 +82,16 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce);
}
- emit_signal("pressed");
_unpress_group();
+ emit_signal("pressed");
} else {
status.pressed = !status.pressed;
pressed();
- emit_signal("pressed");
_unpress_group();
+ emit_signal("pressed");
toggled(status.pressed);
if (get_script_instance()) {
@@ -135,6 +135,7 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce);
}
+ _unpress_group();
emit_signal("pressed");
} else {
@@ -142,6 +143,7 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
status.pressed = !status.pressed;
pressed();
+ _unpress_group();
emit_signal("pressed");
toggled(status.pressed);
@@ -150,8 +152,6 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
}
emit_signal("toggled", status.pressed);
}
-
- _unpress_group();
}
status.press_attempt = false;
@@ -215,12 +215,14 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce);
}
+ _unpress_group();
emit_signal("pressed");
} else {
status.pressed = !status.pressed;
pressed();
+ _unpress_group();
emit_signal("pressed");
toggled(status.pressed);
@@ -229,8 +231,6 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
}
emit_signal("toggled", status.pressed);
}
-
- _unpress_group();
}
accept_event();
diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp
index 35e8e984cd..cc37d4cf7d 100644
--- a/scene/gui/box_container.cpp
+++ b/scene/gui/box_container.cpp
@@ -255,6 +255,10 @@ void BoxContainer::_notification(int p_what) {
_resort();
} break;
+ case NOTIFICATION_THEME_CHANGED: {
+
+ minimum_size_changed();
+ } break;
}
}
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 7c879d239c..8c588109d6 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -192,97 +192,104 @@ bool GraphNode::has_point(const Point2 &p_point) const {
void GraphNode::_notification(int p_what) {
- if (p_what == NOTIFICATION_DRAW) {
+ switch (p_what) {
+ case NOTIFICATION_DRAW: {
- Ref<StyleBox> sb;
+ Ref<StyleBox> sb;
- if (comment) {
- sb = get_stylebox(selected ? "commentfocus" : "comment");
+ if (comment) {
+ sb = get_stylebox(selected ? "commentfocus" : "comment");
- } else {
+ } else {
- sb = get_stylebox(selected ? "selectedframe" : "frame");
- }
+ sb = get_stylebox(selected ? "selectedframe" : "frame");
+ }
- //sb=sb->duplicate();
- //sb->call("set_modulate",modulate);
- Ref<Texture> port = get_icon("port");
- Ref<Texture> close = get_icon("close");
- Ref<Texture> resizer = get_icon("resizer");
- int close_offset = get_constant("close_offset");
- int close_h_offset = get_constant("close_h_offset");
- Color close_color = get_color("close_color");
- Ref<Font> title_font = get_font("title_font");
- int title_offset = get_constant("title_offset");
- int title_h_offset = get_constant("title_h_offset");
- Color title_color = get_color("title_color");
- Point2i icofs = -port->get_size() * 0.5;
- int edgeofs = get_constant("port_offset");
- icofs.y += sb->get_margin(MARGIN_TOP);
-
- draw_style_box(sb, Rect2(Point2(), get_size()));
-
- switch (overlay) {
- case OVERLAY_DISABLED: {
-
- } break;
- case OVERLAY_BREAKPOINT: {
-
- draw_style_box(get_stylebox("breakpoint"), Rect2(Point2(), get_size()));
- } break;
- case OVERLAY_POSITION: {
- draw_style_box(get_stylebox("position"), Rect2(Point2(), get_size()));
-
- } break;
- }
+ //sb=sb->duplicate();
+ //sb->call("set_modulate",modulate);
+ Ref<Texture> port = get_icon("port");
+ Ref<Texture> close = get_icon("close");
+ Ref<Texture> resizer = get_icon("resizer");
+ int close_offset = get_constant("close_offset");
+ int close_h_offset = get_constant("close_h_offset");
+ Color close_color = get_color("close_color");
+ Ref<Font> title_font = get_font("title_font");
+ int title_offset = get_constant("title_offset");
+ int title_h_offset = get_constant("title_h_offset");
+ Color title_color = get_color("title_color");
+ Point2i icofs = -port->get_size() * 0.5;
+ int edgeofs = get_constant("port_offset");
+ icofs.y += sb->get_margin(MARGIN_TOP);
+
+ draw_style_box(sb, Rect2(Point2(), get_size()));
+
+ switch (overlay) {
+ case OVERLAY_DISABLED: {
+
+ } break;
+ case OVERLAY_BREAKPOINT: {
+
+ draw_style_box(get_stylebox("breakpoint"), Rect2(Point2(), get_size()));
+ } break;
+ case OVERLAY_POSITION: {
+ draw_style_box(get_stylebox("position"), Rect2(Point2(), get_size()));
+
+ } break;
+ }
- int w = get_size().width - sb->get_minimum_size().x;
+ int w = get_size().width - sb->get_minimum_size().x;
- if (show_close)
- w -= close->get_width();
+ if (show_close)
+ w -= close->get_width();
- draw_string(title_font, Point2(sb->get_margin(MARGIN_LEFT) + title_h_offset, -title_font->get_height() + title_font->get_ascent() + title_offset), title, title_color, w);
- if (show_close) {
- Vector2 cpos = Point2(w + sb->get_margin(MARGIN_LEFT) + close_h_offset, -close->get_height() + close_offset);
- draw_texture(close, cpos, close_color);
- close_rect.position = cpos;
- close_rect.size = close->get_size();
- } else {
- close_rect = Rect2();
- }
+ draw_string(title_font, Point2(sb->get_margin(MARGIN_LEFT) + title_h_offset, -title_font->get_height() + title_font->get_ascent() + title_offset), title, title_color, w);
+ if (show_close) {
+ Vector2 cpos = Point2(w + sb->get_margin(MARGIN_LEFT) + close_h_offset, -close->get_height() + close_offset);
+ draw_texture(close, cpos, close_color);
+ close_rect.position = cpos;
+ close_rect.size = close->get_size();
+ } else {
+ close_rect = Rect2();
+ }
- for (Map<int, Slot>::Element *E = slot_info.front(); E; E = E->next()) {
-
- if (E->key() < 0 || E->key() >= cache_y.size())
- continue;
- if (!slot_info.has(E->key()))
- continue;
- const Slot &s = slot_info[E->key()];
- //left
- if (s.enable_left) {
- Ref<Texture> p = port;
- if (s.custom_slot_left.is_valid()) {
- p = s.custom_slot_left;
+ for (Map<int, Slot>::Element *E = slot_info.front(); E; E = E->next()) {
+
+ if (E->key() < 0 || E->key() >= cache_y.size())
+ continue;
+ if (!slot_info.has(E->key()))
+ continue;
+ const Slot &s = slot_info[E->key()];
+ //left
+ if (s.enable_left) {
+ Ref<Texture> p = port;
+ if (s.custom_slot_left.is_valid()) {
+ p = s.custom_slot_left;
+ }
+ p->draw(get_canvas_item(), icofs + Point2(edgeofs, cache_y[E->key()]), s.color_left);
}
- p->draw(get_canvas_item(), icofs + Point2(edgeofs, cache_y[E->key()]), s.color_left);
- }
- if (s.enable_right) {
- Ref<Texture> p = port;
- if (s.custom_slot_right.is_valid()) {
- p = s.custom_slot_right;
+ if (s.enable_right) {
+ Ref<Texture> p = port;
+ if (s.custom_slot_right.is_valid()) {
+ p = s.custom_slot_right;
+ }
+ p->draw(get_canvas_item(), icofs + Point2(get_size().x - edgeofs, cache_y[E->key()]), s.color_right);
}
- p->draw(get_canvas_item(), icofs + Point2(get_size().x - edgeofs, cache_y[E->key()]), s.color_right);
}
- }
- if (resizable) {
- draw_texture(resizer, get_size() - resizer->get_size());
- }
- }
+ if (resizable) {
+ draw_texture(resizer, get_size() - resizer->get_size());
+ }
+ } break;
+
+ case NOTIFICATION_SORT_CHILDREN: {
+
+ _resort();
+ } break;
- if (p_what == NOTIFICATION_SORT_CHILDREN) {
+ case NOTIFICATION_THEME_CHANGED: {
- _resort();
+ minimum_size_changed();
+ } break;
}
}
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index b37d08de71..d0e2edc7b5 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -164,6 +164,10 @@ void GridContainer::_notification(int p_what) {
}
} break;
+ case NOTIFICATION_THEME_CHANGED: {
+
+ minimum_size_changed();
+ } break;
}
}
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index a087b68d25..62ba45c484 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -64,27 +64,33 @@ Size2 MarginContainer::get_minimum_size() const {
void MarginContainer::_notification(int p_what) {
- if (p_what == NOTIFICATION_SORT_CHILDREN) {
+ switch (p_what) {
+ case NOTIFICATION_SORT_CHILDREN: {
- int margin_left = get_constant("margin_left");
- int margin_top = get_constant("margin_top");
- int margin_right = get_constant("margin_right");
- int margin_bottom = get_constant("margin_bottom");
+ int margin_left = get_constant("margin_left");
+ int margin_top = get_constant("margin_top");
+ int margin_right = get_constant("margin_right");
+ int margin_bottom = get_constant("margin_bottom");
- Size2 s = get_size();
+ Size2 s = get_size();
- for (int i = 0; i < get_child_count(); i++) {
+ for (int i = 0; i < get_child_count(); i++) {
- Control *c = Object::cast_to<Control>(get_child(i));
- if (!c)
- continue;
- if (c->is_set_as_toplevel())
- continue;
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
- int w = s.width - margin_left - margin_right;
- int h = s.height - margin_top - margin_bottom;
- fit_child_in_rect(c, Rect2(margin_left, margin_top, w, h));
- }
+ int w = s.width - margin_left - margin_right;
+ int h = s.height - margin_top - margin_bottom;
+ fit_child_in_rect(c, Rect2(margin_left, margin_top, w, h));
+ }
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
+
+ minimum_size_changed();
+ } break;
}
}
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index e7564bbf73..2195ec9778 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -92,5 +92,6 @@ void ProgressBar::_bind_methods() {
ProgressBar::ProgressBar() {
set_v_size_flags(0);
+ set_step(0.01);
percent_visible = true;
}
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index e4cb2a06fc..d6a93238b2 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -193,6 +193,10 @@ void SplitContainer::_notification(int p_what) {
draw_texture(tex, Point2i(middle_sep + (sep - tex->get_width()) / 2, (size.y - tex->get_height()) / 2));
}
} break;
+ case NOTIFICATION_THEME_CHANGED: {
+
+ minimum_size_changed();
+ } break;
}
}
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index b4fe6b0255..212efa4976 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -338,6 +338,7 @@ void TabContainer::_notification(int p_what) {
}
} break;
case NOTIFICATION_THEME_CHANGED: {
+ minimum_size_changed();
call_deferred("_on_theme_changed"); //wait until all changed theme
} break;
}
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 5660f0a1b9..fd7b67a218 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -1009,7 +1009,7 @@ void DynamicFont::_bind_methods() {
ADD_GROUP("Settings", "");
ADD_PROPERTY(PropertyInfo(Variant::INT, "size"), "set_size", "get_size");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "outline_size"), "set_outline_size", "get_outline_size");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "outline_size", PROPERTY_HINT_RANGE, "0,255,1"), "set_outline_size", "get_outline_size");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "outline_color"), "set_outline_color", "get_outline_color");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_mipmaps"), "set_use_mipmaps", "get_use_mipmaps");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_filter"), "set_use_filter", "get_use_filter");
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index db7153e9ad..affe9a3e24 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -29,6 +29,8 @@
/*************************************************************************/
#include "style_box.h"
+#include "scene/2d/canvas_item.h"
+
#include <limits.h>
bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const {
@@ -54,6 +56,10 @@ float StyleBox::get_margin(Margin p_margin) const {
return margin[p_margin];
}
+CanvasItem *StyleBox::get_current_item_drawn() const {
+ return CanvasItem::get_current_item_drawn();
+}
+
Size2 StyleBox::get_minimum_size() const {
return Size2(get_margin(MARGIN_LEFT) + get_margin(MARGIN_RIGHT), get_margin(MARGIN_TOP) + get_margin(MARGIN_BOTTOM));
@@ -83,6 +89,7 @@ void StyleBox::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_minimum_size"), &StyleBox::get_minimum_size);
ClassDB::bind_method(D_METHOD("get_center_size"), &StyleBox::get_center_size);
ClassDB::bind_method(D_METHOD("get_offset"), &StyleBox::get_offset);
+ ClassDB::bind_method(D_METHOD("get_current_item_drawn"), &StyleBox::get_current_item_drawn);
ClassDB::bind_method(D_METHOD("draw", "canvas_item", "rect"), &StyleBox::draw);
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 911a457990..9062270765 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -37,6 +37,8 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+class CanvasItem;
+
class StyleBox : public Resource {
GDCLASS(StyleBox, Resource);
@@ -58,6 +60,8 @@ public:
virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const = 0;
+ CanvasItem *get_current_item_drawn() const;
+
Size2 get_minimum_size() const;
Point2 get_offset() const;
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 1684cbf15f..2116dd0b1e 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -1021,8 +1021,6 @@ void SurfaceTool::_bind_methods() {
ClassDB::bind_method(D_METHOD("generate_normals", "flip"), &SurfaceTool::generate_normals, DEFVAL(false));
ClassDB::bind_method(D_METHOD("generate_tangents"), &SurfaceTool::generate_tangents);
- ClassDB::bind_method(D_METHOD("add_to_format", "flags"), &SurfaceTool::add_to_format);
-
ClassDB::bind_method(D_METHOD("set_material", "material"), &SurfaceTool::set_material);
ClassDB::bind_method(D_METHOD("clear"), &SurfaceTool::clear);
diff --git a/scene/resources/surface_tool.h b/scene/resources/surface_tool.h
index 754254150d..ef13238c13 100644
--- a/scene/resources/surface_tool.h
+++ b/scene/resources/surface_tool.h
@@ -118,8 +118,6 @@ public:
void generate_normals(bool p_flip = false);
void generate_tangents();
- void add_to_format(int p_flags) { format |= p_flags; }
-
void set_material(const Ref<Material> &p_material);
void clear();
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 4984af57b5..3870916779 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -185,6 +185,7 @@ void ImageTexture::create(int p_width, int p_height, Image::Format p_format, uin
format = p_format;
w = p_width;
h = p_height;
+ _change_notify();
}
void ImageTexture::create_from_image(const Ref<Image> &p_image, uint32_t p_flags) {
@@ -211,6 +212,7 @@ void ImageTexture::set_flags(uint32_t p_flags) {
return; //uninitialized, do not set to texture
}
VisualServer::get_singleton()->texture_set_flags(texture, p_flags);
+ _change_notify("flags");
}
uint32_t ImageTexture::get_flags() const {
@@ -712,6 +714,7 @@ Error StreamTexture::load(const String &p_path) {
path_to_file = p_path;
format = image->get_format();
+ _change_notify();
return OK;
}
String StreamTexture::get_load_path() const {
@@ -801,6 +804,7 @@ bool StreamTexture::is_pixel_opaque(int p_x, int p_y) const {
void StreamTexture::set_flags(uint32_t p_flags) {
flags = p_flags;
VS::get_singleton()->texture_set_flags(texture, flags);
+ _change_notify("flags");
}
void StreamTexture::reload_from_file() {
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 186f183ea2..738835c70a 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -202,6 +202,9 @@ Files extracted from upstream source:
- all .h files in include/theora/ as theora/
- COPYING and LICENSE
+Upstream patches included in the `patches` directory have been applied
+on top of the 1.1.1 source (not included in any stable release yet).
+
## libvorbis
diff --git a/thirdparty/libtheora/decode.c b/thirdparty/libtheora/decode.c
index 7be66463d8..bde967b794 100644
--- a/thirdparty/libtheora/decode.c
+++ b/thirdparty/libtheora/decode.c
@@ -397,10 +397,10 @@ static int oc_dec_init(oc_dec_ctx *_dec,const th_info *_info,
int qsum;
qsum=0;
for(qti=0;qti<2;qti++)for(pli=0;pli<3;pli++){
- qsum+=_dec->state.dequant_tables[qti][pli][qi][12]+
- _dec->state.dequant_tables[qti][pli][qi][17]+
- _dec->state.dequant_tables[qti][pli][qi][18]+
- _dec->state.dequant_tables[qti][pli][qi][24]<<(pli==0);
+ qsum+=_dec->state.dequant_tables[qi][pli][qti][12]+
+ _dec->state.dequant_tables[qi][pli][qti][17]+
+ _dec->state.dequant_tables[qi][pli][qti][18]+
+ _dec->state.dequant_tables[qi][pli][qti][24]<<(pli==0);
}
_dec->pp_sharp_mod[qi]=-(qsum>>11);
}
diff --git a/thirdparty/libtheora/patches/theora.git-0ae66d565e6bead8604d312bc1a4e9dccf245c88.patch b/thirdparty/libtheora/patches/theora.git-0ae66d565e6bead8604d312bc1a4e9dccf245c88.patch
new file mode 100644
index 0000000000..1b9c8e20be
--- /dev/null
+++ b/thirdparty/libtheora/patches/theora.git-0ae66d565e6bead8604d312bc1a4e9dccf245c88.patch
@@ -0,0 +1,38 @@
+From 0ae66d565e6bead8604d312bc1a4e9dccf245c88 Mon Sep 17 00:00:00 2001
+From: Tim Terriberry <tterribe@xiph.org>
+Date: Tue, 8 May 2012 02:51:57 +0000
+Subject: [PATCH] Fix pp_sharp_mod calculation.
+
+This was broken when the dequant_tables indexing changed in commit
+ r16102, but it only affected post-processing quality, so we never
+ noticed.
+With gcc 4.8.0, this can now trigger a segfault during decoder
+ initialization.
+
+svn path=/trunk/theora/; revision=18268
+---
+ decode.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/decode.c b/decode.c
+index b803505..9f2516a 100644
+--- a/decode.c
++++ b/decode.c
+@@ -400,10 +400,10 @@ static int oc_dec_init(oc_dec_ctx *_dec,const th_info *_info,
+ int qsum;
+ qsum=0;
+ for(qti=0;qti<2;qti++)for(pli=0;pli<3;pli++){
+- qsum+=_dec->state.dequant_tables[qti][pli][qi][12]+
+- _dec->state.dequant_tables[qti][pli][qi][17]+
+- _dec->state.dequant_tables[qti][pli][qi][18]+
+- _dec->state.dequant_tables[qti][pli][qi][24]<<(pli==0);
++ qsum+=_dec->state.dequant_tables[qi][pli][qti][12]+
++ _dec->state.dequant_tables[qi][pli][qti][17]+
++ _dec->state.dequant_tables[qi][pli][qti][18]+
++ _dec->state.dequant_tables[qi][pli][qti][24]<<(pli==0);
+ }
+ _dec->pp_sharp_mod[qi]=-(qsum>>11);
+ }
+--
+2.11.0
+