summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/stream_peer.cpp3
-rw-r--r--core/os/input_event.cpp5
-rw-r--r--core/os/input_event.h1
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h2
-rw-r--r--drivers/gles3/shader_gles3.cpp6
-rw-r--r--drivers/gles3/shaders/canvas.glsl4
-rw-r--r--drivers/unix/ip_unix.cpp1
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp4
-rw-r--r--editor/project_manager.cpp3
-rw-r--r--main/input_default.cpp10
-rw-r--r--main/main.cpp5
-rw-r--r--scene/2d/particles_2d.cpp2
-rw-r--r--scene/3d/particles.cpp2
-rw-r--r--scene/main/scene_tree.cpp9
-rw-r--r--scene/main/scene_tree.h1
16 files changed, 47 insertions, 13 deletions
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index fdad7c7bdf..faf0700edf 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -459,8 +459,9 @@ Error StreamPeerBuffer::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_
}
PoolVector<uint8_t>::Read r = data.read();
- copymem(p_buffer, r.ptr(), r_received);
+ copymem(p_buffer, r.ptr() + pointer, r_received);
+ pointer += r_received;
// FIXME: return what? OK or ERR_*
}
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index fe0e2c2524..cb38eb67b6 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -595,6 +595,11 @@ float InputEventJoypadMotion::get_axis_value() const {
return axis_value;
}
+bool InputEventJoypadMotion::is_pressed() const {
+
+ return Math::abs(axis_value) > 0.5f;
+}
+
bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event) const {
Ref<InputEventJoypadMotion> jm = p_event;
diff --git a/core/os/input_event.h b/core/os/input_event.h
index b120d4b840..d1fd7cc90f 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -348,6 +348,7 @@ public:
void set_axis_value(float p_value);
float get_axis_value() const;
+ virtual bool is_pressed() const;
virtual bool action_match(const Ref<InputEvent> &p_event) const;
virtual bool is_action_type() const { return true; }
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index 26003f543f..29f889cc88 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -42,6 +42,7 @@ public:
float projection_matrix[16];
float time;
+ uint8_t padding[12];
};
RasterizerSceneGLES3 *scene_render;
@@ -102,6 +103,7 @@ public:
float light_height;
float light_outside_alpha;
float shadow_distance_mult;
+ uint8_t padding[4];
} ubo_data;
GLuint ubo;
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index f6509e0041..0cdaef44a9 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -141,6 +141,7 @@ public:
float fog_height_min;
float fog_height_max;
float fog_height_curve;
+ uint8_t padding[8];
} ubo_data;
@@ -150,6 +151,7 @@ public:
float transform[16];
float ambient_contribution;
+ uint8_t padding[12];
} env_radiance_data;
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index f1077e2d20..77e257dfc8 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -273,6 +273,9 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
//vertex precision is high
strings.push_back("precision highp float;\n");
strings.push_back("precision highp int;\n");
+ strings.push_back("precision highp sampler2D;\n");
+ strings.push_back("precision highp samplerCube;\n");
+ strings.push_back("precision highp sampler2DArray;\n");
#if 0
if (cc) {
@@ -371,6 +374,9 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() {
//fragment precision is medium
strings.push_back("precision highp float;\n");
strings.push_back("precision highp int;\n");
+ strings.push_back("precision highp sampler2D;\n");
+ strings.push_back("precision highp samplerCube;\n");
+ strings.push_back("precision highp sampler2DArray;\n");
#if 0
if (cc) {
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index 1c950c82d9..f0dc14c35a 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -532,11 +532,11 @@ FRAGMENT_SHADER_CODE
#ifdef USE_RGBA_SHADOWS
-#define SHADOW_DEPTH(m_tex,m_uv) dot(texture2D((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) )
+#define SHADOW_DEPTH(m_tex,m_uv) dot(texture((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) )
#else
-#define SHADOW_DEPTH(m_tex,m_uv) (texture2D((m_tex),(m_uv)).r)
+#define SHADOW_DEPTH(m_tex,m_uv) (texture((m_tex),(m_uv)).r)
#endif
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp
index 30d2377a04..f55b75c1d9 100644
--- a/drivers/unix/ip_unix.cpp
+++ b/drivers/unix/ip_unix.cpp
@@ -100,6 +100,7 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) {
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_ADDRCONFIG;
};
+ hints.ai_flags &= !AI_NUMERICHOST;
int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result);
if (s != 0) {
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index a549f09cb1..13fdb7ac9d 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -285,11 +285,11 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2 &p_pos, bool p_append,
Node *subscene_candidate = spat;
- while (subscene_candidate->get_owner() != editor->get_edited_scene())
+ while ((subscene_candidate->get_owner() != NULL) && (subscene_candidate->get_owner() != editor->get_edited_scene()))
subscene_candidate = subscene_candidate->get_owner();
spat = subscene_candidate->cast_to<Spatial>();
- if (spat && (spat->get_filename() != ""))
+ if (spat && (spat->get_filename() != "") && (subscene_candidate->get_owner() != NULL))
subscenes.push_back(spat);
continue;
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index b77544befa..dc0c888eea 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -848,6 +848,7 @@ void ProjectManager::_load_recent_projects() {
VBoxContainer *vb = memnew(VBoxContainer);
vb->set_name("project");
+ vb->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(vb);
Control *ec = memnew(Control);
ec->set_custom_minimum_size(Size2(0, 1));
@@ -855,12 +856,14 @@ void ProjectManager::_load_recent_projects() {
Label *title = memnew(Label(project_name));
title->add_font_override("font", gui_base->get_font("large", "Fonts"));
title->add_color_override("font_color", font_color);
+ title->set_clip_text(true);
vb->add_child(title);
Label *fpath = memnew(Label(path));
fpath->set_name("path");
vb->add_child(fpath);
fpath->set_modulate(Color(1, 1, 1, 0.5));
fpath->add_color_override("font_color", font_color);
+ fpath->set_clip_text(true);
scroll_childs->add_child(hb);
}
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 4e2fd6f9d4..e7dc9d4b70 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -899,8 +899,14 @@ void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
return;
}
- if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) {
- //changed direction quickly, insert fake event to release pending inputmap actions
+ //when changing direction quickly, insert fake event to release pending inputmap actions
+ float last = joy.last_axis[p_axis];
+ if (p_value.min == 0 && (last < 0.25 || last > 0.75) && (last - 0.5) * (p_value.value - 0.5) < 0) {
+ JoyAxis jx;
+ jx.min = p_value.min;
+ jx.value = p_value.value < 0.5 ? 0.6 : 0.4;
+ joy_axis(p_device, p_axis, jx);
+ } else if (ABS(last) > 0.5 && last * p_value.value < 0) {
JoyAxis jx;
jx.min = p_value.min;
jx.value = p_value.value < 0 ? 0.1 : -0.1;
diff --git a/main/main.cpp b/main/main.cpp
index 9376d83204..561201ab8a 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1275,6 +1275,8 @@ bool Main::start() {
sml_aspect = SceneTree::STRETCH_ASPECT_KEEP_WIDTH;
else if (stretch_aspect == "keep_height")
sml_aspect = SceneTree::STRETCH_ASPECT_KEEP_HEIGHT;
+ else if (stretch_aspect == "expand")
+ sml_aspect = SceneTree::STRETCH_ASPECT_EXPAND;
sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size, stretch_shrink);
@@ -1302,7 +1304,7 @@ bool Main::start() {
GLOBAL_DEF("display/window/stretch/mode", "disabled");
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport"));
GLOBAL_DEF("display/window/stretch/aspect", "ignore");
- ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height"));
+ ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height,expand"));
GLOBAL_DEF("display/window/stretch/shrink", 1);
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/shrink", PropertyInfo(Variant::STRING, "display/window/stretch/shrink", PROPERTY_HINT_RANGE, "1,8,1"));
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
@@ -1464,6 +1466,7 @@ bool Main::start() {
String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
if (iconpath != "") {
Ref<Image> icon;
+ icon.instance();
if (icon->load(iconpath) == OK)
OS::get_singleton()->set_icon(icon);
}
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 4aa841131a..a2ec33f403 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -55,6 +55,8 @@ void Particles2D::set_one_shot(bool p_enable) {
one_shot = p_enable;
VS::get_singleton()->particles_set_one_shot(particles, one_shot);
+ if (!one_shot && emitting)
+ VisualServer::get_singleton()->particles_restart(particles);
}
void Particles2D::set_pre_process_time(float p_time) {
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 081caf4419..d83469da62 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -63,6 +63,8 @@ void Particles::set_one_shot(bool p_one_shot) {
one_shot = p_one_shot;
VS::get_singleton()->particles_set_one_shot(particles, one_shot);
+ if (!one_shot && emitting)
+ VisualServer::get_singleton()->particles_restart(particles);
}
void Particles::set_pre_process_time(float p_time) {
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index af7dac7ec9..067bcbff3e 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1181,7 +1181,7 @@ void SceneTree::_update_root_rect() {
} else if (viewport_aspect < video_mode_aspect) {
// screen ratio is smaller vertically
- if (stretch_aspect == STRETCH_ASPECT_KEEP_HEIGHT) {
+ if (stretch_aspect == STRETCH_ASPECT_KEEP_HEIGHT || stretch_aspect == STRETCH_ASPECT_EXPAND) {
//will stretch horizontally
viewport_size.x = desired_res.y * video_mode_aspect;
@@ -1196,7 +1196,7 @@ void SceneTree::_update_root_rect() {
}
} else {
//screen ratio is smaller horizontally
- if (stretch_aspect == STRETCH_ASPECT_KEEP_WIDTH) {
+ if (stretch_aspect == STRETCH_ASPECT_KEEP_WIDTH || stretch_aspect == STRETCH_ASPECT_EXPAND) {
//will stretch horizontally
viewport_size.x = desired_res.x;
@@ -1217,12 +1217,11 @@ void SceneTree::_update_root_rect() {
Size2 margin;
Size2 offset;
//black bars and margin
- if (screen_size.x < video_mode.x) {
+ if (stretch_aspect != STRETCH_ASPECT_EXPAND && screen_size.x < video_mode.x) {
margin.x = Math::round((video_mode.x - screen_size.x) / 2.0);
VisualServer::get_singleton()->black_bars_set_margins(margin.x, 0, margin.x, 0);
offset.x = Math::round(margin.x * viewport_size.y / screen_size.y);
- } else if (screen_size.y < video_mode.y) {
-
+ } else if (stretch_aspect != STRETCH_ASPECT_EXPAND && screen_size.y < video_mode.y) {
margin.y = Math::round((video_mode.y - screen_size.y) / 2.0);
VisualServer::get_singleton()->black_bars_set_margins(0, margin.y, 0, margin.y);
offset.y = Math::round(margin.y * viewport_size.x / screen_size.x);
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index 90d42ef01b..3543ebee90 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -90,6 +90,7 @@ public:
STRETCH_ASPECT_KEEP,
STRETCH_ASPECT_KEEP_WIDTH,
STRETCH_ASPECT_KEEP_HEIGHT,
+ STRETCH_ASPECT_EXPAND,
};
private: