MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / sync

Method sync

modules/navigation_2d/nav_map_2d.cpp:381–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381void NavMap2D::sync() {
382 // Performance Monitor.
383 performance_data.pm_region_count = regions.size();
384 performance_data.pm_agent_count = agents.size();
385 performance_data.pm_link_count = links.size();
386 performance_data.pm_obstacle_count = obstacles.size();
387
388 _sync_async_tasks();
389
390 _sync_dirty_map_update_requests();
391
392 if (iteration_dirty && !iteration_building && !iteration_ready) {
393 _build_iteration();
394 }
395 if (use_async_iterations && iteration_build_thread_task_id != WorkerThreadPool::INVALID_TASK_ID) {
396 if (WorkerThreadPool::get_singleton()->is_task_completed(iteration_build_thread_task_id)) {
397 WorkerThreadPool::get_singleton()->wait_for_task_completion(iteration_build_thread_task_id);
398
399 iteration_build_thread_task_id = WorkerThreadPool::INVALID_TASK_ID;
400 iteration_building = false;
401 iteration_ready = true;
402 }
403 }
404 if (iteration_ready) {
405 _sync_iteration();
406
407 NavigationServer2D::get_singleton()->emit_signal(SNAME("map_changed"), get_self());
408 }
409
410 map_settings_dirty = false;
411
412 _sync_avoidance();
413
414 performance_data.pm_polygon_count = 0;
415 performance_data.pm_edge_count = 0;
416 performance_data.pm_edge_merge_count = 0;
417
418 for (NavRegion2D *region : regions) {
419 performance_data.pm_polygon_count += region->get_pm_polygon_count();
420 performance_data.pm_edge_count += region->get_pm_edge_count();
421 performance_data.pm_edge_merge_count += region->get_pm_edge_merge_count();
422 }
423}
424
425void NavMap2D::_sync_avoidance() {
426 _sync_dirty_avoidance_update_requests();

Callers 15

_denoiseMethod · 0.45
bakeMethod · 0.45
_compressMethod · 0.45
tvg_svg_in_ot_renderFunction · 0.45
tvg_svg_in_ot_renderFunction · 0.45
iterationMethod · 0.45
cleanupMethod · 0.45
~TilesEditorUtilsMethod · 0.45
stopMethod · 0.45

Calls 7

is_task_completedMethod · 0.80
emit_signalMethod · 0.80
sizeMethod · 0.65
get_pm_polygon_countMethod · 0.45
get_pm_edge_countMethod · 0.45

Tested by 1

test_case_endMethod · 0.36