Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NavigationAgent3D not emitting "target_reached" Signal reliably #47959

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
8b08146
Add a welcome dialog to the HTML5 editor
Calinou Mar 16, 2021
c562c69
Remove current export template version from "Installed Versions"
AaronRecord Mar 12, 2021
806a1a6
Draw triangles for HeightMapShape debug collision
pouleyKetchoupp Mar 25, 2021
c8dd3c7
Heightmap collision shape support in Godot Physics
pouleyKetchoupp Mar 25, 2021
8d3e460
Prevents default values of VSNodeCustom from overriding by a script
Chaosus Apr 12, 2021
0a29322
Validation layers on Android
szymonm-google Mar 22, 2021
564ddcd
Fix EditorExportPlugin _export_begin and _export_end functions not be…
Gromph Apr 14, 2021
b16bb33
Make LSP update the filesystem of changed scripts
Razoric480 Apr 14, 2021
40502a1
GDScript: Pool temporary values by type on the stack
vnen Apr 14, 2021
ea46639
Print a warning when trying to seek in VideoPlayer
Calinou Apr 14, 2021
cf64bad
Document `AStar.get_point_path()` not being thread-safe
Calinou Apr 16, 2021
9411bf0
GDScript: Adjust type of temporaries when needed
vnen Apr 16, 2021
a6c5938
Remove return value type adjust of builtin method calls
vnen Apr 16, 2021
0ab928e
Import: Cleanup and optimize etcpak compression method
akien-mga Apr 15, 2021
c10007d
Fix NavigationAgent3D not emitting "target_reached" Signal
smix8 Apr 16, 2021
27a66ee
C#: Fix `double` casting in wasm m2n trampolines
neikeq Apr 17, 2021
837b5da
Merge pull request #47969 from neikeq/issue-47898-4.0
akien-mga Apr 17, 2021
86822b1
Rename LineEdit caret_* properties getters and setters to match property
madmiraal Mar 28, 2021
0ee744f
Merge pull request #47069 from Calinou/html5-editor-welcome-dialog
Faless Apr 17, 2021
8f01c26
changed description of `merge_polygons`
RoniPerson Apr 17, 2021
9eb3546
instance-scene: make parent as edited_scene if no parent selected.
Bhu1-V Apr 4, 2021
906882e
Split particle shader entry points
reduz Apr 17, 2021
8ae5c6c
Fix `sky` visual shader mode after last rename
Chaosus Apr 17, 2021
0fb4dbf
Avoid creating joy_names map entries when using Map operator[]
madmiraal Apr 17, 2021
35c9192
Document AnimationNodeTimeSeek with clarified usage and code example
smix8 Apr 17, 2021
71b254f
Print suggestions when requesting a nonexistent InputMap action
Calinou Jan 28, 2020
d8447d5
Merge pull request #47987 from madmiraal/fix-46754
akien-mga Apr 18, 2021
7e215a4
Merge pull request #35666 from Calinou/inputmap-nonexistent-suggestions
akien-mga Apr 18, 2021
c05245f
Merge pull request #47982 from Chaosus/vs_fix_skymode
akien-mga Apr 18, 2021
2524238
Refactor Edit Theme menu in Theme Editor
YuriSizov Mar 1, 2021
dfe4feb
Merge pull request #47917 from akien-mga/squish-decompress-only
akien-mga Apr 18, 2021
9d18610
update meshoptimizer to 0.16
Geometror Apr 18, 2021
6269895
Merge pull request #47980 from reduz/split-particle-shader-entry-points
akien-mga Apr 18, 2021
80b1a29
Put physics override parameters in their own group and document that …
AaronRecord Apr 18, 2021
698c7d2
Merge pull request #48002 from Geometror/update-meshoptimizer
akien-mga Apr 19, 2021
f41e777
Merge pull request #47611 from Bhu1-V/PR/instance-scene-fix
akien-mga Apr 19, 2021
8ba06e3
Merge pull request #47448 from madmiraal/rename-lineedit-cursor
akien-mga Apr 19, 2021
29775a1
doc: Sync classref with current source
akien-mga Apr 19, 2021
5bc746e
Add a menu action to open C++ source on GitHub in the editor debugger
Calinou Apr 18, 2021
2b730ca
Use multiple threads to import.
reduz Mar 24, 2021
f817e7f
Merge pull request #47343 from reduz/editor-import-multithreaded
akien-mga Apr 19, 2021
15bf337
Fix broken NavigationAgent3D collision avoidance callback
smix8 Apr 19, 2021
a491071
Fix broken NavigationAgent2D collision avoidance callbacks
smix8 Apr 19, 2021
68e6223
Merge pull request #47990 from Calinou/editor-debugger-open-cpp-sourc…
akien-mga Apr 20, 2021
aa67786
Merge pull request #47991 from LightningAA/regroup-area-inspector-4.0
akien-mga Apr 20, 2021
071871b
Move collision layer and mask into CollisionObject.
madmiraal Oct 13, 2020
a9ecf66
Merge pull request #47956 from vnen/gdscript-double-stack
akien-mga Apr 20, 2021
fdf041a
Merge pull request #47347 from nekomatata/heightmap-support
akien-mga Apr 20, 2021
c368079
Merge pull request #47345 from nekomatata/heightmap-draw-triangles
akien-mga Apr 20, 2021
f8f12d0
ProjectSettingsEditor: Make "Type" OptionButton item ids match corres…
kleonc Apr 20, 2021
7879e04
Merge pull request #48048 from kleonc/project_settings_add_property_t…
akien-mga Apr 20, 2021
d85fa25
Merge pull request #47953 from Calinou/doc-astar-thread-safety
akien-mga Apr 20, 2021
0c995a9
Merge pull request #47976 from RoniPerson/patch-4
akien-mga Apr 20, 2021
399f557
Merge pull request #47983 from smix8/doc_animationnodetimeseek
akien-mga Apr 20, 2021
8a8dd9c
Merge pull request #47896 from Calinou/videoplayer-stream-position-wa…
akien-mga Apr 20, 2021
1616055
Merge pull request #47879 from SilverCreekEntertainment/add-uwp-expor…
akien-mga Apr 20, 2021
7e557bb
[JS, Android] Re-add "no-exceptions" for export templates builds with…
bruvzg Apr 20, 2021
c395b9c
Merge pull request #47552 from szymonm-google/validation_layers_android
akien-mga Apr 20, 2021
b06116d
Merge pull request #42770 from madmiraal/fix-26680
akien-mga Apr 20, 2021
38b2561
Merge pull request #48053 from bruvzg/icu_no_except
akien-mga Apr 20, 2021
17591fc
Improve the `Engine.editor_hint` property documentation
Calinou Apr 10, 2021
a5bb9e7
Merge pull request #47772 from Calinou/doc-engine-editor-hint
akien-mga Apr 21, 2021
e271dba
i18n: Sync translations with Weblate
akien-mga Apr 21, 2021
ebf10fe
Fix reflection probe
BastiaanOlij Apr 20, 2021
f6d5b2f
Merge pull request #48046 from BastiaanOlij/fix_reflection_probe
akien-mga Apr 21, 2021
93b7406
fbx: Fix include for zlib that broke unbundling
akien-mga Apr 22, 2021
a4423c8
Fix crash on GDNative API json generator exit.
bruvzg Apr 22, 2021
77a876c
Merge pull request #48081 from bruvzg/fix_api_gen_crash
akien-mga Apr 22, 2021
b56241f
ICU: Update to version 69.1, improve ICU data export process.
bruvzg Apr 22, 2021
3d46f28
Add type_traits include for `std::is_trivially_destructible`
akien-mga Apr 22, 2021
3f27002
Merge pull request #48088 from bruvzg/icu_update_69_1
akien-mga Apr 22, 2021
4753b30
Merge pull request #48074 from akien-mga/fbx-fix-zlib-unbundling
akien-mga Apr 22, 2021
c7b97f0
Merge pull request #48095 from akien-mga/safe_refcount-include-type_t…
akien-mga Apr 22, 2021
188bd56
Link to Feature tags more explicitly in ProjectSettings documentation
Calinou Apr 22, 2021
22efa85
Make randomize() use unix time too
KoBeWi Apr 22, 2021
497c3f9
Call randomize() automatically
KoBeWi Nov 5, 2020
7b9a9e5
fix stop debugger on closing game
kalysti Apr 22, 2021
6cfbf36
Merge pull request #48079 from sboron/fix-47643-remote
Faless Apr 23, 2021
cfa06f0
Unexpose _direct_state_changed in PhysicsBody
rafallus Mar 30, 2021
bd7a92e
Merge pull request #48030 from smix8/issue_47337_broken_navagent2d_ca…
akien-mga Apr 23, 2021
a3fbc0b
Merge pull request #48028 from smix8/issue_47337_broken_navagent3d_ca…
akien-mga Apr 23, 2021
492b8aa
Merge pull request #43330 from KoBeWi/rngesus
akien-mga Apr 23, 2021
c04681b
Merge pull request #48098 from KoBeWi/you_never_know
akien-mga Apr 23, 2021
12f826d
NodePath: Remove unimplemented `get_parent()` method
akien-mga Apr 23, 2021
eeccab2
Merge pull request #48126 from akien-mga/nodepath-remove-unimplemente…
akien-mga Apr 23, 2021
d13cfc8
Docs: Minor argument names fix
kleonc Apr 23, 2021
1a3d609
Merge pull request #47485 from rafallus/fix/rigidbody-crash
akien-mga Apr 23, 2021
ff6f384
Merge pull request #48129 from kleonc/args-master
akien-mga Apr 23, 2021
c7511de
GDScript: Fix resolution of dictionary keys
vnen Apr 23, 2021
1e4ff2e
GDScript: Make sure Lua-style dicts use StringName as keys
vnen Apr 23, 2021
a09f383
Android: Fix get_buffer false positive on empty dest buffer
akien-mga Apr 23, 2021
b923726
Merge pull request #48141 from akien-mga/android-fileaccess-get_buffe…
akien-mga Apr 23, 2021
473a660
Merge pull request #48106 from Calinou/doc-project-settings-feature-tags
akien-mga Apr 23, 2021
759b876
Merge pull request #46593 from pycbouh/theme-editor-better-edit-ui
akien-mga Apr 23, 2021
a804d33
Merge pull request #46952 from LightningAA/patch-1
akien-mga Apr 24, 2021
db90ab8
Merge pull request #47891 from Razoric480/lsp-update-filesystem
akien-mga Apr 24, 2021
ccc375f
Fix AudioServer Crash when bus count equals 0
mrushyendra Apr 24, 2021
d1dc28e
Merge pull request #48139 from vnen/gdscript-dict-keys
akien-mga Apr 24, 2021
f15cabc
fix triplanar mapping for AO
kalysti Apr 25, 2021
48d3269
Fix empty CSGShape error
madmiraal Apr 25, 2021
4311c2f
Fix CSGMesh undo not refreshing gizmo
madmiraal Apr 25, 2021
592f8ec
Merge pull request #48170 from sboron/fix-ao
akien-mga Apr 25, 2021
15a85fe
Merge pull request #48174 from madmiraal/fix-csgmesh-undo
akien-mga Apr 25, 2021
31d41d8
Remove duplicate comments
brakhane Apr 25, 2021
2a1a083
Merge pull request #48162 from mrushyendra/fix_audioserver_crash
akien-mga Apr 26, 2021
f6e5ea7
Merge pull request #48172 from madmiraal/fix-empty-csgshape-error
akien-mga Apr 26, 2021
5d124c4
Remove uses of `auto` for better readability and online code reviews
Calinou Apr 25, 2021
abb2184
Remove deprecated xr features properties. These properties are now pr…
m4gr3d Apr 26, 2021
639b02f
Merge pull request #48185 from Calinou/codestyle-no-auto
akien-mga Apr 26, 2021
ecfbb0f
Expose creating multiple-convex-collision static bodies to GDScript
realkotob Apr 30, 2020
83cc6bc
Merge pull request #48187 from brakhane/remove-dupe-comments
akien-mga Apr 27, 2021
36cb471
Merge pull request #48219 from m4gr3d/move_ovr_manifest_configs_to_pl…
akien-mga Apr 27, 2021
e0c1cc7
Merge pull request #38349 from asheraryam/convex-decompose-master
akien-mga Apr 27, 2021
b95a82d
Merge pull request #47826 from Chaosus/vs_fix_default_input_overriding
akien-mga Apr 27, 2021
141274a
Fix NavigationAgent3D not emitting "target_reached" Signal
smix8 Apr 16, 2021
f85a47f
Merge branch 'issue_47334_navagent_target_reached' of https://github.…
smix8 Apr 27, 2021
33e5734
put target distance check into function
smix8 Apr 27, 2021
89b5ad1
Fix NavigationAgent3D not emitting "target_reached" Signal
smix8 Apr 16, 2021
a24712f
Merge branch 'issue_47334_navagent_target_reached' of https://github.…
smix8 Apr 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Files: ./servers/physics_3d/gjk_epa.cpp
./servers/physics_3d/joints/slider_joint_3d_sw.h
./servers/physics_3d/soft_body_3d_sw.cpp
./servers/physics_3d/soft_body_3d_sw.h
./servers/physics_3d/shape_3d_sw.cpp
./servers/physics_3d/shape_3d_sw.h
Comment: Bullet Continuous Collision Detection and Physics Library
Copyright: 2003-2008, Erwin Coumans
2007-2021, Juan Linietsky, Ariel Manzur.
Expand Down Expand Up @@ -196,7 +198,7 @@ License: HarfBuzz

Files: ./thirdparty/icu4c/
Comment: International Components for Unicode
Copyright: 1991-2020, Unicode
Copyright: 1991-2021, Unicode
License: Unicode

Files: ./thirdparty/jpeg-compressor/
Expand Down Expand Up @@ -261,7 +263,7 @@ License: Apache-2.0

Files: ./thirdparty/meshoptimizer/
Comment: meshoptimizer
Copyright: 2016-2020, Arseny Kapoulkine
Copyright: 2016-2021, Arseny Kapoulkine
License: Expat

Files: ./thirdparty/minimp3/
Expand Down
23 changes: 15 additions & 8 deletions core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,9 +1329,10 @@ void Input::add_joy_mapping(String p_mapping, bool p_update_existing) {
if (p_update_existing) {
Vector<String> entry = p_mapping.split(",");
String uid = entry[0];
for (int i = 0; i < joy_names.size(); i++) {
if (uid == joy_names[i].uid) {
joy_names[i].mapping = map_db.size() - 1;
for (Map<int, Joypad>::Element *E = joy_names.front(); E; E = E->next()) {
Joypad &joy = E->get();
if (joy.uid == uid) {
joy.mapping = map_db.size() - 1;
}
}
}
Expand All @@ -1343,9 +1344,10 @@ void Input::remove_joy_mapping(String p_guid) {
map_db.remove(i);
}
}
for (int i = 0; i < joy_names.size(); i++) {
if (joy_names[i].uid == p_guid) {
joy_names[i].mapping = -1;
for (Map<int, Joypad>::Element *E = joy_names.front(); E; E = E->next()) {
Joypad &joy = E->get();
if (joy.uid == p_guid) {
joy.mapping = -1;
}
}
}
Expand All @@ -1361,8 +1363,13 @@ void Input::set_fallback_mapping(String p_guid) {

//platforms that use the remapping system can override and call to these ones
bool Input::is_joy_known(int p_device) {
int mapping = joy_names[p_device].mapping;
return mapping != -1 ? (mapping != fallback_mapping) : false;
if (joy_names.has(p_device)) {
int mapping = joy_names[p_device].mapping;
if (mapping != -1 && mapping != fallback_mapping) {
return true;
}
}
return false;
}

String Input::get_joy_guid(int p_device) const {
Expand Down
47 changes: 38 additions & 9 deletions core/input/input_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,36 @@ void InputMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("load_from_project_settings"), &InputMap::load_from_project_settings);
}

/**
* Returns an nonexistent action error message with a suggestion of the closest
* matching action name (if possible).
*/
String InputMap::_suggest_actions(const StringName &p_action) const {
List<StringName> actions = get_actions();
StringName closest_action;
float closest_similarity = 0.0;

// Find the most action with the most similar name.
for (List<StringName>::Element *E = actions.front(); E; E = E->next()) {
const float similarity = String(E->get()).similarity(p_action);

if (similarity > closest_similarity) {
closest_action = E->get();
closest_similarity = similarity;
}
}

String error_message = vformat("The InputMap action \"%s\" doesn't exist.", p_action);

if (closest_similarity >= 0.4) {
// Only include a suggestion in the error message if it's similar enough.
error_message += vformat(" Did you mean \"%s\"?", closest_action);
}
return error_message;
}

void InputMap::add_action(const StringName &p_action, float p_deadzone) {
ERR_FAIL_COND_MSG(input_map.has(p_action), "InputMap already has action '" + String(p_action) + "'.");
ERR_FAIL_COND_MSG(input_map.has(p_action), "InputMap already has action \"" + String(p_action) + "\".");
input_map[p_action] = Action();
static int last_id = 1;
input_map[p_action].id = last_id;
Expand All @@ -64,7 +92,8 @@ void InputMap::add_action(const StringName &p_action, float p_deadzone) {
}

void InputMap::erase_action(const StringName &p_action) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'.");
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));

input_map.erase(p_action);
}

Expand Down Expand Up @@ -122,20 +151,20 @@ bool InputMap::has_action(const StringName &p_action) const {
}

float InputMap::action_get_deadzone(const StringName &p_action) {
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), 0.0f, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), 0.0f, _suggest_actions(p_action));

return input_map[p_action].deadzone;
}

void InputMap::action_set_deadzone(const StringName &p_action, float p_deadzone) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'.");
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));

input_map[p_action].deadzone = p_deadzone;
}

void InputMap::action_add_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND_MSG(p_event.is_null(), "It's not a reference to a valid InputEvent object.");
ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'.");
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));
if (_find_event(input_map[p_action], p_event, true)) {
return; // Already addded.
}
Expand All @@ -144,12 +173,12 @@ void InputMap::action_add_event(const StringName &p_action, const Ref<InputEvent
}

bool InputMap::action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), false, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), false, _suggest_actions(p_action));
return (_find_event(input_map[p_action], p_event, true) != nullptr);
}

void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'.");
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));

List<Ref<InputEvent>>::Element *E = _find_event(input_map[p_action], p_event, true);
if (E) {
Expand All @@ -161,7 +190,7 @@ void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEve
}

void InputMap::action_erase_events(const StringName &p_action) {
ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'.");
ERR_FAIL_COND_MSG(!input_map.has(p_action), _suggest_actions(p_action));

input_map[p_action].inputs.clear();
}
Expand Down Expand Up @@ -193,7 +222,7 @@ bool InputMap::event_is_action(const Ref<InputEvent> &p_event, const StringName

bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match, bool *p_pressed, float *p_strength, float *p_raw_strength) const {
OrderedHashMap<StringName, Action>::Element E = input_map.find(p_action);
ERR_FAIL_COND_V_MSG(!E, false, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
ERR_FAIL_COND_V_MSG(!E, false, _suggest_actions(p_action));

Ref<InputEventAction> input_event_action = p_event;
if (input_event_action.is_valid()) {
Expand Down
1 change: 1 addition & 0 deletions core/input/input_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class InputMap : public Object {

Array _action_get_events(const StringName &p_action);
Array _get_actions();
String _suggest_actions(const StringName &p_action) const;

protected:
static void _bind_methods();
Expand Down
28 changes: 28 additions & 0 deletions core/io/resource_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,34 @@ bool ResourceFormatImporter::recognize_path(const String &p_path, const String &
return FileAccess::exists(p_path + ".import");
}

Error ResourceFormatImporter::get_import_order_threads_and_importer(const String &p_path, int &r_order, bool &r_can_threads, String &r_importer) const {
r_order = 0;
r_importer = "";

r_can_threads = false;
Ref<ResourceImporter> importer;

if (FileAccess::exists(p_path + ".import")) {
PathAndType pat;
Error err = _get_path_and_type(p_path, pat);

if (err == OK) {
importer = get_importer_by_name(pat.importer);
}
} else {
importer = get_importer_by_extension(p_path.get_extension().to_lower());
}

if (importer.is_valid()) {
r_order = importer->get_import_order();
r_importer = importer->get_importer_name();
r_can_threads = importer->can_import_threaded();
return OK;
} else {
return ERR_INVALID_PARAMETER;
}
}

int ResourceFormatImporter::get_import_order(const String &p_path) const {
Ref<ResourceImporter> importer;

Expand Down
5 changes: 5 additions & 0 deletions core/io/resource_importer.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class ResourceFormatImporter : public ResourceFormatLoader {

virtual int get_import_order(const String &p_path) const;

Error get_import_order_threads_and_importer(const String &p_path, int &r_order, bool &r_can_threads, String &r_importer) const;

String get_internal_resource_path(const String &p_path) const;
void get_internal_resource_path_list(const String &p_path, List<String> *r_paths);

Expand Down Expand Up @@ -126,6 +128,9 @@ class ResourceImporter : public Reference {
virtual String get_option_group_file() const { return String(); }

virtual Error 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 = nullptr, Variant *r_metadata = nullptr) = 0;
virtual bool can_import_threaded() const { return true; }
virtual void import_threaded_begin() {}
virtual void import_threaded_end() {}

virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
virtual bool are_import_settings_valid(const String &p_path) const { return true; }
Expand Down
2 changes: 1 addition & 1 deletion core/math/random_pcg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RandomPCG::RandomPCG(uint64_t p_seed, uint64_t p_inc) :
}

void RandomPCG::randomize() {
seed(OS::get_singleton()->get_ticks_usec() * pcg.state + PCG_DEFAULT_INC_64);
seed((OS::get_singleton()->get_unix_time() + OS::get_singleton()->get_ticks_usec()) * pcg.state + PCG_DEFAULT_INC_64);
}

double RandomPCG::random(double p_from, double p_to) {
Expand Down
2 changes: 0 additions & 2 deletions core/string/node_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ class NodePath {

void prepend_period();

NodePath get_parent() const;

_FORCE_INLINE_ uint32_t hash() const {
if (!data) {
return 0;
Expand Down
2 changes: 1 addition & 1 deletion core/string/translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ Vector<String> Translation::_get_message_list() const {
void Translation::_set_messages(const Dictionary &p_messages) {
List<Variant> keys;
p_messages.get_key_list(&keys);
for (auto E = keys.front(); E; E = E->next()) {
for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
translation_map[E->get()] = p_messages[E->get()];
}
}
Expand Down
20 changes: 10 additions & 10 deletions core/string/translation_po.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ void TranslationPO::print_translation_map() {

List<StringName> context_l;
translation_map.get_key_list(&context_l);
for (auto E = context_l.front(); E; E = E->next()) {
for (List<StringName>::Element *E = context_l.front(); E; E = E->next()) {
StringName ctx = E->get();
file->store_line(" ===== Context: " + String::utf8(String(ctx).utf8()) + " ===== ");
const HashMap<StringName, Vector<StringName>> &inner_map = translation_map[ctx];

List<StringName> id_l;
inner_map.get_key_list(&id_l);
for (auto E2 = id_l.front(); E2; E2 = E2->next()) {
for (List<StringName>::Element *E2 = id_l.front(); E2; E2 = E2->next()) {
StringName id = E2->get();
file->store_line("msgid: " + String::utf8(String(id).utf8()));
for (int i = 0; i < inner_map[id].size(); i++) {
Expand All @@ -74,15 +74,15 @@ Dictionary TranslationPO::_get_messages() const {

List<StringName> context_l;
translation_map.get_key_list(&context_l);
for (auto E = context_l.front(); E; E = E->next()) {
for (List<StringName>::Element *E = context_l.front(); E; E = E->next()) {
StringName ctx = E->get();
const HashMap<StringName, Vector<StringName>> &id_str_map = translation_map[ctx];

Dictionary d2;
List<StringName> id_l;
id_str_map.get_key_list(&id_l);
// Save list of id and strs associated with a context in a temporary dictionary.
for (auto E2 = id_l.front(); E2; E2 = E2->next()) {
for (List<StringName>::Element *E2 = id_l.front(); E2; E2 = E2->next()) {
StringName id = E2->get();
d2[id] = id_str_map[id];
}
Expand All @@ -98,14 +98,14 @@ void TranslationPO::_set_messages(const Dictionary &p_messages) {

List<Variant> context_l;
p_messages.get_key_list(&context_l);
for (auto E = context_l.front(); E; E = E->next()) {
for (List<Variant>::Element *E = context_l.front(); E; E = E->next()) {
StringName ctx = E->get();
const Dictionary &id_str_map = p_messages[ctx];

HashMap<StringName, Vector<StringName>> temp_map;
List<Variant> id_l;
id_str_map.get_key_list(&id_l);
for (auto E2 = id_l.front(); E2; E2 = E2->next()) {
for (List<Variant>::Element *E2 = id_l.front(); E2; E2 = E2->next()) {
StringName id = E2->get();
temp_map[id] = id_str_map[id];
}
Expand All @@ -121,7 +121,7 @@ Vector<String> TranslationPO::_get_message_list() const {
get_message_list(&msgs);

Vector<String> v;
for (auto E = msgs.front(); E; E = E->next()) {
for (List<StringName>::Element *E = msgs.front(); E; E = E->next()) {
v.push_back(E->get());
}

Expand Down Expand Up @@ -281,15 +281,15 @@ void TranslationPO::get_message_list(List<StringName> *r_messages) const {
List<StringName> context_l;
translation_map.get_key_list(&context_l);

for (auto E = context_l.front(); E; E = E->next()) {
for (List<StringName>::Element *E = context_l.front(); E; E = E->next()) {
if (String(E->get()) != "") {
continue;
}

List<StringName> msgid_l;
translation_map[E->get()].get_key_list(&msgid_l);

for (auto E2 = msgid_l.front(); E2; E2 = E2->next()) {
for (List<StringName>::Element *E2 = msgid_l.front(); E2; E2 = E2->next()) {
r_messages->push_back(E2->get());
}
}
Expand All @@ -300,7 +300,7 @@ int TranslationPO::get_message_count() const {
translation_map.get_key_list(&context_l);

int count = 0;
for (auto E = context_l.front(); E; E = E->next()) {
for (List<StringName>::Element *E = context_l.front(); E; E = E->next()) {
count += translation_map[E->get()].size();
}
return count;
Expand Down
1 change: 1 addition & 0 deletions core/templates/safe_refcount.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#if !defined(NO_THREADS)

#include <atomic>
#include <type_traits>

// Design goals for these classes:
// - No automatic conversions or arithmetic operators,
Expand Down
11 changes: 9 additions & 2 deletions core/templates/thread_work_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ThreadWorkPool {
ERR_FAIL_COND(!threads); //never initialized
ERR_FAIL_COND(current_work != nullptr);

index.store(0);
index.store(0, std::memory_order_release);

Work<C, M, U> *w = memnew((Work<C, M, U>));
w->instance = p_instance;
Expand All @@ -104,8 +104,15 @@ class ThreadWorkPool {
return current_work != nullptr;
}

bool is_done_dispatching() const {
ERR_FAIL_COND_V(current_work == nullptr, false);
return index.load(std::memory_order_acquire) >= current_work->max_elements;
}

uint32_t get_work_index() const {
return index;
ERR_FAIL_COND_V(current_work == nullptr, 0);
uint32_t idx = index.load(std::memory_order_acquire);
return MIN(idx, current_work->max_elements);
}

void end_work() {
Expand Down
Loading