diff options
-rw-r--r-- | core/variant_parser.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 5 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 2 | ||||
-rw-r--r-- | main/tests/test_shader_lang.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_function.h | 3 | ||||
-rw-r--r-- | modules/gdscript/gd_script.cpp | 3 | ||||
-rw-r--r-- | modules/stb_vorbis/audio_stream_ogg_vorbis.cpp | 15 | ||||
-rw-r--r-- | modules/stb_vorbis/audio_stream_ogg_vorbis.h | 4 | ||||
-rw-r--r-- | modules/stb_vorbis/resource_importer_ogg_vorbis.cpp | 3 | ||||
-rw-r--r-- | modules/svg/image_loader_svg.cpp | 7 | ||||
-rw-r--r-- | modules/visual_script/visual_script_expression.cpp | 1 | ||||
-rw-r--r-- | platform/android/godot_android.cpp | 1 | ||||
-rw-r--r-- | scene/2d/parallax_layer.cpp | 8 | ||||
-rw-r--r-- | scene/gui/control.cpp | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 3 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 2 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 4 |
18 files changed, 44 insertions, 27 deletions
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 398f20caf3..5aa71f6704 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -326,6 +326,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri is_float = true; } else if (c == 'e') { reading = READING_EXP; + is_float = true; } else { reading = READING_DONE; } @@ -337,7 +338,6 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri } else if (c == 'e') { reading = READING_EXP; - } else { reading = READING_DONE; } @@ -349,8 +349,6 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri exp_beg = true; } else if ((c == '-' || c == '+') && !exp_sign && !exp_beg) { - if (c == '-') - is_float = true; exp_sign = true; } else { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index c89fc0768f..05cfba726c 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2186,7 +2186,7 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo while (m->next_pass.is_valid()) { m = storage->material_owner.getornull(m->next_pass); - if (!m) + if (!m || !m->shader || !m->shader->valid) break; _add_geometry_with_material(p_geometry, p_instance, p_owner, m, p_shadow); } diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 3f0498746b..e6476bd6b6 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1694,6 +1694,7 @@ FRAGMENT_SHADER_CODE if (gl_FragCoord.w > shadow_split_offsets.w) { vec3 pssm_coord; + float pssm_fade=0.0; #ifdef LIGHT_USE_PSSM_BLEND float pssm_blend; @@ -1751,6 +1752,7 @@ FRAGMENT_SHADER_CODE } else { highp vec4 splane=(shadow_matrix4 * vec4(vertex,1.0)); pssm_coord=splane.xyz/splane.w; + pssm_fade = smoothstep(shadow_split_offsets.z,shadow_split_offsets.w,gl_FragCoord.w); #if defined(LIGHT_USE_PSSM_BLEND) use_blend=false; @@ -1782,6 +1784,7 @@ FRAGMENT_SHADER_CODE } else { highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0)); pssm_coord=splane.xyz/splane.w; + pssm_fade = smoothstep(shadow_split_offsets.x,shadow_split_offsets.y,gl_FragCoord.w); #if defined(LIGHT_USE_PSSM_BLEND) use_blend=false; @@ -1818,7 +1821,7 @@ FRAGMENT_SHADER_CODE } #endif - light_attenuation=mix(shadow_color_contact.rgb,vec3(1.0),shadow); + light_attenuation=mix(mix(shadow_color_contact.rgb,vec3(1.0),shadow),vec3(1.0),pssm_fade); } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 4f1e6c1771..f628a23d5f 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -411,6 +411,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("SceneTabFG", "EditorStyles", make_flat_stylebox(title_color_hl, 10, 5, 10, 5)); theme->set_stylebox("SceneTabBG", "EditorStyles", make_empty_stylebox(6, 5, 6, 5)); theme->set_icon("close", "Tabs", theme->get_icon("GuiClose", "EditorIcons")); + theme->set_stylebox("button_pressed", "Tabs", style_menu); + theme->set_stylebox("button", "Tabs", style_menu); // Separators (no separators) theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width)); diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp index dc581a71e2..f9516dad99 100644 --- a/main/tests/test_shader_lang.cpp +++ b/main/tests/test_shader_lang.cpp @@ -56,8 +56,6 @@ static String _mktab(int p_level) { static String _typestr(SL::DataType p_type) { return ShaderLanguage::get_datatype_name(p_type); - - return ""; } static String _prestr(SL::DataPrecision p_pres) { diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gd_function.h index 6d20b19777..661de0acce 100644 --- a/modules/gdscript/gd_function.h +++ b/modules/gdscript/gd_function.h @@ -210,8 +210,9 @@ public: #ifdef TOOLS_ENABLED ERR_FAIL_INDEX_V(p_idx, arg_names.size(), StringName()); return arg_names[p_idx]; -#endif +#else return StringName(); +#endif } Variant get_default_argument(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, default_arguments.size(), Variant()); diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 2d06c0f5d2..23201dc1b0 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -559,8 +559,9 @@ bool GDScript::_update_exports() { return changed; -#endif +#else return false; +#endif } void GDScript::update_exports() { diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 7b8b2abebb..5ad16c7337 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -49,7 +49,7 @@ void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fra //end of file! if (vorbis_stream->loop) { //loop - seek_pos(0); + seek_pos(vorbis_stream->loop_offset); loops++; } else { for (int i = mixed; i < p_frames; i++) { @@ -227,6 +227,14 @@ bool AudioStreamOGGVorbis::has_loop() const { return loop; } +void AudioStreamOGGVorbis::set_loop_offset(float p_seconds) { + loop_offset = p_seconds; +} + +float AudioStreamOGGVorbis::get_loop_offset() const { + return loop_offset; +} + void AudioStreamOGGVorbis::_bind_methods() { ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamOGGVorbis::set_data); @@ -235,8 +243,12 @@ void AudioStreamOGGVorbis::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop", "enable"), &AudioStreamOGGVorbis::set_loop); ClassDB::bind_method(D_METHOD("has_loop"), &AudioStreamOGGVorbis::has_loop); + ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOGGVorbis::set_loop_offset); + ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOGGVorbis::get_loop_offset); + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop", "has_loop"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "loop_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop_offset", "get_loop_offset"); } AudioStreamOGGVorbis::AudioStreamOGGVorbis() { @@ -245,6 +257,7 @@ AudioStreamOGGVorbis::AudioStreamOGGVorbis() { length = 0; sample_rate = 1; channels = 1; + loop_offset = 0; decode_mem_size = 0; loop = false; } diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h index 46cdfd3f2d..56bfe398c0 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h @@ -89,6 +89,7 @@ class AudioStreamOGGVorbis : public AudioStream { int channels; float length; bool loop; + float loop_offset; protected: static void _bind_methods(); @@ -97,6 +98,9 @@ public: void set_loop(bool p_enable); bool has_loop() const; + void set_loop_offset(float p_seconds); + float get_loop_offset() const; + virtual Ref<AudioStreamPlayback> instance_playback(); virtual String get_stream_name() const; diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp index f0a7ee1ec6..5a1157bf9c 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp @@ -72,11 +72,13 @@ String ResourceImporterOGGVorbis::get_preset_name(int p_idx) const { void ResourceImporterOGGVorbis::get_import_options(List<ImportOption> *r_options, int p_preset) const { r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "loop_offset"), 0)); } Error ResourceImporterOGGVorbis::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files) { bool loop = p_options["loop"]; + float loop_offset = p_options["loop_offset"]; FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ); if (!f) { @@ -98,6 +100,7 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin ogg_stream->set_data(data); ogg_stream->set_loop(loop); + ogg_stream->set_loop_offset(loop_offset); return ResourceSaver::save(p_save_path + ".oggstr", ogg_stream); } diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index 46931fb0f6..c74188d9ea 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -82,9 +82,9 @@ Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, const char *s size_t str_len = strlen(svg_str); PoolVector<uint8_t> src_data; - src_data.resize(str_len); + src_data.resize(str_len + 1); PoolVector<uint8_t>::Write src_w = src_data.write(); - memcpy(src_w.ptr(), svg_str, str_len); + memcpy(src_w.ptr(), svg_str, str_len + 1); return _create_image(p_image, &src_data, p_scale, upsample); } @@ -93,9 +93,10 @@ Error ImageLoaderSVG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force uint32_t size = f->get_len(); PoolVector<uint8_t> src_image; - src_image.resize(size); + src_image.resize(size + 1); PoolVector<uint8_t>::Write src_w = src_image.write(); f->get_buffer(src_w.ptr(), size); + src_w.ptr()[size] = '\0'; return _create_image(p_image, &src_image, p_scale, 1.0); } diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index 78b70934c0..25c2ebd6d2 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -585,7 +585,6 @@ Error VisualScriptExpression::_get_token(Token &r_token) { r_token.type = TK_BASIC_TYPE; r_token.value = i; return OK; - break; } } diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 5933b83d06..2dd2c0532a 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -833,7 +833,6 @@ void android_main(struct android_app *app) { if (engine.requested_quit) { engine_term_display(&engine); exit(0); - return; } // LOGI("end\n"); diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp index 4b62d70648..debdc22b65 100644 --- a/scene/2d/parallax_layer.cpp +++ b/scene/2d/parallax_layer.cpp @@ -34,11 +34,11 @@ void ParallaxLayer::set_motion_scale(const Size2 &p_scale) { + motion_scale = p_scale; + if (!get_parent()) return; - motion_scale = p_scale; - ParallaxBackground *pb = get_parent()->cast_to<ParallaxBackground>(); if (is_inside_tree() && pb) { Vector2 ofs = pb->get_final_offset(); @@ -54,11 +54,11 @@ Size2 ParallaxLayer::get_motion_scale() const { void ParallaxLayer::set_motion_offset(const Size2 &p_offset) { + motion_offset = p_offset; + if (!get_parent()) return; - motion_offset = p_offset; - ParallaxBackground *pb = get_parent()->cast_to<ParallaxBackground>(); if (is_inside_tree() && pb) { Vector2 ofs = pb->get_final_offset(); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 6a3ef66e0a..36fc9a6b3a 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1839,8 +1839,6 @@ Control *Control::find_prev_valid_focus() const { } return NULL; - - return NULL; } Control::FocusMode Control::get_focus_mode() const { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index f15fb71f87..68529ae255 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3656,9 +3656,6 @@ void TextEdit::cut() { void TextEdit::copy() { - if (!selection.active) - return; - if (!selection.active) { String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); OS::get_singleton()->set_clipboard(clipboard); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 00460e9eda..10ab28150b 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -630,7 +630,7 @@ void SceneTree::_notification(int p_notification) { case NOTIFICATION_WM_ABOUT: { #ifdef TOOLS_ENABLED - if (Engine::get_singleton()->is_editor_hint()) { + if (EditorNode::get_singleton()) { EditorNode::get_singleton()->show_about(); } else { #endif diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 3100aab8ad..7b2a9ffbc2 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -273,8 +273,8 @@ void StyleBoxTexture::_bind_methods() { ClassDB::bind_method(D_METHOD("get_margin_size", "margin"), &StyleBoxTexture::get_margin_size); ClassDB::bind_method(D_METHOD("set_expand_margin_size", "margin", "size"), &StyleBoxTexture::set_expand_margin_size); - ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxFlat::set_expand_margin_size_all); - ClassDB::bind_method(D_METHOD("set_expand_margin_individual", "size_left", "size_top", "size_right", "size_bottom"), &StyleBoxFlat::set_expand_margin_size_individual); + ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxTexture::set_expand_margin_size_all); + ClassDB::bind_method(D_METHOD("set_expand_margin_individual", "size_left", "size_top", "size_right", "size_bottom"), &StyleBoxTexture::set_expand_margin_size_individual); ClassDB::bind_method(D_METHOD("get_expand_margin_size", "margin"), &StyleBoxTexture::get_expand_margin_size); ClassDB::bind_method(D_METHOD("set_region_rect", "region"), &StyleBoxTexture::set_region_rect); |