diff options
87 files changed, 401 insertions, 219 deletions
diff --git a/SConstruct b/SConstruct index e943f8dc04..f32924835d 100644 --- a/SConstruct +++ b/SConstruct @@ -189,7 +189,7 @@ Help(opts.GenerateHelpText(env_base)) # generate help # add default include paths -env_base.Append(CPPPATH=['#editor', '#']) +env_base.Prepend(CPPPATH=['#', '#editor']) # configure ENV for platform env_base.platform_exporters = platform_exporters diff --git a/core/SCsub b/core/SCsub index d5be74a64f..06efc8408d 100644 --- a/core/SCsub +++ b/core/SCsub @@ -80,9 +80,9 @@ if env['builtin_zlib']: ] thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources] - env_thirdparty.Append(CPPPATH=[thirdparty_zlib_dir]) + env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir]) # Needs to be available in main env too - env.Append(CPPPATH=[thirdparty_zlib_dir]) + env.Prepend(CPPPATH=[thirdparty_zlib_dir]) env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources) @@ -128,9 +128,9 @@ if env['builtin_zstd']: ] thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources] - env_thirdparty.Append(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"]) + env_thirdparty.Prepend(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"]) env_thirdparty.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY") - env.Append(CPPPATH=thirdparty_zstd_dir) + env.Prepend(CPPPATH=thirdparty_zstd_dir) # Also needed in main env includes will trigger warnings env.Append(CPPFLAGS="-DZSTD_STATIC_LINKING_ONLY") diff --git a/core/list.h b/core/list.h index c21c20ba34..103a82a31d 100644 --- a/core/list.h +++ b/core/list.h @@ -503,8 +503,7 @@ public: if (p_I->prev_ptr) p_I->prev_ptr->next_ptr = p_I->next_ptr; - if (p_I->next_ptr) - p_I->next_ptr->prev_ptr = p_I->prev_ptr; + p_I->next_ptr->prev_ptr = p_I->prev_ptr; _data->last->next_ptr = p_I; p_I->prev_ptr = _data->last; @@ -538,8 +537,7 @@ public: if (_data->last == p_I) _data->last = p_I->prev_ptr; - if (p_I->prev_ptr) - p_I->prev_ptr->next_ptr = p_I->next_ptr; + p_I->prev_ptr->next_ptr = p_I->next_ptr; if (p_I->next_ptr) p_I->next_ptr->prev_ptr = p_I->prev_ptr; diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 133dcc7ab9..079c9b524f 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -64,6 +64,7 @@ const char *Expression::func_name[Expression::FUNC_MAX] = { "is_inf", "ease", "decimals", + "step_decimals", "stepify", "lerp", "inverse_lerp", @@ -149,6 +150,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) { case MATH_ISNAN: case MATH_ISINF: case MATH_DECIMALS: + case MATH_STEP_DECIMALS: case MATH_SEED: case MATH_RANDSEED: case MATH_DEG2RAD: @@ -365,6 +367,11 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant VALIDATE_ARG_NUM(0); *r_return = Math::step_decimals((double)*p_inputs[0]); } break; + case MATH_STEP_DECIMALS: { + + VALIDATE_ARG_NUM(0); + *r_return = Math::step_decimals((double)*p_inputs[0]); + } break; case MATH_STEPIFY: { VALIDATE_ARG_NUM(0); diff --git a/core/math/expression.h b/core/math/expression.h index f9075cb689..f20619f0b6 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -62,6 +62,7 @@ public: MATH_ISINF, MATH_EASE, MATH_DECIMALS, + MATH_STEP_DECIMALS, MATH_STEPIFY, MATH_LERP, MATH_INVERSE_LERP, diff --git a/core/math/rect2.h b/core/math/rect2.h index 3b66617c83..d636aa223f 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -67,7 +67,7 @@ struct Rect2 { if (p_point.x < position.x) { real_t d = position.x - p_point.x; - dist = inside ? d : MIN(dist, d); + dist = d; inside = false; } if (p_point.y < position.y) { diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml index 22834a4c81..2f7f05b2e4 100644 --- a/doc/classes/@GDScript.xml +++ b/doc/classes/@GDScript.xml @@ -264,11 +264,7 @@ <argument index="0" name="step" type="float"> </argument> <description> - Returns the position of the first non-zero digit, after the decimal point. - [codeblock] - # n is 2 - n = decimals(0.035) - [/codeblock] + Deprecated alias for "[method step_decimals]". </description> </method> <method name="dectime"> @@ -1023,6 +1019,23 @@ [/codeblock] </description> </method> + <method name="step_decimals"> + <return type="float"> + </return> + <argument index="0" name="step" type="float"> + </argument> + <description> + Returns the position of the first non-zero digit, after the decimal point. + [codeblock] + # n is 0 + n = step_decimals(5) + # n is 4 + n = step_decimals(1.0005) + # n is 9 + n = step_decimals(0.000000005) + [/codeblock] + </description> + </method> <method name="stepify"> <return type="float"> </return> diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml index 87bf0b79b6..c85a2c4b38 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/VisualServer.xml @@ -2003,6 +2003,17 @@ <description> </description> </method> + <method name="light_set_use_gi"> + <return type="void"> + </return> + <argument index="0" name="light" type="RID"> + </argument> + <argument index="1" name="enabled" type="bool"> + </argument> + <description> + Sets whether GI probes capture light information from this light. + </description> + </method> <method name="light_set_color"> <return type="void"> </return> diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index c0e07e0b8d..3b31da1dd7 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -484,6 +484,7 @@ public: void light_set_negative(RID p_light, bool p_enable) {} void light_set_cull_mask(RID p_light, uint32_t p_mask) {} void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {} + void light_set_use_gi(RID p_light, bool p_enabled) {} void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) {} void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) {} @@ -503,6 +504,7 @@ public: AABB light_get_aabb(RID p_light) const { return AABB(); } float light_get_param(RID p_light, VS::LightParam p_param) { return 0.0; } Color light_get_color(RID p_light) { return Color(); } + bool light_get_use_gi(RID p_light) { return false; } uint64_t light_get_version(RID p_light) const { return 0; } /* PROBE API */ diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index efb26a7908..ef5b57a0cc 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -10,7 +10,7 @@ if (env["platform"] in ["haiku", "osx", "windows", "x11"]): ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env.Append(CPPPATH=[thirdparty_dir]) + env.Prepend(CPPPATH=[thirdparty_dir]) env.Append(CPPFLAGS=['-DGLAD_ENABLED']) env.Append(CPPFLAGS=['-DGLES_OVER_GL']) diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 9f1425189c..99eb0665d6 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -2845,7 +2845,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - render_list.sort_by_depth(true); + render_list.sort_by_reverse_depth_and_priority(true); _render_render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, cam_transform, p_cam_projection, p_shadow_atlas, env, env_radiance_tex, 0.0, 0.0, reverse_cull, true, false); diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h index f23e45b52f..48672991d1 100644 --- a/drivers/gles2/rasterizer_scene_gles2.h +++ b/drivers/gles2/rasterizer_scene_gles2.h @@ -502,7 +502,8 @@ public: enum { MAX_LIGHTS = 255, MAX_REFLECTION_PROBES = 255, - DEFAULT_MAX_ELEMENTS = 65536 + DEFAULT_MAX_ELEMENTS = 65536, + SORT_KEY_PRIORITY_SHIFT = 56 }; int max_elements; @@ -598,6 +599,29 @@ public: } } + struct SortByReverseDepthAndPriority { + + _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const { + uint32_t layer_A = uint32_t(A->sort_key >> SORT_KEY_PRIORITY_SHIFT); + uint32_t layer_B = uint32_t(B->sort_key >> SORT_KEY_PRIORITY_SHIFT); + if (layer_A == layer_B) { + return A->instance->depth > B->instance->depth; + } else { + return layer_A < layer_B; + } + } + }; + + void sort_by_reverse_depth_and_priority(bool p_alpha) { //used for alpha + + SortArray<Element *, SortByReverseDepthAndPriority> sorter; + if (p_alpha) { + sorter.sort(&elements[max_elements - alpha_element_count], alpha_element_count); + } else { + sorter.sort(elements, element_count); + } + } + // element adding and stuff _FORCE_INLINE_ Element *add_element() { diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index 1e32d8166f..13fdd1db73 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -3712,6 +3712,7 @@ RID RasterizerStorageGLES2::light_create(VS::LightType p_type) { light->directional_blend_splits = false; light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE; light->reverse_cull = false; + light->use_gi = true; light->version = 0; return light_owner.make_rid(light); @@ -3799,6 +3800,16 @@ void RasterizerStorageGLES2::light_set_reverse_cull_face_mode(RID p_light, bool light->instance_change_notify(true, false); } +void RasterizerStorageGLES2::light_set_use_gi(RID p_light, bool p_enabled) { + Light *light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + + light->use_gi = p_enabled; + + light->version++; + light->instance_change_notify(true, false); +} + void RasterizerStorageGLES2::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3894,6 +3905,13 @@ Color RasterizerStorageGLES2::light_get_color(RID p_light) { return light->color; } +bool RasterizerStorageGLES2::light_get_use_gi(RID p_light) { + Light *light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light, false); + + return light->use_gi; +} + bool RasterizerStorageGLES2::light_has_shadow(RID p_light) const { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND_V(!light, false); diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index 2ac68fa47a..d6130849fb 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -910,6 +910,7 @@ public: bool shadow; bool negative; bool reverse_cull; + bool use_gi; uint32_t cull_mask; @@ -936,6 +937,7 @@ public: virtual void light_set_negative(RID p_light, bool p_enable); virtual void light_set_cull_mask(RID p_light, uint32_t p_mask); virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled); + virtual void light_set_use_gi(RID p_light, bool p_enabled); virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode); virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail); @@ -955,6 +957,7 @@ public: virtual VS::LightType light_get_type(RID p_light) const; virtual float light_get_param(RID p_light, VS::LightParam p_param); virtual Color light_get_color(RID p_light); + virtual bool light_get_use_gi(RID p_light); virtual AABB light_get_aabb(RID p_light) const; virtual uint64_t light_get_version(RID p_light) const; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index be44d62efc..95d4bec611 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -5219,6 +5219,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) { light->directional_blend_splits = false; light->directional_range_mode = VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE; light->reverse_cull = false; + light->use_gi = true; light->version = 0; return light_owner.make_rid(light); @@ -5310,6 +5311,15 @@ void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool light->instance_change_notify(true, false); } +void RasterizerStorageGLES3::light_set_use_gi(RID p_light, bool p_enabled) { + Light *light = light_owner.getornull(p_light); + ERR_FAIL_COND(!light); + + light->use_gi = p_enabled; + + light->version++; + light->instance_change_notify(true, false); +} void RasterizerStorageGLES3::light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) { Light *light = light_owner.getornull(p_light); @@ -5415,6 +5425,13 @@ Color RasterizerStorageGLES3::light_get_color(RID p_light) { return light->color; } +bool RasterizerStorageGLES3::light_get_use_gi(RID p_light) { + Light *light = light_owner.getornull(p_light); + ERR_FAIL_COND_V(!light, false); + + return light->use_gi; +} + bool RasterizerStorageGLES3::light_has_shadow(RID p_light) const { const Light *light = light_owner.getornull(p_light); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 92916ed808..a4cc84ef02 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -930,6 +930,7 @@ public: bool shadow; bool negative; bool reverse_cull; + bool use_gi; uint32_t cull_mask; VS::LightOmniShadowMode omni_shadow_mode; VS::LightOmniShadowDetail omni_shadow_detail; @@ -951,6 +952,7 @@ public: virtual void light_set_negative(RID p_light, bool p_enable); virtual void light_set_cull_mask(RID p_light, uint32_t p_mask); virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled); + virtual void light_set_use_gi(RID p_light, bool p_enabled); virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode); virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail); @@ -970,6 +972,7 @@ public: virtual VS::LightType light_get_type(RID p_light) const; virtual float light_get_param(RID p_light, VS::LightParam p_param); virtual Color light_get_color(RID p_light); + virtual bool light_get_use_gi(RID p_light); virtual AABB light_get_aabb(RID p_light) const; virtual uint64_t light_get_version(RID p_light) const; diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 97ba1de3db..9dc80244ff 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -26,9 +26,9 @@ if env['builtin_libpng']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_png.Append(CPPPATH=[thirdparty_dir]) + env_png.Prepend(CPPPATH=[thirdparty_dir]) # Needed for drivers includes and in platform/javascript - env.Append(CPPPATH=[thirdparty_dir]) + env.Prepend(CPPPATH=[thirdparty_dir]) # Currently .ASM filter_neon.S does not compile on NT. import os diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index f6d4a2665c..e524dffd43 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -453,6 +453,8 @@ void AnimationBezierTrackEdit::_notification(int p_what) { ep.point_rect.size = bezier_icon->get_size(); if (selection.has(i)) { draw_texture(selected_icon, ep.point_rect.position); + draw_string(font, ep.point_rect.position + Vector2(8, -font->get_height() - 4), TTR("Time:") + " " + rtos(Math::stepify(offset, 0.001)), accent); + draw_string(font, ep.point_rect.position + Vector2(8, -8), TTR("Value:") + " " + rtos(Math::stepify(value, 0.001)), accent); } else { draw_texture(bezier_icon, ep.point_rect.position); } @@ -518,6 +520,12 @@ void AnimationBezierTrackEdit::set_animation_and_track(const Ref<Animation> &p_a animation = p_animation; track = p_track; + if (is_connected("select_key", editor, "_key_selected")) + disconnect("select_key", editor, "_key_selected"); + if (is_connected("deselect_key", editor, "_key_deselected")) + disconnect("deselect_key", editor, "_key_deselected"); + connect("select_key", editor, "_key_selected", varray(p_track), CONNECT_DEFERRED); + connect("deselect_key", editor, "_key_deselected", varray(p_track), CONNECT_DEFERRED); update(); } @@ -536,6 +544,7 @@ void AnimationBezierTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) { } void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) { editor = p_editor; + connect("clear_selection", editor, "_clear_selection"); } void AnimationBezierTrackEdit::_play_position_draw() { @@ -578,6 +587,7 @@ String AnimationBezierTrackEdit::get_tooltip(const Point2 &p_pos) const { void AnimationBezierTrackEdit::_clear_selection() { selection.clear(); + emit_signal("clear_selection"); update(); } @@ -598,6 +608,7 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int ERR_FAIL_COND(idx < 0); selection.insert(idx); + emit_signal("select_key", idx, true); update(); } @@ -653,20 +664,22 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { menu_insert_key = mb->get_position(); - Vector2 popup_pos = get_global_transform().xform(mb->get_position()); - - menu->clear(); - menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT); - if (selection.size()) { - menu->add_separator(); - menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE); - menu->add_separator(); - menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE); - } + if (menu_insert_key.x >= timeline->get_name_limit() && menu_insert_key.x <= get_size().width - timeline->get_buttons_width()) { + Vector2 popup_pos = get_global_transform().xform(mb->get_position()); + + menu->clear(); + menu->add_icon_item(bezier_icon, TTR("Insert Key Here"), MENU_KEY_INSERT); + if (selection.size()) { + menu->add_separator(); + menu->add_icon_item(get_icon("Duplicate", "EditorIcons"), TTR("Duplicate Selected Key(s)"), MENU_KEY_DUPLICATE); + menu->add_separator(); + menu->add_icon_item(get_icon("Remove", "EditorIcons"), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE); + } - menu->set_as_minsize(); - menu->set_position(popup_pos); - menu->popup(); + menu->set_as_minsize(); + menu->set_position(popup_pos); + menu->popup(); + } } if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { @@ -678,6 +691,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { for (Map<int, Rect2>::Element *E = subtracks.front(); E; E = E->next()) { if (E->get().has_point(mb->get_position())) { set_animation_and_track(animation, E->key()); + _clear_selection(); return; } } @@ -850,7 +864,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { // 2- remove overlapped keys for (Set<int>::Element *E = selection.back(); E; E = E->prev()) { - float newtime = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x; + float newtime = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x); int idx = animation->track_find_key(track, newtime, true); if (idx == -1) @@ -872,7 +886,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { // 3-move the keys (re insert them) for (Set<int>::Element *E = selection.back(); E; E = E->prev()) { - float newpos = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x; + float newpos = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x); /* if (newpos<0) continue; //no add at the beginning @@ -887,7 +901,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { // 4-(undo) remove inserted keys for (Set<int>::Element *E = selection.back(); E; E = E->prev()) { - float newpos = animation->track_get_key_time(track, E->get()) + moving_selection_offset.x; + float newpos = editor->snap_time(animation->track_get_key_time(track, E->get()) + moving_selection_offset.x); /* if (newpos<0) continue; //no remove what no inserted @@ -924,7 +938,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { for (Set<int>::Element *E = selection.back(); E; E = E->prev()) { float oldpos = animation->track_get_key_time(track, E->get()); - float newpos = oldpos + moving_selection_offset.x; + float newpos = editor->snap_time(oldpos + moving_selection_offset.x); undo_redo->add_do_method(this, "_select_at_anim", animation, track, newpos); undo_redo->add_undo_method(this, "_select_at_anim", animation, track, oldpos); @@ -965,7 +979,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { } float y = (get_size().height / 2 - mm->get_position().y) * v_zoom + v_scroll; - float x = ((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value(); + float x = editor->snap_time(((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value()); moving_selection_offset = Vector2(x - animation->track_get_key_time(track, moving_selection_from_key), y - animation->bezier_track_get_key_value(track, moving_selection_from_key)); update(); @@ -1154,8 +1168,8 @@ void AnimationBezierTrackEdit::_bind_methods() { ClassDB::bind_method("_play_position_draw", &AnimationBezierTrackEdit::_play_position_draw); ClassDB::bind_method("_clear_selection", &AnimationBezierTrackEdit::_clear_selection); - ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection); - ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_clear_selection); + ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection_for_anim); + ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_select_at_anim); ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag"))); ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track"))); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 4dff7d5b69..61244ab78c 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -309,8 +309,8 @@ public: setting = true; undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS); Vector2 prev = animation->bezier_track_get_key_in_handle(track, key); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_in_handle", track, key, value); - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_in_handle", track, key, prev); + undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, value); + undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev); undo_redo->add_do_method(this, "_update_obj", animation); undo_redo->add_undo_method(this, "_update_obj", animation); undo_redo->commit_action(); @@ -325,8 +325,8 @@ public: setting = true; undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS); Vector2 prev = animation->bezier_track_get_key_out_handle(track, key); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_out_handle", track, key, value); - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_out_handle", track, key, prev); + undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, value); + undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev); undo_redo->add_do_method(this, "_update_obj", animation); undo_redo->add_undo_method(this, "_update_obj", animation); undo_redo->commit_action(); @@ -1274,13 +1274,7 @@ void AnimationTrackEdit::_notification(int p_what) { } else if (animation->track_get_type(track) == Animation::TYPE_ANIMATION) { text = TTR("Anim Clips:"); } else { - Vector<StringName> sn = path.get_subnames(); - for (int i = 0; i < sn.size(); i++) { - if (i > 0) { - text += "."; - } - text += sn[i]; - } + text += path.get_concatenated_subnames(); } text_color.a *= 0.7; } else if (node) { @@ -1294,14 +1288,10 @@ void AnimationTrackEdit::_notification(int p_what) { draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2)); icon_cache = icon; - text = node->get_name(); + text = String() + node->get_name() + ":" + path.get_concatenated_subnames(); ofs += hsep; ofs += icon->get_width(); - Vector<StringName> sn = path.get_subnames(); - for (int i = 0; i < sn.size(); i++) { - text += "."; - text += sn[i]; - } + } else { icon_cache = type_icon; @@ -3536,7 +3526,10 @@ void AnimationTrackEditor::_animation_changed() { if (key_edit && key_edit->setting) { //if editing a key, just update the edited track, makes refresh less costly if (key_edit->track < track_edits.size()) { - track_edits[key_edit->track]->update(); + if (animation->track_get_type(key_edit->track) == Animation::TYPE_BEZIER) + bezier_edit->update(); + else + track_edits[key_edit->track]->update(); } return; } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index d2ff65246d..e80d3e1b37 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -407,6 +407,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("text_editor/theme/color_theme", "Adaptive"); hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Adaptive,Default,Custom"); _initial_set("text_editor/theme/line_spacing", 6); + hints["text_editor/theme/line_spacing"] = PropertyInfo(Variant::INT, "text_editor/theme/line_spacing", PROPERTY_HINT_RANGE, "0,50,1"); _load_default_text_editor_theme(); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 41f35c3bed..7c075b5635 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -846,6 +846,12 @@ void AnimationPlayerEditor::_update_player() { onion_skinning->set_disabled(player == NULL); pin->set_disabled(player == NULL); + if (!player) { + AnimationPlayerEditor::singleton->get_track_editor()->update_keying(); + EditorNode::get_singleton()->update_keying(); + return; + } + int active_idx = -1; for (List<StringName>::Element *E = animlist.front(); E; E = E->next()) { @@ -858,12 +864,6 @@ void AnimationPlayerEditor::_update_player() { active_idx = animation->get_item_count() - 1; } - if (!player) { - AnimationPlayerEditor::singleton->get_track_editor()->update_keying(); - EditorNode::get_singleton()->update_keying(); - return; - } - updating = false; if (active_idx != -1) { animation->select(active_idx); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 88bb8e38fe..c0f2410636 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1471,10 +1471,14 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) { if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, false); break; case DRAG_ANCHOR_ALL: - if (!use_single_axis || !use_y) control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true); - if (!use_single_axis || !use_y) control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true); - if (!use_single_axis || use_y) control->set_anchor(MARGIN_TOP, new_anchor.y, false, true); - if (!use_single_axis || use_y) control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true); + if (!use_single_axis || !use_y) { + control->set_anchor(MARGIN_LEFT, new_anchor.x, false, true); + control->set_anchor(MARGIN_RIGHT, new_anchor.x, false, true); + } + if (!use_single_axis || use_y) { + control->set_anchor(MARGIN_TOP, new_anchor.y, false, true); + control->set_anchor(MARGIN_BOTTOM, new_anchor.y, false, true); + } break; default: break; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 66766f7ccf..709c2caa96 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -765,7 +765,7 @@ public: set_title(TTR("Install Project:") + " " + zip_title); get_ok()->set_text(TTR("Install & Edit")); - name_container->hide(); + name_container->show(); install_path_container->hide(); rasterizer_container->hide(); project_path->grab_focus(); diff --git a/modules/assimp/SCsub b/modules/assimp/SCsub index 61a357809a..0da7e432e2 100644 --- a/modules/assimp/SCsub +++ b/modules/assimp/SCsub @@ -4,19 +4,19 @@ Import('env') Import('env_modules') env_assimp = env_modules.Clone() -env_assimp.Append(CPPPATH=['#thirdparty/assimp']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/include']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/IFC']) -env_assimp.Append(CPPPATH=['#thirdparty/misc']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/code']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/irrXML/']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/unzip/']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/']) -env_assimp.Append(CPPPATH=['#thirdparty/zlib/']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include']) -env_assimp.Append(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include']) -env_assimp.Append(CPPPATH=['.']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/include']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/IFC']) +env_assimp.Prepend(CPPPATH=['#thirdparty/misc']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/irrXML/']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/unzip/']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code/Importer/STEPParser']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/']) +env_assimp.Prepend(CPPPATH=['#thirdparty/zlib/']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/openddlparser/include']) +env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/contrib/rapidjson/include']) +env_assimp.Prepend(CPPPATH=['.']) #env_assimp.Append(CPPFLAGS=['-DASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support env_assimp.Append(CPPFLAGS=['-DASSIMP_BUILD_BOOST_WORKAROUND']) env_assimp.Append(CPPFLAGS=['-DOPENDDLPARSER_BUILD']) diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub index e7c2fff54c..16d694c238 100644 --- a/modules/bullet/SCsub +++ b/modules/bullet/SCsub @@ -186,7 +186,7 @@ if env['builtin_bullet']: thirdparty_sources = [thirdparty_dir + file for file in bullet2_src] - env_bullet.Append(CPPPATH=[thirdparty_dir]) + env_bullet.Prepend(CPPPATH=[thirdparty_dir]) # if env['target'] == "debug" or env['target'] == "release_debug": # env_bullet.Append(CPPFLAGS=['-DBT_DEBUG']) diff --git a/modules/cvtt/SCsub b/modules/cvtt/SCsub index fcc69d8371..142af0c800 100644 --- a/modules/cvtt/SCsub +++ b/modules/cvtt/SCsub @@ -14,7 +14,7 @@ if env['builtin_squish']: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_cvtt.Append(CPPPATH=[thirdparty_dir]) + env_cvtt.Prepend(CPPPATH=[thirdparty_dir]) env_thirdparty = env_cvtt.Clone() env_thirdparty.disable_warnings() diff --git a/modules/enet/SCsub b/modules/enet/SCsub index a57a4b29ea..78d8d43414 100644 --- a/modules/enet/SCsub +++ b/modules/enet/SCsub @@ -21,7 +21,7 @@ if env['builtin_enet']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_enet.Append(CPPPATH=[thirdparty_dir]) + env_enet.Prepend(CPPPATH=[thirdparty_dir]) env_enet.Append(CPPFLAGS=["-DGODOT_ENET"]) env_thirdparty = env_enet.Clone() diff --git a/modules/etc/SCsub b/modules/etc/SCsub index eb2738053b..532b97b006 100644 --- a/modules/etc/SCsub +++ b/modules/etc/SCsub @@ -27,7 +27,7 @@ thirdparty_sources = [ ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] -env_etc.Append(CPPPATH=[thirdparty_dir]) +env_etc.Prepend(CPPPATH=[thirdparty_dir]) # upstream uses c++11 if not env.msvc: diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index f2cd9f9a60..0c8b223a9e 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -68,9 +68,9 @@ if env['builtin_freetype']: sfnt = env_freetype.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__']) thirdparty_sources += [sfnt] - env_freetype.Append(CPPPATH=[thirdparty_dir + "/include"]) + env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"]) # Also needed in main env for scene/ - env.Append(CPPPATH=[thirdparty_dir + "/include"]) + env.Prepend(CPPPATH=[thirdparty_dir + "/include"]) env_freetype.Append(CPPFLAGS=['-DFT2_BUILD_LIBRARY', '-DFT_CONFIG_OPTION_USE_PNG']) if (env['target'] != 'release'): @@ -78,7 +78,7 @@ if env['builtin_freetype']: # Also requires libpng headers if env['builtin_libpng']: - env_freetype.Append(CPPPATH=["#thirdparty/libpng"]) + env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"]) env_thirdparty = env_freetype.Clone() env_thirdparty.disable_warnings() diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index 235f0b97bb..0cdd585558 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -12,7 +12,7 @@ env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp") env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp") env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp") -env_gdnative.Append(CPPPATH=['#modules/gdnative/include/']) +env_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/']) Export('env_gdnative') @@ -36,7 +36,7 @@ if ARGUMENTS.get('gdnative_wrapper', False): gensource, = env_gdnative.CommandNoCache('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code)) gd_wrapper_env = env.Clone() - gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/']) + gd_wrapper_env.Prepend(CPPPATH=['#modules/gdnative/include/']) if gd_wrapper_env['use_lto']: if not env.msvc: diff --git a/modules/gdnative/videodecoder/SCsub b/modules/gdnative/videodecoder/SCsub index 8d9c1ff50e..04cc8ed604 100644 --- a/modules/gdnative/videodecoder/SCsub +++ b/modules/gdnative/videodecoder/SCsub @@ -5,5 +5,5 @@ Import('env_modules') env_vsdecoder_gdnative = env_modules.Clone() -env_vsdecoder_gdnative.Append(CPPPATH=['#modules/gdnative/include/']) +env_vsdecoder_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/']) env_vsdecoder_gdnative.add_source_files(env.modules_sources, '*.cpp') diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 1d75d9e2fe..38009b878d 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -407,9 +407,10 @@ public: csi.resize(_debug_call_stack_pos); for (int i = 0; i < _debug_call_stack_pos; i++) { csi.write[_debug_call_stack_pos - i - 1].line = _call_stack[i].line ? *_call_stack[i].line : 0; - if (_call_stack[i].function) + if (_call_stack[i].function) { csi.write[_debug_call_stack_pos - i - 1].func = _call_stack[i].function->get_name(); - csi.write[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path(); + csi.write[_debug_call_stack_pos - i - 1].file = _call_stack[i].function->get_script()->get_path(); + } } return csi; } diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 69bf114c8e..bcf3140fa6 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2178,7 +2178,6 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p static void _find_call_arguments(const GDScriptCompletionContext &p_context, const GDScriptCompletionIdentifier &p_base, const StringName &p_method, int p_argidx, bool p_static, Set<String> &r_result, String &r_arghint) { Variant base = p_base.value; GDScriptParser::DataType base_type = p_base.type; - bool _static = false; const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\""; @@ -2191,12 +2190,10 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con return; } } - if (!_static) { - for (int i = 0; i < base_type.class_type->functions.size(); i++) { - if (base_type.class_type->functions[i]->name == p_method) { - r_arghint = _make_arguments_hint(base_type.class_type->functions[i], p_argidx); - return; - } + for (int i = 0; i < base_type.class_type->functions.size(); i++) { + if (base_type.class_type->functions[i]->name == p_method) { + r_arghint = _make_arguments_hint(base_type.class_type->functions[i], p_argidx); + return; } } diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 7552bc6bff..5ebcddfd7c 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -72,6 +72,7 @@ const char *GDScriptFunctions::get_func_name(Function p_func) { "is_zero_approx", "ease", "decimals", + "step_decimals", "stepify", "lerp", "inverse_lerp", @@ -339,6 +340,13 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ VALIDATE_ARG_COUNT(1); VALIDATE_ARG_NUM(0); r_ret = Math::step_decimals((double)*p_args[0]); + ERR_EXPLAIN("GDScript method 'decimals' is deprecated and has been renamed to 'step_decimals', please update your code accordingly."); + WARN_DEPRECATED + } break; + case MATH_STEP_DECIMALS: { + VALIDATE_ARG_COUNT(1); + VALIDATE_ARG_NUM(0); + r_ret = Math::step_decimals((double)*p_args[0]); } break; case MATH_STEPIFY: { VALIDATE_ARG_COUNT(2); @@ -1452,6 +1460,7 @@ bool GDScriptFunctions::is_deterministic(Function p_func) { case MATH_ISINF: case MATH_EASE: case MATH_DECIMALS: + case MATH_STEP_DECIMALS: case MATH_STEPIFY: case MATH_LERP: case MATH_INVERSE_LERP: @@ -1626,7 +1635,12 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { } break; case MATH_DECIMALS: { MethodInfo mi("decimals", PropertyInfo(Variant::REAL, "step")); - mi.return_val.type = Variant::REAL; + mi.return_val.type = Variant::INT; + return mi; + } break; + case MATH_STEP_DECIMALS: { + MethodInfo mi("step_decimals", PropertyInfo(Variant::REAL, "step")); + mi.return_val.type = Variant::INT; return mi; } break; case MATH_STEPIFY: { diff --git a/modules/gdscript/gdscript_functions.h b/modules/gdscript/gdscript_functions.h index 0dbd172acf..c594480ff8 100644 --- a/modules/gdscript/gdscript_functions.h +++ b/modules/gdscript/gdscript_functions.h @@ -63,6 +63,7 @@ public: MATH_ISZEROAPPROX, MATH_EASE, MATH_DECIMALS, + MATH_STEP_DECIMALS, MATH_STEPIFY, MATH_LERP, MATH_INVERSE_LERP, diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 80af094c2c..51ec0c1442 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -282,7 +282,6 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s switch (tokenizer->get_token()) { case GDScriptTokenizer::TK_CURSOR: { - completion_cursor = StringName(); completion_type = COMPLETION_GET_NODE; completion_class = current_class; completion_function = current_function; @@ -2870,8 +2869,6 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { lv->assign_op = op; lv->assign = assigned; - lv->assign_op = op; - if (!_end_statement()) { _set_error("Expected end of statement (var)"); return; @@ -6226,8 +6223,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { return DataType(); } #ifdef DEBUG_ENABLED - if (var_op == Variant::OP_DIVIDE && argument_a_type.has_type && argument_a_type.kind == DataType::BUILTIN && argument_a_type.builtin_type == Variant::INT && - argument_b_type.has_type && argument_b_type.kind == DataType::BUILTIN && argument_b_type.builtin_type == Variant::INT) { + if (var_op == Variant::OP_DIVIDE && argument_a_type.kind == DataType::BUILTIN && argument_a_type.builtin_type == Variant::INT && + argument_b_type.kind == DataType::BUILTIN && argument_b_type.builtin_type == Variant::INT) { _add_warning(GDScriptWarning::INTEGER_DIVISION, op->line); } #endif // DEBUG_ENABLED @@ -6938,10 +6935,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat #ifdef DEBUG_ENABLED if (current_function && !for_completion && !is_static && p_call->arguments[0]->type == Node::TYPE_SELF && current_function->_static) { - if (current_function && current_function->_static && p_call->arguments[0]->type == Node::TYPE_SELF) { - _set_error("Can't call non-static function from a static function.", p_call->line); - return DataType(); - } + _set_error("Can't call non-static function from a static function.", p_call->line); + return DataType(); } if (check_types && !is_static && !is_initializer && base_type.is_meta_type) { diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub index d5f87905eb..96e8e704dd 100644 --- a/modules/jpg/SCsub +++ b/modules/jpg/SCsub @@ -13,7 +13,7 @@ thirdparty_sources = [ ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] -env_jpg.Append(CPPPATH=[thirdparty_dir]) +env_jpg.Prepend(CPPPATH=[thirdparty_dir]) env_thirdparty = env_jpg.Clone() env_thirdparty.disable_warnings() diff --git a/modules/mono/build_scripts/mono_configure.py b/modules/mono/build_scripts/mono_configure.py index 160580e116..4cfa2a5b93 100644 --- a/modules/mono/build_scripts/mono_configure.py +++ b/modules/mono/build_scripts/mono_configure.py @@ -70,7 +70,7 @@ def configure(env, env_mono): mono_lib_path = os.path.join(mono_root, 'lib') env.Append(LIBPATH=mono_lib_path) - env_mono.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0')) + env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0')) if mono_static: lib_suffix = Environment()['LIBSUFFIX'] @@ -153,7 +153,7 @@ def configure(env, env_mono): mono_lib_path = os.path.join(mono_root, 'lib') env.Append(LIBPATH=mono_lib_path) - env_mono.Append(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0')) + env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0')) mono_lib = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension='.a') diff --git a/modules/mono/glue/Managed/Files/Mathf.cs b/modules/mono/glue/Managed/Files/Mathf.cs index 947fbb6665..ff26c7fddf 100644 --- a/modules/mono/glue/Managed/Files/Mathf.cs +++ b/modules/mono/glue/Managed/Files/Mathf.cs @@ -79,14 +79,27 @@ namespace Godot return (real_t)Math.Cosh(s); } - public static int Decimals(real_t step) - { - return Decimals((decimal)step); - } - - public static int Decimals(decimal step) - { - return BitConverter.GetBytes(decimal.GetBits(step)[3])[2]; + public static int StepDecimals(real_t step) + { + double[] sd = new double[] { + 0.9999, + 0.09999, + 0.009999, + 0.0009999, + 0.00009999, + 0.000009999, + 0.0000009999, + 0.00000009999, + 0.000000009999, + }; + double abs = Mathf.Abs(step); + double decs = abs - (int)abs; // Strip away integer part + for (int i = 0; i < sd.Length; i++) { + if (decs >= sd[i]) { + return i; + } + } + return 0; } public static real_t Deg2Rad(real_t deg) diff --git a/modules/mono/glue/Managed/Files/MathfEx.cs b/modules/mono/glue/Managed/Files/MathfEx.cs index d6eb65b097..b96f01bc2e 100644 --- a/modules/mono/glue/Managed/Files/MathfEx.cs +++ b/modules/mono/glue/Managed/Files/MathfEx.cs @@ -21,6 +21,16 @@ namespace Godot public const real_t Epsilon = 1e-06f; #endif + public static int DecimalCount(real_t s) + { + return DecimalCount((decimal)s); + } + + public static int DecimalCount(decimal s) + { + return BitConverter.GetBytes(decimal.GetBits(s)[3])[2]; + } + public static int CeilToInt(real_t s) { return (int)Math.Ceiling(s); diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index 0ef66577fe..1fdddd3925 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -33,6 +33,7 @@ #include "core/os/file_access.h" #include <stdio.h> +#include <stdlib.h> namespace { @@ -210,7 +211,7 @@ String str_format(const char *p_format, ...) { #endif #if defined(MINGW_ENABLED) || defined(_MSC_VER) -#define vsnprintf vsnprintf_s +#define vsnprintf(m_buffer, m_count, m_format, m_argptr) vsnprintf_s(m_buffer, m_count, _TRUNCATE, m_format, m_argptr) #endif String str_format(const char *p_format, va_list p_list) { diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub index 765a9fc11a..6a72a519fe 100644 --- a/modules/ogg/SCsub +++ b/modules/ogg/SCsub @@ -14,7 +14,7 @@ if env['builtin_libogg']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_ogg.Append(CPPPATH=[thirdparty_dir]) + env_ogg.Prepend(CPPPATH=[thirdparty_dir]) env_thirdparty = env_ogg.Clone() env_thirdparty.disable_warnings() diff --git a/modules/opensimplex/SCsub b/modules/opensimplex/SCsub index 4235f6a0b9..311d33b047 100644 --- a/modules/opensimplex/SCsub +++ b/modules/opensimplex/SCsub @@ -12,7 +12,7 @@ thirdparty_sources = [ ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] -env_opensimplex.Append(CPPPATH=[thirdparty_dir]) +env_opensimplex.Prepend(CPPPATH=[thirdparty_dir]) env_thirdparty = env_opensimplex.Clone() env_thirdparty.disable_warnings() diff --git a/modules/opus/SCsub b/modules/opus/SCsub index a1325734e2..f3c981dd45 100644 --- a/modules/opus/SCsub +++ b/modules/opus/SCsub @@ -206,7 +206,7 @@ if env['builtin_opus']: # also requires libogg if env['builtin_libogg']: - env_opus.Append(CPPPATH=["#thirdparty/libogg"]) + env_opus.Prepend(CPPPATH=["#thirdparty/libogg"]) env_opus.Append(CPPFLAGS=["-DHAVE_CONFIG_H"]) @@ -218,7 +218,7 @@ if env['builtin_opus']: "silk/fixed", "silk/float", ] - env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) + env_opus.Prepend(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) if env["platform"] == "android": if ("android_arch" in env and env["android_arch"] in ["armv6", "armv7"]): diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub index 2e4a792a36..18da38fbbd 100644 --- a/modules/pvr/SCsub +++ b/modules/pvr/SCsub @@ -17,7 +17,7 @@ thirdparty_sources = [ ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] -env_pvr.Append(CPPPATH=[thirdparty_dir]) +env_pvr.Prepend(CPPPATH=[thirdparty_dir]) env_thirdparty = env_pvr.Clone() env_thirdparty.disable_warnings() diff --git a/modules/recast/SCsub b/modules/recast/SCsub index 4a06653968..94d9968164 100644 --- a/modules/recast/SCsub +++ b/modules/recast/SCsub @@ -23,7 +23,7 @@ if env['builtin_recast']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_recast.Append(CPPPATH=[thirdparty_dir + "/Include"]) + env_recast.Prepend(CPPPATH=[thirdparty_dir + "/Include"]) env_thirdparty = env_recast.Clone() env_thirdparty.disable_warnings() diff --git a/modules/regex/SCsub b/modules/regex/SCsub index 99c25add45..65f354ffa7 100644 --- a/modules/regex/SCsub +++ b/modules/regex/SCsub @@ -46,7 +46,7 @@ if env['builtin_pcre2']: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_regex.Append(CPPPATH=[thirdparty_dir]) + env_regex.Prepend(CPPPATH=[thirdparty_dir]) env_regex.Append(CPPFLAGS=thirdparty_flags) def pcre2_builtin(width): diff --git a/modules/squish/SCsub b/modules/squish/SCsub index 3be85a1efa..15320bcd0c 100644 --- a/modules/squish/SCsub +++ b/modules/squish/SCsub @@ -22,7 +22,7 @@ if env['builtin_squish']: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_squish.Append(CPPPATH=[thirdparty_dir]) + env_squish.Prepend(CPPPATH=[thirdparty_dir]) env_thirdparty = env_squish.Clone() env_thirdparty.disable_warnings() diff --git a/modules/svg/SCsub b/modules/svg/SCsub index 66d9b3bf75..90bfe22abb 100644 --- a/modules/svg/SCsub +++ b/modules/svg/SCsub @@ -12,10 +12,10 @@ thirdparty_sources = [ ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] -env_svg.Append(CPPPATH=[thirdparty_dir]) +env_svg.Prepend(CPPPATH=[thirdparty_dir]) # FIXME: Needed in editor/editor_themes.cpp for now, but ideally there # shouldn't be a dependency on modules/ and its own 3rd party deps. -env.Append(CPPPATH=[thirdparty_dir]) +env.Prepend(CPPPATH=[thirdparty_dir]) env.Append(CPPFLAGS=["-DSVG_ENABLED"]) env_thirdparty = env_svg.Clone() diff --git a/modules/theora/SCsub b/modules/theora/SCsub index f98db2359c..785eca4c41 100644 --- a/modules/theora/SCsub +++ b/modules/theora/SCsub @@ -70,13 +70,13 @@ if env['builtin_libtheora']: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_theora.Append(CPPPATH=[thirdparty_dir]) + env_theora.Prepend(CPPPATH=[thirdparty_dir]) # also requires libogg and libvorbis if env['builtin_libogg']: - env_theora.Append(CPPPATH=["#thirdparty/libogg"]) + env_theora.Prepend(CPPPATH=["#thirdparty/libogg"]) if env['builtin_libvorbis']: - env_theora.Append(CPPPATH=["#thirdparty/libvorbis"]) + env_theora.Prepend(CPPPATH=["#thirdparty/libvorbis"]) env_thirdparty = env_theora.Clone() env_thirdparty.disable_warnings() diff --git a/modules/tinyexr/SCsub b/modules/tinyexr/SCsub index 3e7bda2bca..97f9797b58 100644 --- a/modules/tinyexr/SCsub +++ b/modules/tinyexr/SCsub @@ -13,7 +13,7 @@ thirdparty_sources = [ ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] -env_tinyexr.Append(CPPPATH=[thirdparty_dir]) +env_tinyexr.Prepend(CPPPATH=[thirdparty_dir]) env_thirdparty = env_tinyexr.Clone() env_thirdparty.disable_warnings() diff --git a/modules/upnp/SCsub b/modules/upnp/SCsub index 2b15f7aee2..6d669ab73b 100644 --- a/modules/upnp/SCsub +++ b/modules/upnp/SCsub @@ -25,7 +25,7 @@ if env['builtin_miniupnpc']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_upnp.Append(CPPPATH=[thirdparty_dir]) + env_upnp.Prepend(CPPPATH=[thirdparty_dir]) env_upnp.Append(CPPFLAGS=["-DMINIUPNP_STATICLIB"]) env_thirdparty = env_upnp.Clone() diff --git a/modules/vhacd/SCsub b/modules/vhacd/SCsub index fdd3ddc1e6..161aed2eb9 100644 --- a/modules/vhacd/SCsub +++ b/modules/vhacd/SCsub @@ -24,7 +24,7 @@ thirdparty_sources = [ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] -env_vhacd.Append(CPPPATH=[thirdparty_dir+"/inc"]) +env_vhacd.Prepend(CPPPATH=[thirdparty_dir + "/inc"]) env_vhacd.Append(CPPFLAGS=["-DGODOT_ENET"]) # upstream uses c++11 diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub index 19587563ab..3824fdd789 100644 --- a/modules/vorbis/SCsub +++ b/modules/vorbis/SCsub @@ -40,11 +40,11 @@ if env['builtin_libvorbis']: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_vorbis.Append(CPPPATH=[thirdparty_dir]) + env_vorbis.Prepend(CPPPATH=[thirdparty_dir]) # also requires libogg if env['builtin_libogg']: - env_vorbis.Append(CPPPATH=["#thirdparty/libogg"]) + env_vorbis.Prepend(CPPPATH=["#thirdparty/libogg"]) env_thirdparty = env_vorbis.Clone() env_thirdparty.disable_warnings() diff --git a/modules/webm/SCsub b/modules/webm/SCsub index dcc9a45044..e57437229f 100644 --- a/modules/webm/SCsub +++ b/modules/webm/SCsub @@ -15,7 +15,7 @@ thirdparty_sources = [ ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] -env_webm.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"]) +env_webm.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"]) # upstream uses c++11 if (not env_webm.msvc): @@ -23,14 +23,14 @@ if (not env_webm.msvc): # also requires libogg, libvorbis and libopus if env['builtin_libogg']: - env_webm.Append(CPPPATH=["#thirdparty/libogg"]) + env_webm.Prepend(CPPPATH=["#thirdparty/libogg"]) if env['builtin_libvorbis']: - env_webm.Append(CPPPATH=["#thirdparty/libvorbis"]) + env_webm.Prepend(CPPPATH=["#thirdparty/libvorbis"]) if env['builtin_opus']: - env_webm.Append(CPPPATH=["#thirdparty/opus"]) + env_webm.Prepend(CPPPATH=["#thirdparty/opus"]) if env['builtin_libvpx']: - env_webm.Append(CPPPATH=["#thirdparty/libvpx"]) + env_webm.Prepend(CPPPATH=["#thirdparty/libvpx"]) SConscript("libvpx/SCsub") env_thirdparty = env_webm.Clone() diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub index 5bf4ea3464..a6be1380a6 100644 --- a/modules/webm/libvpx/SCsub +++ b/modules/webm/libvpx/SCsub @@ -256,7 +256,7 @@ libvpx_sources_arm_neon_gas_apple = [libvpx_dir + file for file in libvpx_source env_libvpx = env_modules.Clone() env_libvpx.disable_warnings() -env_libvpx.Append(CPPPATH=[libvpx_dir]) +env_libvpx.Prepend(CPPPATH=[libvpx_dir]) webm_multithread = env["platform"] != 'javascript' @@ -380,7 +380,7 @@ if webm_cpu_x86: elif webm_cpu_arm: env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm) if env["platform"] == 'android': - env_libvpx.Append(CPPPATH=[libvpx_dir + "third_party/android"]) + env_libvpx.Prepend(CPPPATH=[libvpx_dir + "third_party/android"]) env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"]) env_libvpx_neon = env_libvpx.Clone() diff --git a/modules/webp/SCsub b/modules/webp/SCsub index fa3896c457..666628bb44 100644 --- a/modules/webp/SCsub +++ b/modules/webp/SCsub @@ -126,7 +126,7 @@ if env['builtin_libwebp']: ] thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources] - env_webp.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"]) + env_webp.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"]) env_thirdparty = env_webp.Clone() env_thirdparty.disable_warnings() diff --git a/modules/webrtc/SCsub b/modules/webrtc/SCsub index 446bd530c2..868553b879 100644 --- a/modules/webrtc/SCsub +++ b/modules/webrtc/SCsub @@ -10,7 +10,6 @@ use_gdnative = env_webrtc["module_gdnative_enabled"] if use_gdnative: # GDNative is retained in Javascript for export compatibility env_webrtc.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED']) - gdnative_includes = ["#modules/gdnative/include/"] - env_webrtc.Append(CPPPATH=gdnative_includes) + env_webrtc.Prepend(CPPPATH=["#modules/gdnative/include/"]) env_webrtc.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub index 12b4969cf7..2d2de81220 100644 --- a/modules/websocket/SCsub +++ b/modules/websocket/SCsub @@ -75,7 +75,7 @@ if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # alrea else: # Unix socket thirdparty_sources += Glob(thirdparty_dir + "lib/plat/unix/*.c") - env_lws.Append(CPPPATH=[thirdparty_dir + 'include/']) + env_lws.Prepend(CPPPATH=[thirdparty_dir + 'include/']) if env['builtin_mbedtls']: mbedtls_includes = "#thirdparty/mbedtls/include" @@ -85,14 +85,14 @@ if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # alrea env_lws.Prepend(CPPPATH=wrapper_includes) if env["platform"] == "windows" or env["platform"] == "uwp": - env_lws.Append(CPPPATH=[helper_dir]) + env_lws.Prepend(CPPPATH=[helper_dir]) if env["platform"] == "uwp": env_lws.Append(CPPFLAGS=["/DLWS_MINGW_SUPPORT"]) env_thirdparty = env_lws.Clone() env_thirdparty.disable_warnings() - env_thirdparty.Append(CPPPATH=[thirdparty_dir + 'lib/']) + env_thirdparty.Prepend(CPPPATH=[thirdparty_dir + 'lib/']) env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources) env_lws.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/xatlas_unwrap/SCsub b/modules/xatlas_unwrap/SCsub index 7a40945f27..50e3cb1551 100644 --- a/modules/xatlas_unwrap/SCsub +++ b/modules/xatlas_unwrap/SCsub @@ -13,7 +13,7 @@ if env['builtin_xatlas']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_xatlas_unwrap.Append(CPPPATH=[thirdparty_dir]) + env_xatlas_unwrap.Prepend(CPPPATH=[thirdparty_dir]) # upstream uses c++11 if (not env.msvc): diff --git a/platform/android/detect.py b/platform/android/detect.py index 6c67067db7..8d35617d20 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -299,7 +299,7 @@ def configure(env): env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + '/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib']) - env.Append(CPPPATH=['#platform/android']) + env.Prepend(CPPPATH=['#platform/android']) env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL']) env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'android', 'log', 'z', 'dl']) diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 2a3d0843a8..f45644f1eb 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1864,7 +1864,6 @@ public: return ERR_FILE_NOT_FOUND; } - ERR_FAIL_COND_V(!pkg, ERR_CANT_OPEN); int ret = unzGoToFirstFile(pkg); zlib_filefunc_def io2 = io; @@ -2204,7 +2203,6 @@ public: return ERR_FILE_NOT_FOUND; } - ERR_FAIL_COND_V(!tmp_unaligned, ERR_CANT_OPEN); ret = unzGoToFirstFile(tmp_unaligned); io2 = io; diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py index 874b1ab1fb..f33c77a407 100644 --- a/platform/haiku/detect.py +++ b/platform/haiku/detect.py @@ -137,7 +137,7 @@ def configure(env): if not env['builtin_miniupnpc']: # No pkgconfig file so far, hardcode default paths. - env.Append(CPPPATH=["/system/develop/headers/x86/miniupnpc"]) + env.Prepend(CPPPATH=["/system/develop/headers/x86/miniupnpc"]) env.Append(LIBS=["miniupnpc"]) # On Linux wchar_t should be 32-bits @@ -147,7 +147,7 @@ def configure(env): ## Flags - env.Append(CPPPATH=['#platform/haiku']) + env.Prepend(CPPPATH=['#platform/haiku']) env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED']) env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED']) # env.Append(CPPFLAGS=['-DFREETYPE_ENABLED']) diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index d56e28a4af..3ed0a4ade7 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -165,12 +165,12 @@ def configure(env): if env['icloud']: env.Append(CPPFLAGS=['-DICLOUD_ENABLED']) - env.Append(CPPPATH=['$IPHONESDK/usr/include', - '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', - '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers', - ]) + env.Prepend(CPPPATH=['$IPHONESDK/usr/include', + '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', + '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers', + ]) env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate' - env.Append(CPPPATH=['#platform/iphone']) + env.Prepend(CPPPATH=['#platform/iphone']) env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DCOREAUDIO_ENABLED']) diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 85d4b9e847..e1083aeefc 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -920,7 +920,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p EditorNode::add_io_error("Could not open export template (not a zip file?):\n" + src_pkg_name); return ERR_CANT_OPEN; } - ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN); + int ret = unzGoToFirstFile(src_pkg_zip); Vector<uint8_t> project_file_data; while (ret == UNZ_OK) { diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index c7acbde3f7..145ce8d83d 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -103,7 +103,7 @@ def configure(env): ## Compile flags - env.Append(CPPPATH=['#platform/javascript']) + env.Prepend(CPPPATH=['#platform/javascript']) env.Append(CPPDEFINES=['JAVASCRIPT_ENABLED', 'UNIX_ENABLED']) # No multi-threading (SharedArrayBuffer) available yet, diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 8024897195..4c88f91d13 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -126,7 +126,7 @@ def configure(env): ## Flags - env.Append(CPPPATH=['#platform/osx']) + env.Prepend(CPPPATH=['#platform/osx']) env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED', '-DCOREMIDI_ENABLED']) env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo']) env.Append(LIBS=['pthread']) diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 1a63d6ff75..89212b0e5e 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -441,7 +441,6 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p return ERR_FILE_NOT_FOUND; } - ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN); int ret = unzGoToFirstFile(src_pkg_zip); String binary_to_use = "godot_osx_" + String(p_debug ? "debug" : "release") + ".64"; diff --git a/platform/server/detect.py b/platform/server/detect.py index 5306a2bf69..08c2eb6aaf 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -201,7 +201,7 @@ def configure(env): if not env['builtin_miniupnpc']: # No pkgconfig file so far, hardcode default paths. - env.Append(CPPPATH=["/usr/include/miniupnpc"]) + env.Prepend(CPPPATH=["/usr/include/miniupnpc"]) env.Append(LIBS=["miniupnpc"]) # On Linux wchar_t should be 32-bits @@ -215,7 +215,7 @@ def configure(env): if not env['builtin_zlib']: env.ParseConfig('pkg-config zlib --cflags --libs') - env.Append(CPPPATH=['#platform/server']) + env.Prepend(CPPPATH=['#platform/server']) env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED']) if (platform.system() == "Darwin"): diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 17f8242466..00f419f4f0 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -77,7 +77,7 @@ def configure(env): # ANGLE angle_root = os.getenv("ANGLE_SRC_PATH") - env.Append(CPPPATH=[angle_root + '/include']) + env.Prepend(CPPPATH=[angle_root + '/include']) jobs = str(env.GetOption("num_jobs")) angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform=" @@ -137,7 +137,7 @@ def configure(env): ## Compile flags - env.Append(CPPPATH=['#platform/uwp', '#drivers/windows']) + env.Prepend(CPPPATH=['#platform/uwp', '#drivers/windows']) env.Append(CPPFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND']) env.Append(CPPFLAGS=['/DGLES_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED']) winver = "0x0602" # Windows 8 is the minimum target for UWP build diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 5c38eebf04..4b4b507499 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -201,7 +201,7 @@ def configure_msvc(env, manual_msvc_config): env.AppendUnique(CXXFLAGS=['/TP']) # assume all sources are C++ if manual_msvc_config: # should be automatic if SCons found it if os.getenv("WindowsSdkDir") is not None: - env.Append(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"]) + env.Prepend(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"]) else: print("Missing environment variable: WindowsSdkDir") @@ -239,7 +239,7 @@ def configure_msvc(env, manual_msvc_config): env.AppendUnique(LINKFLAGS=['/LTCG']) if manual_msvc_config: - env.Append(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")]) + env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")]) env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")]) # Incremental linking fix @@ -342,7 +342,7 @@ def configure_mingw(env): def configure(env): # At this point the env has been set up with basic tools/compilers. - env.Append(CPPPATH=['#platform/windows']) + env.Prepend(CPPPATH=['#platform/windows']) print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits'])) diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp index 1e7f393bdd..44d3cf1910 100644 --- a/platform/x11/crash_handler_x11.cpp +++ b/platform/x11/crash_handler_x11.cpp @@ -96,12 +96,10 @@ static void handle_crash(int sig) { String output = ""; // Try to get the file/line number using addr2line - if (OS::get_singleton()) { - int ret; - Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret); - if (err == OK) { - output.erase(output.length() - 1, 1); - } + int ret; + Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret); + if (err == OK) { + output.erase(output.length() - 1, 1); } fprintf(stderr, "[%ld] %s (%ls)\n", i, fname, output.c_str()); diff --git a/platform/x11/detect.py b/platform/x11/detect.py index f8ae5e9acb..933ee6b72e 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -275,7 +275,7 @@ def configure(env): if not env['builtin_miniupnpc']: # No pkgconfig file so far, hardcode default paths. - env.Append(CPPPATH=["/usr/include/miniupnpc"]) + env.Prepend(CPPPATH=["/usr/include/miniupnpc"]) env.Append(LIBS=["miniupnpc"]) # On Linux wchar_t should be 32-bits @@ -316,7 +316,7 @@ def configure(env): if not env['builtin_zlib']: env.ParseConfig('pkg-config zlib --cflags --libs') - env.Append(CPPPATH=['#platform/x11']) + env.Prepend(CPPPATH=['#platform/x11']) env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED']) env.Append(LIBS=['GL', 'pthread']) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 267ac08a72..5a3d3acb12 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -503,35 +503,33 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a current_cursor = CURSOR_ARROW; - if (cursor_theme) { - for (int i = 0; i < CURSOR_MAX; i++) { - - static const char *cursor_file[] = { - "left_ptr", - "xterm", - "hand2", - "cross", - "watch", - "left_ptr_watch", - "fleur", - "hand1", - "X_cursor", - "sb_v_double_arrow", - "sb_h_double_arrow", - "size_bdiag", - "size_fdiag", - "hand1", - "sb_v_double_arrow", - "sb_h_double_arrow", - "question_arrow" - }; + for (int i = 0; i < CURSOR_MAX; i++) { - img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size); - if (img[i]) { - cursors[i] = XcursorImageLoadCursor(x11_display, img[i]); - } else { - print_verbose("Failed loading custom cursor: " + String(cursor_file[i])); - } + static const char *cursor_file[] = { + "left_ptr", + "xterm", + "hand2", + "cross", + "watch", + "left_ptr_watch", + "fleur", + "hand1", + "X_cursor", + "sb_v_double_arrow", + "sb_h_double_arrow", + "size_bdiag", + "size_fdiag", + "hand1", + "sb_v_double_arrow", + "sb_h_double_arrow", + "question_arrow" + }; + + img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size); + if (img[i]) { + cursors[i] = XcursorImageLoadCursor(x11_display, img[i]); + } else { + print_verbose("Failed loading custom cursor: " + String(cursor_file[i])); } } diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp index 943c2b1383..50da6a4967 100644 --- a/platform/x11/power_x11.cpp +++ b/platform/x11/power_x11.cpp @@ -115,7 +115,7 @@ bool PowerX11::make_proc_acpi_key_val(char **_ptr, char **_key, char **_val) { *(ptr++) = '\0'; /* terminate the key. */ - while ((*ptr == ' ') && (*ptr != '\0')) { + while (*ptr == ' ') { ptr++; /* skip whitespace. */ } diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index ed533ee7a4..2377068ede 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -152,6 +152,7 @@ PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const { void Light::set_bake_mode(BakeMode p_mode) { bake_mode = p_mode; + VS::get_singleton()->light_set_use_gi(light, p_mode != BAKE_DISABLED); } Light::BakeMode Light::get_bake_mode() const { diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 8825891807..e77ee8c744 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -93,14 +93,14 @@ Size2 PopupMenu::get_minimum_size() const { if (items[i].submenu != "") size.width += get_icon("submenu")->get_width(); - if (has_check) - size.width += check_w; - max_w = MAX(max_w, size.width + icon_w); + max_w = MAX(max_w, size.width); minsize.height += size.height; } - minsize.width += max_w + accel_max_w; + minsize.width += max_w + icon_w + accel_max_w; + if (has_check) + minsize.width += check_w; return minsize; } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index fbf6550362..3eb4e6d75a 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -825,6 +825,9 @@ void TextEdit::_notification(int p_what) { // get the highlighted words String highlighted_text = get_selection_text(); + // check if highlighted words contains only whitespaces (tabs or spaces) + bool only_whitespaces_highlighted = highlighted_text.strip_edges() == String(); + String line_num_padding = line_numbers_zero_padded ? "0" : " "; int cursor_wrap_index = get_cursor_wrap_index(); @@ -1123,7 +1126,7 @@ void TextEdit::_notification(int p_what) { VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2i(char_ofs + char_margin + char_w + ofs_x - 1, ofs_y), Size2i(1, get_row_height())), border_color); } - if (highlight_all_occurrences) { + if (highlight_all_occurrences && !only_whitespaces_highlighted) { if (highlighted_text_col != -1) { // if we are at the end check for new word on same line diff --git a/scene/resources/animation.h b/scene/resources/animation.h index b66ae184e9..3d38a8902f 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -93,7 +93,6 @@ private: template <class T> struct TKey : public Key { - float time; T value; }; diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index c72ccc97db..128db3f109 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -96,6 +96,7 @@ void Font::_bind_methods() { ClassDB::bind_method(D_METHOD("get_height"), &Font::get_height); ClassDB::bind_method(D_METHOD("is_distance_field_hint"), &Font::is_distance_field_hint); ClassDB::bind_method(D_METHOD("get_string_size", "string"), &Font::get_string_size); + ClassDB::bind_method(D_METHOD("get_wordwrap_string_size", "string", "p_width"), &Font::get_wordwrap_string_size); ClassDB::bind_method(D_METHOD("has_outline"), &Font::has_outline); ClassDB::bind_method(D_METHOD("draw_char", "canvas_item", "position", "char", "next", "modulate", "outline"), &Font::draw_char, DEFVAL(-1), DEFVAL(Color(1, 1, 1)), DEFVAL(false)); ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes); @@ -495,6 +496,38 @@ Size2 Font::get_string_size(const String &p_string) const { return Size2(w, get_height()); } + +Size2 Font::get_wordwrap_string_size(const String &p_string, float p_width) const { + + ERR_FAIL_COND_V(p_width <= 0, Vector2(0, get_height())); + + int l = p_string.length(); + if (l == 0) + return Size2(p_width, get_height()); + + float line_w = 0; + float h = 0; + float space_w = get_char_size(' ').width; + Vector<String> lines = p_string.split("\n"); + for (int i = 0; i < lines.size(); i++) { + h += get_height(); + String t = lines[i]; + line_w = 0; + Vector<String> words = t.split(" "); + for (int j = 0; j < words.size(); j++) { + line_w += get_string_size(words[j]).x; + if (line_w > p_width) { + h += get_height(); + line_w = get_string_size(words[j]).x; + } else { + line_w += space_w; + } + } + } + + return Size2(p_width, h); +} + void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) { ERR_FAIL_COND(p_fallback == this); diff --git a/scene/resources/font.h b/scene/resources/font.h index 6bc8d9b792..def2c2285a 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -53,6 +53,7 @@ public: virtual Size2 get_char_size(CharType p_char, CharType p_next = 0) const = 0; Size2 get_string_size(const String &p_string) const; + Size2 get_wordwrap_string_size(const String &p_string, float p_width) const; virtual bool is_distance_field_hint() const = 0; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index b22e26f903..a02f52f034 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -373,6 +373,7 @@ public: virtual void light_set_negative(RID p_light, bool p_enable) = 0; virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0; virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0; + virtual void light_set_use_gi(RID p_light, bool p_enable) = 0; virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode) = 0; virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail) = 0; @@ -392,6 +393,7 @@ public: virtual AABB light_get_aabb(RID p_light) const = 0; virtual float light_get_param(RID p_light, VS::LightParam p_param) = 0; virtual Color light_get_color(RID p_light) = 0; + virtual bool light_get_use_gi(RID p_light) = 0; virtual uint64_t light_get_version(RID p_light) const = 0; /* PROBE API */ diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index efe2a99d2e..3ec428d687 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -312,6 +312,7 @@ public: BIND2(light_set_negative, RID, bool) BIND2(light_set_cull_mask, RID, uint32_t) BIND2(light_set_reverse_cull_face_mode, RID, bool) + BIND2(light_set_use_gi, RID, bool) BIND2(light_omni_set_shadow_mode, RID, LightOmniShadowMode) BIND2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index af580d6794..bce5eaf7b0 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -3117,6 +3117,9 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) { for (List<Instance *>::Element *E = p_gi_probe->scenario->directional_lights.front(); E; E = E->next()) { + if (!VSG::storage->light_get_use_gi(E->get()->base)) + continue; + InstanceGIProbeData::LightCache lc; lc.type = VSG::storage->light_get_type(E->get()->base); lc.color = VSG::storage->light_get_color(E->get()->base); @@ -3137,6 +3140,9 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) { for (Set<Instance *>::Element *E = probe_data->lights.front(); E; E = E->next()) { + if (!VSG::storage->light_get_use_gi(E->get()->base)) + continue; + InstanceGIProbeData::LightCache lc; lc.type = VSG::storage->light_get_type(E->get()->base); lc.color = VSG::storage->light_get_color(E->get()->base); diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 3e451511cd..b2753369b8 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -248,6 +248,7 @@ public: FUNC2(light_set_negative, RID, bool) FUNC2(light_set_cull_mask, RID, uint32_t) FUNC2(light_set_reverse_cull_face_mode, RID, bool) + FUNC2(light_set_use_gi, RID, bool) FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode) FUNC2(light_omni_set_shadow_detail, RID, LightOmniShadowDetail) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 041fb2b84f..b39b400a53 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1780,6 +1780,7 @@ void VisualServer::_bind_methods() { ClassDB::bind_method(D_METHOD("light_set_negative", "light", "enable"), &VisualServer::light_set_negative); ClassDB::bind_method(D_METHOD("light_set_cull_mask", "light", "mask"), &VisualServer::light_set_cull_mask); ClassDB::bind_method(D_METHOD("light_set_reverse_cull_face_mode", "light", "enabled"), &VisualServer::light_set_reverse_cull_face_mode); + ClassDB::bind_method(D_METHOD("light_set_use_gi", "light", "enabled"), &VisualServer::light_set_use_gi); ClassDB::bind_method(D_METHOD("light_omni_set_shadow_mode", "light", "mode"), &VisualServer::light_omni_set_shadow_mode); ClassDB::bind_method(D_METHOD("light_omni_set_shadow_detail", "light", "detail"), &VisualServer::light_omni_set_shadow_detail); diff --git a/servers/visual_server.h b/servers/visual_server.h index 7693faf42b..d40678c003 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -435,6 +435,7 @@ public: virtual void light_set_negative(RID p_light, bool p_enable) = 0; virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0; virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) = 0; + virtual void light_set_use_gi(RID p_light, bool p_enable) = 0; // omni light enum LightOmniShadowMode { |