summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CODEOWNERS87
-rw-r--r--doc/classes/AnimatedTexture.xml22
-rw-r--r--doc/classes/EditorSpatialGizmo.xml27
-rw-r--r--doc/classes/EditorSpatialGizmoPlugin.xml21
-rw-r--r--drivers/dummy/rasterizer_dummy.h1
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp7
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp17
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h1
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp8
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp11
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h2
-rw-r--r--editor/editor_inspector.cpp2
-rw-r--r--editor/editor_inspector.h2
-rw-r--r--editor/editor_node.cpp5
-rw-r--r--editor/editor_properties.cpp14
-rw-r--r--editor/editor_resource_preview.cpp1
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp1
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp24
-rw-r--r--editor/plugins/editor_preview_plugins.cpp4
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp13
-rw-r--r--editor/plugins/spatial_editor_plugin.h4
-rw-r--r--editor/spatial_editor_gizmos.cpp44
-rw-r--r--editor/spatial_editor_gizmos.h2
-rw-r--r--modules/bullet/SCsub2
-rw-r--r--modules/gdnative/gdnative/variant.cpp14
-rw-r--r--modules/mono/utils/path_utils.cpp2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp9
-rw-r--r--platform/javascript/os_javascript.cpp5
-rw-r--r--scene/2d/animated_sprite.cpp2
-rw-r--r--scene/2d/light_2d.cpp2
-rw-r--r--scene/animation/animation_node_state_machine.cpp2
-rw-r--r--scene/gui/color_picker.cpp86
-rw-r--r--scene/resources/texture.cpp2
-rw-r--r--servers/visual/rasterizer.h1
-rw-r--r--servers/visual/visual_server_scene.cpp5
-rw-r--r--servers/visual/visual_server_viewport.cpp2
36 files changed, 351 insertions, 103 deletions
diff --git a/CODEOWNERS b/CODEOWNERS
index 27315f2c9d..3a973a100a 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -2,36 +2,57 @@
# Each line is a file pattern followed by one or more owners.
# Owners can be @users, @org/teams or emails
-core/* @reduz
-
-doc/* @godotengine/documentation
-
-drivers/gles2/* @karroffel
-drivers/gles3/* @reduz
-
-editor/icons/* @djrm
-
-main/* @reduz
-
-misc/* @akien-mga
-
-modules/bullet/* @AndreaCatania
-modules/enet/* @godotengine/network
-modules/gdnative/* @karroffel
-modules/gdscript/* @reduz @vnen @bojidar-bg
-modules/mbedtls/* @godotengine/network
-modules/mobile_vr/* @BastiaanOlij
-modules/mono/* @neikeq
-modules/regex/* @LeeZH
-modules/upnp/* @godotengine/network
-modules/websocket/* @godotengine/network
-
-platform/javascript/* @eska014
-platform/uwp/* @vnen
-
-scene/main/* @reduz
-
-server/physics* @reduz @AndreaCatania
-server/visual* @reduz @karroffel
-
-thirdparty/* @akien-mga
+/core/ @reduz
+
+/doc/ @godotengine/documentation
+doc_classes/* @godotengine/documentation
+
+# Rendering
+/drivers/gl_context/ @reduz
+/drivers/gles2/ @reduz
+/drivers/gles3/ @reduz
+
+# Audio
+/drivers/alsa/ @marcelofg55
+/drivers/alsamidi/ @marcelofg55
+/drivers/coreaudio/ @marcelofg55
+/drivers/coremidi/ @marcelofg55
+/drivers/pulseaudio/ @marcelofg55
+/drivers/rtaudio/ @marcelofg55
+/drivers/wasapi/ @marcelofg55
+/drivers/winmidi/ @marcelofg55
+/drivers/xaudio2/ @marcelofg55
+
+# Porting
+/drivers/unix/ @reduz @hpvb
+/drivers/windows/ @reduz @hpvb
+
+/editor/icons/ @djrm
+
+/main/ @reduz
+
+/misc/ @akien-mga
+
+/modules/bullet/ @AndreaCatania
+/modules/csg/ @reduz @BastiaanOlij
+/modules/enet/ @godotengine/network
+/modules/gdnative/ @karroffel
+/modules/gdnative/*arvr/ @BastiaanOlij
+/modules/gdscript/ @reduz @vnen @bojidar-bg
+/modules/mbedtls/ @godotengine/network
+/modules/mobile_vr/ @BastiaanOlij
+/modules/mono/ @neikeq
+/modules/opensimplex/ @JFonS
+/modules/regex/ @LeeZH
+/modules/upnp/ @godotengine/network
+/modules/websocket/ @godotengine/network
+
+/platform/javascript/ @eska014
+/platform/uwp/ @vnen
+
+/scene/main/ @reduz
+
+/server/physics*/ @reduz @AndreaCatania
+/server/visual*/ @reduz @karroffel
+
+/thirdparty/ @akien-mga
diff --git a/doc/classes/AnimatedTexture.xml b/doc/classes/AnimatedTexture.xml
index 9dc58ed195..08cd79e78f 100644
--- a/doc/classes/AnimatedTexture.xml
+++ b/doc/classes/AnimatedTexture.xml
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AnimatedTexture" inherits="Texture" category="Core" version="3.1">
<brief_description>
+ Proxy texture for simple frame-based animations.
</brief_description>
<description>
+ [code]AnimatedTexture[/code] is a resource format for simple frame-based animations, where multiple frames textures can be chained automatically with a predefined delay for each frame. It's not a [Node], contrarily to [AnimationPlayer] or [AnimatedSprite], but has the advantage of being usable at any place where a [Texture] resource can be used, e.g. in a [TileSet].
+ The playback of the animation is controlled by the [member fps] property as well as each frame's optional delay (see [method set_frame_delay]). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame.
+ [code]AnimatedTexture[/code] currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one.
</description>
<tutorials>
</tutorials>
@@ -15,6 +19,7 @@
<argument index="0" name="frame" type="int">
</argument>
<description>
+ Retrieves the delayed assigned to the given [code]frame[/code] ID.
</description>
</method>
<method name="get_frame_texture" qualifiers="const">
@@ -23,6 +28,7 @@
<argument index="0" name="frame" type="int">
</argument>
<description>
+ Retrieves the [Texture] assigned to the given [code]frame[/code] ID.
</description>
</method>
<method name="set_frame_delay">
@@ -33,6 +39,14 @@
<argument index="1" name="delay" type="float">
</argument>
<description>
+ Defines an additional delay (in seconds) between this frame and the next one, that will be added to the time interval defined by [member fps]. By default, frames have no delay defined. If a delay value is defined, the final time interval between this frame and the next will be [code]1.0 / fps + delay[/code].
+ For example, for an animation with 3 frames, 2 FPS and a frame delay on the second frame of 1.2, the resulting playback will be:
+ [codeblock]
+ Frame 0: 0.5 s (1 / fps)
+ Frame 1: 1.7 s (1 / fps + 1.2)
+ Frame 2: 0.5 s (1 / fps)
+ Total duration: 2.7 s
+ [/codeblock]
</description>
</method>
<method name="set_frame_texture">
@@ -43,15 +57,23 @@
<argument index="1" name="texture" type="Texture">
</argument>
<description>
+ Assigns a [Texture] to the given [code]frame[/code] ID. IDs start at 0 (so the first frame has ID 0, and the last frame of the animation has ID [member frames] - 1).
+ You can define any frame texture up to [constant MAX_FRAMES], but keep in mind that only frames from 0 to [member frames] - 1 will be part of the animation.
</description>
</method>
</methods>
<members>
<member name="fps" type="float" setter="set_fps" getter="get_fps">
+ Number of frames per second. This value defines the default time interval between two frames of the animation, and thus the overall duration of the animation loop based on the [member frames] property. A value of 0 means no predefined number of frames per second, the animation will play according to each frame's frame delay (see [method set_frame_delay]). Default value: 4.
+ For example, an animation with 8 frames, no frame delay and a [code]fps[/code] value of 2 will run over 4 seconds, with one frame each 0.5 seconds.
</member>
<member name="frames" type="int" setter="set_frames" getter="get_frames">
+ Number of frames to use in the animation. While you can create the frames independently with [method set_frame_texture], you need to set this value for the animation to take new frames into account. The maximum number of frames is [constant MAX_FRAMES]. Default value: 1.
</member>
</members>
<constants>
+ <constant name="MAX_FRAMES" value="256">
+ The maximum number of frames supported by [code]AnimatedTexture[/code]. If you need more frames in your animation, use [AnimationPlayer] or [AnimatedSprite].
+ </constant>
</constants>
</class>
diff --git a/doc/classes/EditorSpatialGizmo.xml b/doc/classes/EditorSpatialGizmo.xml
index c3ecd3c3b7..45b92276f1 100644
--- a/doc/classes/EditorSpatialGizmo.xml
+++ b/doc/classes/EditorSpatialGizmo.xml
@@ -4,7 +4,7 @@
Custom gizmo for editing Spatial objects.
</brief_description>
<description>
- Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. These are created by [method EditorSpatialGizmoPlugin.create_gizmo].
+ Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. See [EditorSpatialGizmoPlugin] for more information.
</description>
<tutorials>
</tutorials>
@@ -116,7 +116,30 @@
<argument index="0" name="index" type="int">
</argument>
<description>
- Get actual value of a handle. This value can be anything and used for eventually undoing the motion when calling [method commit_handle]
+ Get actual value of a handle. This value can be anything and used for eventually undoing the motion when calling [method commit_handle].
+ </description>
+ </method>
+ <method name="get_plugin" qualifiers="const">
+ <return type="EditorSpatialGizmoPlugin">
+ </return>
+ <description>
+ Return the [EditorSpatialGizmoPlugin] that owns this gizmo. It's useful to retrieve materials using [method EditorSpatialGizmoPlugin.get_material].
+ </description>
+ </method>
+ <method name="get_spatial_node" qualifiers="const">
+ <return type="Spatial">
+ </return>
+ <description>
+ Returns the Spatial node associated with this gizmo.
+ </description>
+ </method>
+ <method name="is_handle_highlighted" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <argument index="0" name="index" type="int">
+ </argument>
+ <description>
+ Get whether a handle is highlighted or not.
</description>
</method>
<method name="redraw" qualifiers="virtual">
diff --git a/doc/classes/EditorSpatialGizmoPlugin.xml b/doc/classes/EditorSpatialGizmoPlugin.xml
index 521ec748b3..a62b23ead8 100644
--- a/doc/classes/EditorSpatialGizmoPlugin.xml
+++ b/doc/classes/EditorSpatialGizmoPlugin.xml
@@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorSpatialGizmoPlugin" inherits="Resource" category="Core" version="3.1">
<brief_description>
+ Used by the editor to define Spatial gizmo types.
</brief_description>
<description>
+ EditorSpatialGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorSpatialGizmoPlugin] for the simpler gizmos, or creating a new [EditorSpatialGizmo] type. See the tutorial in the documentation for more info.
</description>
<tutorials>
+ <link>https://docs.godotengine.org/en/latest/tutorials/plugins/editor/spatial_gizmos.html</link>
</tutorials>
<demos>
</demos>
@@ -17,12 +20,14 @@
<argument index="1" name="material" type="SpatialMaterial">
</argument>
<description>
+ Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden.
</description>
</method>
<method name="can_be_hidden" qualifiers="virtual">
<return type="bool">
</return>
<description>
+ Override this method to define whether the gizmo can be hidden or not. Defaults to true.
</description>
</method>
<method name="commit_handle" qualifiers="virtual">
@@ -37,6 +42,7 @@
<argument index="3" name="cancel" type="bool" default="false">
</argument>
<description>
+ Override this method to commit gizmo handles. Called for this plugin's active gizmos.
</description>
</method>
<method name="create_gizmo" qualifiers="virtual">
@@ -45,6 +51,7 @@
<argument index="0" name="spatial" type="Spatial">
</argument>
<description>
+ Override this method to return a custom [EditorSpatialGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. (See also [method has_gizmo])
</description>
</method>
<method name="create_handle_material">
@@ -55,6 +62,7 @@
<argument index="1" name="billboard" type="bool" default="false">
</argument>
<description>
+ Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_handles]. Should not be overridden.
</description>
</method>
<method name="create_icon_material">
@@ -69,6 +77,7 @@
<argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<description>
+ Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_unscaled_billboard]. Should not be overridden.
</description>
</method>
<method name="create_material">
@@ -85,6 +94,7 @@
<argument index="4" name="use_vertex_color" type="bool" default="false">
</argument>
<description>
+ Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_mesh] and [method EditorSpatialGizmo.add_lines]. Should not be overridden.
</description>
</method>
<method name="get_handle_name" qualifiers="virtual">
@@ -95,6 +105,7 @@
<argument index="1" name="index" type="int">
</argument>
<description>
+ Override this method to provide gizmo's handle names. Called for this plugin's active gizmos.
</description>
</method>
<method name="get_handle_value" qualifiers="virtual">
@@ -105,6 +116,7 @@
<argument index="1" name="index" type="int">
</argument>
<description>
+ Get actual value of a handle from gizmo. Called for this plugin's active gizmos.
</description>
</method>
<method name="get_material">
@@ -115,12 +127,14 @@
<argument index="1" name="gizmo" type="EditorSpatialGizmo">
</argument>
<description>
+ Get material from the internal list of materials. If an [EditorSpatialGizmo] is provided it will try to get the corresponding variant (selected and/or editable).
</description>
</method>
<method name="get_name" qualifiers="virtual">
<return type="String">
</return>
<description>
+ Override this method to provide the name that will appear in teh gizmo visibility menu.
</description>
</method>
<method name="has_gizmo" qualifiers="virtual">
@@ -129,9 +143,10 @@
<argument index="0" name="spatial" type="Spatial">
</argument>
<description>
+ Override this method to define which Spatial nodes have a gizmo from this plugin. Whenever a [Spatial] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorSpatialGizmo] assigned and is added to this plugin's list of active gizmos.
</description>
</method>
- <method name="is_gizmo_handle_highlighted" qualifiers="virtual">
+ <method name="is_handle_highlighted" qualifiers="virtual">
<return type="bool">
</return>
<argument index="0" name="gizmo" type="EditorSpatialGizmo">
@@ -139,12 +154,14 @@
<argument index="1" name="index" type="int">
</argument>
<description>
+ Get whether a handle is highlighted or not. Called for this plugin's active gizmos.
</description>
</method>
<method name="is_selectable_when_hidden" qualifiers="virtual">
<return type="bool">
</return>
<description>
+ Override this method to define whether Spatial with this gizmo should be selecteble even when the gizmo is hidden.
</description>
</method>
<method name="redraw" qualifiers="virtual">
@@ -153,6 +170,7 @@
<argument index="0" name="gizmo" type="EditorSpatialGizmo">
</argument>
<description>
+ Callback to redraw the provided gizmo. Called for this plugin's active gizmos.
</description>
</method>
<method name="set_handle" qualifiers="virtual">
@@ -167,6 +185,7 @@
<argument index="3" name="point" type="Vector2">
</argument>
<description>
+ Update the value of a handle after it has been updated. Called for this plugin's active gizmos.
</description>
</method>
</methods>
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index ddc0dd5fa9..214da82819 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -241,6 +241,7 @@ public:
void textures_keep_original(bool p_enable) {}
void texture_set_proxy(RID p_proxy, RID p_base) {}
+ virtual Size2 texture_size_with_proxy(RID p_texture) const { return Size2(); }
void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) {}
/* SKY API */
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 6f686690bf..64e4dbdab4 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -112,9 +112,11 @@ void RasterizerCanvasGLES2::_set_uniforms() {
void RasterizerCanvasGLES2::canvas_begin() {
state.canvas_shader.bind();
+ bool transparent = false;
if (storage->frame.current_rt) {
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
glColorMask(1, 1, 1, 1);
+ transparent = storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT];
}
if (storage->frame.clear_request) {
@@ -122,11 +124,13 @@ void RasterizerCanvasGLES2::canvas_begin() {
glClearColor(storage->frame.clear_request_color.r,
storage->frame.clear_request_color.g,
storage->frame.clear_request_color.b,
- storage->frame.clear_request_color.a);
+ transparent ? storage->frame.clear_request_color.a : 1.0);
glClear(GL_COLOR_BUFFER_BIT);
storage->frame.clear_request = false;
}
+ glColorMask(1, 1, 1, transparent ? 1 : 0);
+
/*
if (storage->frame.current_rt) {
glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
@@ -182,6 +186,7 @@ void RasterizerCanvasGLES2::canvas_end() {
state.using_texture_rect = false;
state.using_skeleton = false;
state.using_ninepatch = false;
+ glColorMask(1, 1, 1, 1);
}
RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map) {
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 38fcff3ab2..d00d572ccf 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -195,11 +195,11 @@ Ref<Image> RasterizerStorageGLES2::_get_gl_image_and_format(const Ref<Image> &p_
} break;
case Image::FORMAT_DXT1: {
- r_compressed = true;
if (config.s3tc_supported) {
r_gl_internal_format = _EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT;
r_gl_format = GL_RGBA;
r_gl_type = GL_UNSIGNED_BYTE;
+ r_compressed = true;
} else {
need_decompress = true;
}
@@ -846,6 +846,17 @@ void RasterizerStorageGLES2::textures_keep_original(bool p_enable) {
config.keep_original_textures = p_enable;
}
+Size2 RasterizerStorageGLES2::texture_size_with_proxy(RID p_texture) const {
+
+ const Texture *texture = texture_owner.getornull(p_texture);
+ ERR_FAIL_COND_V(!texture, Size2());
+ if (texture->proxy) {
+ return Size2(texture->proxy->width, texture->proxy->height);
+ } else {
+ return Size2(texture->width, texture->height);
+ }
+}
+
void RasterizerStorageGLES2::texture_set_proxy(RID p_texture, RID p_proxy) {
Texture *texture = texture_owner.getornull(p_texture);
ERR_FAIL_COND(!texture);
@@ -4868,8 +4879,8 @@ void RasterizerStorageGLES2::initialize() {
config.etc1_supported = false;
#else
config.float_texture_supported = config.extensions.has("GL_ARB_texture_float") || config.extensions.has("GL_OES_texture_float");
- config.s3tc_supported = config.extensions.has("GL_EXT_texture_compression_s3tc");
- config.etc1_supported = config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture");
+ config.s3tc_supported = config.extensions.has("GL_EXT_texture_compression_s3tc") || config.extensions.has("WEBGL_compressed_texture_s3tc");
+ config.etc1_supported = config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture") || config.extensions.has("WEBGL_compressed_texture_etc1");
#endif
#ifdef GLES_OVER_GL
config.use_rgba_2d_shadows = false;
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index ed21238db6..ba48ddd185 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -342,6 +342,7 @@ public:
virtual void textures_keep_original(bool p_enable);
virtual void texture_set_proxy(RID p_texture, RID p_proxy);
+ virtual Size2 texture_size_with_proxy(RID p_texture) const;
virtual void texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
virtual void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 79fec63db0..b8f0965af8 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -146,10 +146,15 @@ void RasterizerCanvasGLES3::canvas_begin() {
if (storage->frame.current_rt && storage->frame.clear_request) {
// a clear request may be pending, so do it
+ bool transparent = storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT];
- glClearColor(storage->frame.clear_request_color.r, storage->frame.clear_request_color.g, storage->frame.clear_request_color.b, storage->frame.clear_request_color.a);
+ glClearColor(storage->frame.clear_request_color.r,
+ storage->frame.clear_request_color.g,
+ storage->frame.clear_request_color.b,
+ transparent ? storage->frame.clear_request_color.a : 1.0);
glClear(GL_COLOR_BUFFER_BIT);
storage->frame.clear_request = false;
+ glColorMask(1, 1, 1, transparent ? 1 : 0);
}
reset_canvas();
@@ -193,6 +198,7 @@ void RasterizerCanvasGLES3::canvas_end() {
glBindVertexArray(0);
glBindBufferBase(GL_UNIFORM_BUFFER, 0, 0);
+ glColorMask(1, 1, 1, 1);
state.using_texture_rect = false;
state.using_ninepatch = false;
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 70037dfc33..9754cbe0f0 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1687,6 +1687,17 @@ RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source, int p_
return texture_owner.make_rid(ctex);
}
+Size2 RasterizerStorageGLES3::texture_size_with_proxy(RID p_texture) const {
+
+ const Texture *texture = texture_owner.getornull(p_texture);
+ ERR_FAIL_COND_V(!texture, Size2());
+ if (texture->proxy) {
+ return Size2(texture->proxy->width, texture->proxy->height);
+ } else {
+ return Size2(texture->width, texture->height);
+ }
+}
+
void RasterizerStorageGLES3::texture_set_proxy(RID p_texture, RID p_proxy) {
Texture *texture = texture_owner.get(p_texture);
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 811f9c8d80..ca45b1a814 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -375,6 +375,8 @@ public:
virtual void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
virtual void texture_set_proxy(RID p_texture, RID p_proxy);
+ virtual Size2 texture_size_with_proxy(RID p_texture) const;
+
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable);
/* SKY API */
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index d7e0302478..1078fabc2e 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -2010,7 +2010,7 @@ void EditorInspector::_property_changed(const String &p_path, const Variant &p_v
}
}
-void EditorInspector::_property_changed_update_all(const String &p_path, const Variant &p_value) {
+void EditorInspector::_property_changed_update_all(const String &p_path, const Variant &p_value, const String &p_name, bool p_changing) {
update_tree();
}
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 4fb3198e87..3d22cdb9a3 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -302,7 +302,7 @@ class EditorInspector : public ScrollContainer {
void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field);
void _property_changed(const String &p_path, const Variant &p_value, const String &p_name = "", bool changing = false);
- void _property_changed_update_all(const String &p_path, const Variant &p_value);
+ void _property_changed_update_all(const String &p_path, const Variant &p_value, const String &p_name = "", bool p_changing = false);
void _multiple_properties_changed(Vector<String> p_paths, Array p_values);
void _property_keyed(const String &p_path, bool p_advance);
void _property_keyed_with_value(const String &p_path, const Variant &p_value, bool p_advance);
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0ff0bca7ee..c8e00b0586 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -952,6 +952,9 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
}
if (img.is_valid()) {
+
+ img = img->duplicate();
+
save.step(TTR("Creating Thumbnail"), 2);
save.step(TTR("Creating Thumbnail"), 3);
@@ -5635,7 +5638,7 @@ EditorNode::EditorNode() {
bottom_panel->add_child(bottom_panel_vb);
bottom_panel_hb = memnew(HBoxContainer);
- bottom_panel_hb->set_custom_minimum_size(Size2(0, 24)); // Adjust for the height of the "Expand Bottom Dock" icon.
+ bottom_panel_hb->set_custom_minimum_size(Size2(0, 24 * EDSCALE)); // Adjust for the height of the "Expand Bottom Dock" icon.
bottom_panel_vb->add_child(bottom_panel_hb);
bottom_panel_hb_editors = memnew(HBoxContainer);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index f19eac6878..56bab440c9 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2187,7 +2187,19 @@ void EditorPropertyResource::_menu_option(int p_which) {
return;
}
- Object *obj = ClassDB::instance(intype);
+ Object *obj = NULL;
+
+ if (ScriptServer::is_global_class(intype)) {
+ obj = ClassDB::instance(ScriptServer::get_global_class_base(intype));
+ if (obj) {
+ Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(intype));
+ if (script.is_valid()) {
+ obj->set_script(Variant(script));
+ }
+ }
+ } else {
+ obj = ClassDB::instance(intype);
+ }
if (!obj) {
obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 368efbc48f..f77f31db80 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -159,6 +159,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
small_thumbnail_size *= EDSCALE;
Ref<Image> small_image = r_texture->get_data();
+ small_image = small_image->duplicate();
small_image->resize(small_thumbnail_size, small_thumbnail_size, Image::INTERPOLATE_CUBIC);
r_small_texture.instance();
r_small_texture->create_from_image(small_image);
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index a42765df6b..c68023ee9b 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -174,6 +174,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
if (preview_images[i].is_video) {
Ref<Image> overlay = get_icon("PlayOverlay", "EditorIcons")->get_data();
Ref<Image> thumbnail = p_image->get_data();
+ thumbnail = thumbnail->duplicate();
Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2);
thumbnail->lock();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 2913c4ce56..b2d2704f07 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2741,10 +2741,11 @@ void CanvasItemEditor::_draw_selection() {
if (canvas_item->_edit_use_pivot()) {
// Draw the node's pivot
- Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position())).orthonormalized();
+ Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * Transform2D(canvas_item->_edit_get_rotation(), canvas_item->_edit_get_position() + canvas_item->_edit_get_pivot())).orthonormalized();
Transform2D simple_xform = viewport->get_transform() * unscaled_transform;
+
viewport->draw_set_transform_matrix(simple_xform);
- viewport->draw_texture(pivot_icon, canvas_item->_edit_get_pivot() - (pivot_icon->get_size() / 2).floor());
+ viewport->draw_texture(pivot_icon, -(pivot_icon->get_size() / 2).floor());
viewport->draw_set_transform_matrix(viewport->get_transform());
}
@@ -3277,7 +3278,24 @@ void CanvasItemEditor::_notification(int p_what) {
pivot_button->set_disabled(nb_having_pivot == 0);
// Show / Hide the layout button
- presets_menu->set_visible(nb_control > 0 && nb_control == selection.size());
+ if (nb_control > 0 && nb_control == selection.size()) {
+ presets_menu->set_visible(true);
+ presets_menu->set_tooltip(TTR("Presets for the anchors and margins values of a Control node."));
+
+ // Disable if the selected node is child of a container
+ presets_menu->set_disabled(false);
+ for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) {
+ Control *control = Object::cast_to<Control>(E->get());
+ if (!control || Object::cast_to<Container>(control->get_parent())) {
+ presets_menu->set_disabled(true);
+ presets_menu->set_tooltip(TTR("A child of a container gets its anchors and margins values overriden by its parent."));
+ break;
+ }
+ }
+
+ } else {
+ presets_menu->set_visible(false);
+ }
// Update the viewport if bones changes
for (Map<BoneKey, BoneList>::Element *E = bone_list.front(); E; E = E->next()) {
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 8464dfd0aa..4556b11708 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -99,12 +99,14 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2
} else {
Ref<Texture> tex = p_from;
img = tex->get_data();
+ if (img.is_valid()) {
+ img = img->duplicate();
+ }
}
if (img.is_null() || img->empty())
return Ref<Texture>();
- img = img->duplicate();
img->clear_mipmaps();
if (img->is_compressed()) {
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 276ca2e451..78bc989c5f 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -5732,6 +5732,7 @@ void SpatialEditorPlugin::snap_cursor_to_plane(const Plane &p_plane) {
}
void SpatialEditor::add_gizmo_plugin(Ref<EditorSpatialGizmoPlugin> p_plugin) {
+ ERR_FAIL_NULL(p_plugin.ptr());
gizmo_plugins.push_back(p_plugin);
_update_gizmos_menu();
SpatialEditor::get_singleton()->update_all_gizmos();
@@ -5869,7 +5870,7 @@ Ref<SpatialMaterial> EditorSpatialGizmoPlugin::get_material(const String &p_name
ERR_FAIL_COND_V(!materials.has(p_name), Ref<SpatialMaterial>());
ERR_FAIL_COND_V(materials[p_name].size() == 0, Ref<SpatialMaterial>());
- if (p_gizmo.is_null()) return materials[p_name][0];
+ if (p_gizmo.is_null() || materials[p_name].size() == 1) return materials[p_name][0];
int index = (p_gizmo->is_selected() ? 1 : 0) + (p_gizmo->is_editable() ? 2 : 0);
@@ -5888,7 +5889,7 @@ String EditorSpatialGizmoPlugin::get_name() const {
if (get_script_instance() && get_script_instance()->has_method("get_name")) {
return get_script_instance()->call("get_name");
}
- return TTR("Name-less gizmo");
+ return TTR("Nameless gizmo");
}
Ref<EditorSpatialGizmo> EditorSpatialGizmoPlugin::get_gizmo(Spatial *p_spatial) {
@@ -5938,7 +5939,7 @@ void EditorSpatialGizmoPlugin::_bind_methods() {
cm.default_arguments.push_back(false);
BIND_VMETHOD(cm);
- BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_gizmo_handle_highlighted", GIZMO_REF, PropertyInfo(Variant::INT, "index")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_handle_highlighted", GIZMO_REF, PropertyInfo(Variant::INT, "index")));
#undef GIZMO_REF
}
@@ -6008,9 +6009,9 @@ void EditorSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_
}
}
-bool EditorSpatialGizmoPlugin::is_gizmo_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int p_idx) const {
- if (get_script_instance() && get_script_instance()->has_method("is_gizmo_handle_highlighted")) {
- return get_script_instance()->call("is_gizmo_handle_highlighted", p_gizmo, p_idx);
+bool EditorSpatialGizmoPlugin::is_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int p_idx) const {
+ if (get_script_instance() && get_script_instance()->has_method("is_handle_highlighted")) {
+ return get_script_instance()->call("is_handle_highlighted", p_gizmo, p_idx);
}
return false;
}
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 87cd089428..2dc627cb27 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -110,6 +110,7 @@ public:
void add_handles(const Vector<Vector3> &p_handles, const Ref<Material> &p_material, bool p_billboard = false, bool p_secondary = false);
void add_solid_box(Ref<Material> &p_material, Vector3 p_size, Vector3 p_position = Vector3());
+ virtual bool is_handle_highlighted(int p_idx) const;
virtual String get_handle_name(int p_idx) const;
virtual Variant get_handle_value(int p_idx);
virtual void set_handle(int p_idx, Camera *p_camera, const Point2 &p_point);
@@ -117,6 +118,7 @@ public:
void set_spatial_node(Spatial *p_node);
Spatial *get_spatial_node() const { return spatial_node; }
+ EditorSpatialGizmoPlugin *get_plugin() const { return gizmo_plugin; }
Vector3 get_handle_pos(int p_idx) const;
bool intersect_frustum(const Camera *p_camera, const Vector<Plane> &p_frustum);
bool intersect_ray(Camera *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
@@ -786,7 +788,7 @@ public:
virtual Variant get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const;
virtual void set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Camera *p_camera, const Point2 &p_point);
virtual void commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false);
- virtual bool is_gizmo_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int p_idx) const;
+ virtual bool is_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int p_idx) const;
Ref<EditorSpatialGizmo> get_gizmo(Spatial *p_spatial);
void set_state(int p_state);
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 9f3a0e78f6..f62391e436 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -99,26 +99,63 @@ void EditorSpatialGizmo::clear() {
void EditorSpatialGizmo::redraw() {
+ if (get_script_instance() && get_script_instance()->has_method("redraw")) {
+ get_script_instance()->call("redraw");
+ return;
+ }
+
ERR_FAIL_COND(!gizmo_plugin);
gizmo_plugin->redraw(this);
}
String EditorSpatialGizmo::get_handle_name(int p_idx) const {
+
+ if (get_script_instance() && get_script_instance()->has_method("get_handle_name")) {
+ return get_script_instance()->call("get_handle_name", p_idx);
+ }
+
ERR_FAIL_COND_V(!gizmo_plugin, "");
return gizmo_plugin->get_handle_name(this, p_idx);
}
+bool EditorSpatialGizmo::is_handle_highlighted(int p_idx) const {
+
+ if (get_script_instance() && get_script_instance()->has_method("is_handle_highlighted")) {
+ return get_script_instance()->call("is_handle_highlighted", p_idx);
+ }
+
+ ERR_FAIL_COND_V(!gizmo_plugin, false);
+ return gizmo_plugin->is_handle_highlighted(this, p_idx);
+}
+
Variant EditorSpatialGizmo::get_handle_value(int p_idx) {
+
+ if (get_script_instance() && get_script_instance()->has_method("get_handle_value")) {
+ return get_script_instance()->call("get_handle_value", p_idx);
+ }
+
ERR_FAIL_COND_V(!gizmo_plugin, Variant());
return gizmo_plugin->get_handle_value(this, p_idx);
}
void EditorSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_point) {
+
+ if (get_script_instance() && get_script_instance()->has_method("set_handle")) {
+ get_script_instance()->call("set_handle", p_idx, p_camera, p_point);
+ return;
+ }
+
ERR_FAIL_COND(!gizmo_plugin);
return gizmo_plugin->set_handle(this, p_idx, p_camera, p_point);
}
void EditorSpatialGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) {
+
+ if (get_script_instance() && get_script_instance()->has_method("commit_handle")) {
+ get_script_instance()->call("commit_handle", p_idx, p_restore, p_cancel);
+ return;
+ }
+
ERR_FAIL_COND(!gizmo_plugin);
return gizmo_plugin->commit_handle(this, p_idx, p_restore, p_cancel);
}
@@ -298,7 +335,7 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref
for (int i = 0; i < p_handles.size(); i++) {
Color col(1, 1, 1, 1);
- if (gizmo_plugin->is_gizmo_handle_highlighted(this, i))
+ if (is_handle_highlighted(i))
col = Color(0, 0, 1, 0.9);
if (SpatialEditor::get_singleton()->get_over_gizmo_handle() != i)
@@ -690,11 +727,14 @@ void EditorSpatialGizmo::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_unscaled_billboard", "material", "default_scale"), &EditorSpatialGizmo::add_unscaled_billboard, DEFVAL(1));
ClassDB::bind_method(D_METHOD("add_handles", "handles", "material", "billboard", "secondary"), &EditorSpatialGizmo::add_handles, DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_spatial_node", "node"), &EditorSpatialGizmo::_set_spatial_node);
+ ClassDB::bind_method(D_METHOD("get_spatial_node"), &EditorSpatialGizmo::get_spatial_node);
+ ClassDB::bind_method(D_METHOD("get_plugin"), &EditorSpatialGizmo::get_plugin);
ClassDB::bind_method(D_METHOD("clear"), &EditorSpatialGizmo::clear);
ClassDB::bind_method(D_METHOD("set_hidden", "hidden"), &EditorSpatialGizmo::set_hidden);
BIND_VMETHOD(MethodInfo("redraw"));
BIND_VMETHOD(MethodInfo(Variant::STRING, "get_handle_name", PropertyInfo(Variant::INT, "index")));
+ BIND_VMETHOD(MethodInfo(Variant::BOOL, "is_handle_highlighted", PropertyInfo(Variant::INT, "index")));
MethodInfo hvget(Variant::NIL, "get_handle_value", PropertyInfo(Variant::INT, "index"));
hvget.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
@@ -2117,7 +2157,7 @@ void SoftBodySpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int
soft_body->pin_point_toggle(p_idx);
}
-bool SoftBodySpatialGizmoPlugin::is_gizmo_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int idx) const {
+bool SoftBodySpatialGizmoPlugin::is_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int idx) const {
SoftBody *soft_body = Object::cast_to<SoftBody>(p_gizmo->get_spatial_node());
return soft_body->is_point_pinned(idx);
}
diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h
index 40e137cded..0d89fb0f03 100644
--- a/editor/spatial_editor_gizmos.h
+++ b/editor/spatial_editor_gizmos.h
@@ -214,7 +214,7 @@ public:
String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const;
Variant get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const;
void commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel);
- bool is_gizmo_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int idx) const;
+ bool is_handle_highlighted(const EditorSpatialGizmo *p_gizmo, int idx) const;
SoftBodySpatialGizmoPlugin();
};
diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub
index 11ce18449b..0416dd7f5f 100644
--- a/modules/bullet/SCsub
+++ b/modules/bullet/SCsub
@@ -187,6 +187,8 @@ if env['builtin_bullet']:
thirdparty_sources = [thirdparty_dir + file for file in bullet2_src]
env_bullet.Append(CPPPATH=[thirdparty_dir])
+ if env['target'] == "debug" or env['target'] == "release_debug":
+ env_bullet.Append(CCFLAGS=['-DBT_DEBUG'])
env_thirdparty = env_bullet.Clone()
env_thirdparty.disable_warnings()
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 491abbde9e..8f0d5a2db4 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -37,8 +37,22 @@
extern "C" {
#endif
+// Workaround GCC ICE on armv7hl which was affected GCC 6.0 up to 8.0 (GH-16100).
+// It was fixed upstream in 8.1, and a fix was backported to 7.4.
+// This can be removed once no supported distro ships with versions older than 7.4.
+#if defined(__arm__) && defined(__GNUC__) && !defined(__clang__) && \
+ (__GNUC__ == 6 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) || (__GNUC__ == 8 && __GNUC_MINOR__ < 1))
+#pragma GCC push_options
+#pragma GCC optimize("-O0")
+#endif
+
#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+#if defined(__arm__) && defined(__GNUC__) && !defined(__clang__) && \
+ (__GNUC__ == 6 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) || (__GNUC__ == 8 && __GNUC_MINOR__ < 1))
+#pragma GCC pop_options
+#endif
+
// Constructors
godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self) {
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index 80f2324e15..6e431f51e7 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -59,7 +59,7 @@ String path_which(const String &p_name) {
#ifdef WINDOWS_ENABLED
for (int j = 0; j < exts.size(); j++) {
- String p2 = p + exts[j];
+ String p2 = p + exts[j].to_lower(); // lowercase to reduce risk of case mismatch warning
if (FileAccess::exists(p2))
return p2;
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index d3f2f3c272..01e011e64c 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -33,6 +33,7 @@
#include "RgbaBitmap.h"
#include "core/os/file_access.h"
#include <string.h>
+#include <new>
static void _pvrtc_decompress(Image *p_img);
@@ -215,12 +216,10 @@ static void _compress_pvrtc4(Image *p_img) {
int ofs, size, w, h;
img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h);
Javelin::RgbaBitmap bm(w, h);
- copymem(bm.GetData(), &r[ofs], size);
- {
+ for (unsigned j = 0; j < size / 4; j++) {
Javelin::ColorRgba<unsigned char> *dp = bm.GetData();
- for (int j = 0; j < size / 4; j++) {
- SWAP(dp[j].r, dp[j].b);
- }
+ /* red and Green colors are swapped. */
+ new (dp) Javelin::ColorRgba<unsigned char>(r[ofs + 4 * j + 2], r[ofs + 4 * j + 1], r[ofs + 4 * j], r[ofs + 4 * j + 3]);
}
new_img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h);
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index d7ba454051..e820d07a2a 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -442,6 +442,9 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
if (texture.is_valid()) {
image = texture->get_data();
+ if (image.is_valid()) {
+ image->duplicate();
+ }
}
if (!image.is_valid() && atlas_texture.is_valid()) {
@@ -468,6 +471,8 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
ERR_FAIL_COND(!image.is_valid());
+ image = image->duplicate();
+
if (atlas_texture.is_valid())
image->crop_from_point(
atlas_rect.position.x,
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 707e95e271..28ddf6b5f8 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -395,8 +395,8 @@ void AnimatedSprite::_notification(int p_what) {
int fc = frames->get_frame_count(animation);
if (frame >= fc - 1) {
if (frames->get_animation_loop(animation)) {
- emit_signal(SceneStringNames::get_singleton()->animation_finished);
frame = 0;
+ emit_signal(SceneStringNames::get_singleton()->animation_finished);
} else {
frame = fc - 1;
if (!is_over) {
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index d7ed6f8f49..d1fce74085 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -431,7 +431,7 @@ void Light2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "StreamTexture,ImageTexture"), "set_texture", "get_texture");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset"), "set_texture_offset", "get_texture_offset");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "texture_scale", PROPERTY_HINT_RANGE, "0.01,50,0.01"), "set_texture_scale", "get_texture_scale");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 56faba27cf..08cc655cdd 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -373,7 +373,7 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
if (fading_from != StringName()) {
- sm->blend_node(current, sm->states[fading_from].node, p_time, p_seek, 1.0 - fade_blend, AnimationNode::FILTER_IGNORE, false);
+ sm->blend_node(fading_from, sm->states[fading_from].node, p_time, p_seek, 1.0 - fade_blend, AnimationNode::FILTER_IGNORE, false);
}
//guess playback position
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 6ed465562e..307a421016 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -35,6 +35,7 @@
#include "core/os/os.h"
#ifdef TOOLS_ENABLED
+#include "editor_scale.h"
#include "editor_settings.h"
#endif
@@ -156,7 +157,7 @@ void ColorPicker::_value_changed(double) {
void ColorPicker::_html_entered(const String &p_html) {
- if (updating)
+ if (updating || text_is_constructor || !c_text->is_visible())
return;
float last_alpha = color.a;
@@ -211,15 +212,18 @@ void ColorPicker::_update_presets() {
}
void ColorPicker::_text_type_toggled() {
- if (!Engine::get_singleton()->is_editor_hint())
- return;
+
text_is_constructor = !text_is_constructor;
if (text_is_constructor) {
text_type->set_text("");
text_type->set_icon(get_icon("Script", "EditorIcons"));
+
+ c_text->set_editable(false);
} else {
text_type->set_text("#");
text_type->set_icon(NULL);
+
+ c_text->set_editable(true);
}
_update_color();
}
@@ -304,19 +308,21 @@ bool ColorPicker::is_deferred_mode() const {
void ColorPicker::_update_text_value() {
bool visible = true;
if (text_is_constructor) {
- String t = "Color(" + String::num(color.r) + "," + String::num(color.g) + "," + String::num(color.b);
+ String t = "Color(" + String::num(color.r) + ", " + String::num(color.g) + ", " + String::num(color.b);
if (edit_alpha && color.a < 1)
- t += ("," + String::num(color.a) + ")");
+ t += ", " + String::num(color.a) + ")";
else
t += ")";
c_text->set_text(t);
- } else {
- if (color.r > 1 || color.g > 1 || color.b > 1 || color.r < 0 || color.g < 0 || color.b < 0) {
- visible = false;
- } else {
- c_text->set_text(color.to_html(edit_alpha && color.a < 1));
- }
}
+
+ if (color.r > 1 || color.g > 1 || color.b > 1 || color.r < 0 || color.g < 0 || color.b < 0) {
+ visible = false;
+ } else if (!text_is_constructor) {
+ c_text->set_text(color.to_html(edit_alpha && color.a < 1));
+ }
+
+ text_type->set_visible(visible);
c_text->set_visible(visible);
}
@@ -615,22 +621,25 @@ ColorPicker::ColorPicker() :
screen = NULL;
HBoxContainer *hb_smpl = memnew(HBoxContainer);
- btn_pick = memnew(ToolButton);
- btn_pick->connect("pressed", this, "_screen_pick_pressed");
+ add_child(hb_smpl);
sample = memnew(TextureRect);
+ hb_smpl->add_child(sample);
sample->set_h_size_flags(SIZE_EXPAND_FILL);
sample->connect("draw", this, "_sample_draw");
- hb_smpl->add_child(sample);
+ btn_pick = memnew(ToolButton);
hb_smpl->add_child(btn_pick);
- add_child(hb_smpl);
+ btn_pick->set_toggle_mode(true);
+ btn_pick->set_tooltip(TTR("Pick a color from the screen."));
+ btn_pick->connect("pressed", this, "_screen_pick_pressed");
HBoxContainer *hb_edit = memnew(HBoxContainer);
+ add_child(hb_edit);
hb_edit->set_v_size_flags(SIZE_EXPAND_FILL);
uv_edit = memnew(Control);
-
+ hb_edit->add_child(uv_edit);
uv_edit->connect("gui_input", this, "_uv_input");
uv_edit->set_mouse_filter(MOUSE_FILTER_PASS);
uv_edit->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -638,19 +647,14 @@ ColorPicker::ColorPicker() :
uv_edit->set_custom_minimum_size(Size2(get_constant("sv_width"), get_constant("sv_height")));
uv_edit->connect("draw", this, "_hsv_draw", make_binds(0, uv_edit));
- add_child(hb_edit);
-
w_edit = memnew(Control);
+ hb_edit->add_child(w_edit);
w_edit->set_custom_minimum_size(Size2(get_constant("h_width"), 0));
w_edit->set_h_size_flags(SIZE_FILL);
w_edit->set_v_size_flags(SIZE_EXPAND_FILL);
w_edit->connect("gui_input", this, "_w_input");
w_edit->connect("draw", this, "_hsv_draw", make_binds(1, w_edit));
- hb_edit->add_child(uv_edit);
- hb_edit->add_child(memnew(VSeparator));
- hb_edit->add_child(w_edit);
-
VBoxContainer *vbl = memnew(VBoxContainer);
add_child(vbl);
@@ -691,31 +695,43 @@ ColorPicker::ColorPicker() :
}
HBoxContainer *hhb = memnew(HBoxContainer);
+ vbr->add_child(hhb);
btn_mode = memnew(CheckButton);
+ hhb->add_child(btn_mode);
btn_mode->set_text(TTR("Raw Mode"));
btn_mode->connect("toggled", this, "set_raw_mode");
- hhb->add_child(btn_mode);
- vbr->add_child(hhb);
+
text_type = memnew(Button);
- text_type->set_flat(true);
- text_type->connect("pressed", this, "_text_type_toggled");
hhb->add_child(text_type);
+ text_type->set_text("#");
+ text_type->set_tooltip(TTR("Switch between hexadecimal and code values."));
+ if (Engine::get_singleton()->is_editor_hint()) {
+
+#ifdef TOOLS_ENABLED
+ text_type->set_custom_minimum_size(Size2(28 * EDSCALE, 0)); // Adjust for the width of the "Script" icon.
+#endif
+ text_type->connect("pressed", this, "_text_type_toggled");
+ } else {
+
+ text_type->set_flat(true);
+ text_type->set_mouse_filter(MOUSE_FILTER_IGNORE);
+ }
c_text = memnew(LineEdit);
hhb->add_child(c_text);
+ c_text->set_h_size_flags(SIZE_EXPAND_FILL);
c_text->connect("text_entered", this, "_html_entered");
c_text->connect("focus_entered", this, "_focus_enter");
c_text->connect("focus_exited", this, "_html_focus_exit");
- text_type->set_text("#");
- c_text->set_h_size_flags(SIZE_EXPAND_FILL);
-
_update_controls();
updating = false;
set_pick_color(Color(1, 1, 1));
+ add_child(memnew(HSeparator));
+
HBoxContainer *bbc = memnew(HBoxContainer);
add_child(bbc);
@@ -725,9 +741,9 @@ ColorPicker::ColorPicker() :
preset->connect("draw", this, "_update_presets");
bt_add_preset = memnew(Button);
+ bbc->add_child(bt_add_preset);
bt_add_preset->set_tooltip(TTR("Add current color as a preset"));
bt_add_preset->connect("pressed", this, "_add_preset_pressed");
- bbc->add_child(bt_add_preset);
}
/////////////////
@@ -814,6 +830,8 @@ void ColorPickerButton::_update_picker() {
add_child(popup);
picker->connect("color_changed", this, "_color_changed");
popup->connect("modal_closed", this, "_modal_closed");
+ popup->connect("about_to_show", this, "set_pressed", varray(true));
+ popup->connect("popup_hide", this, "set_pressed", varray(false));
picker->set_pick_color(color);
picker->set_edit_alpha(edit_alpha);
}
@@ -838,10 +856,12 @@ void ColorPickerButton::_bind_methods() {
ColorPickerButton::ColorPickerButton() {
- //Initialization is now done deferred
- //this improves performance in the inspector as the color picker
- //can be expensive to initialize
+ // Initialization is now done deferred,
+ // this improves performance in the inspector as the color picker
+ // can be expensive to initialize.
picker = NULL;
popup = NULL;
edit_alpha = true;
+
+ set_toggle_mode(true);
}
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 26036c08a9..dcad70451e 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -2000,6 +2000,8 @@ void AnimatedTexture::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "frame_" + itos(i) + "/texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_frame_texture", "get_frame_texture", i);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "frame_" + itos(i) + "/delay_sec", PROPERTY_HINT_RANGE, "0.0,16.0,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_frame_delay", "get_frame_delay", i);
}
+
+ BIND_CONSTANT(MAX_FRAMES);
}
AnimatedTexture::AnimatedTexture() {
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 6f8a30070a..33081dcd0c 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -221,6 +221,7 @@ public:
virtual void textures_keep_original(bool p_enable) = 0;
virtual void texture_set_proxy(RID p_proxy, RID p_base) = 0;
+ virtual Size2 texture_size_with_proxy(RID p_texture) const = 0;
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) = 0;
/* SKY API */
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index d2046241f0..c8d64fca45 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -32,6 +32,7 @@
#include "core/os/os.h"
#include "visual_server_global.h"
#include "visual_server_raster.h"
+#include <new>
/* CAMERA API */
RID VisualServerScene::camera_create() {
@@ -1253,7 +1254,9 @@ void VisualServerScene::_update_instance_lightmap_captures(Instance *p_instance)
//print_line("update captures for pos: " + p_instance->transform.origin);
- zeromem(p_instance->lightmap_capture_data.ptrw(), 12 * sizeof(Color));
+ for (int i = 0; i < 12; i++)
+ new (&p_instance->lightmap_capture_data.ptrw()[i]) Color;
+
//this could use some sort of blending..
for (List<Instance *>::Element *E = geom->lightmap_captures.front(); E; E = E->next()) {
const PoolVector<RasterizerStorage::LightmapCaptureOctree> *octree = VSG::storage->lightmap_capture_get_octree_ptr(E->get()->base);
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index 92b17eae47..7a7ae3a823 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -97,7 +97,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
RasterizerCanvas::Light *cl = F->get();
if (cl->enabled && cl->texture.is_valid()) {
//not super efficient..
- Size2 tsize(VSG::storage->texture_get_width(cl->texture), VSG::storage->texture_get_height(cl->texture));
+ Size2 tsize = VSG::storage->texture_size_with_proxy(cl->texture);
tsize *= cl->scale;
Vector2 offset = tsize / 2.0;