fix(M03): make WMO build queue cold-load safe

This commit is contained in:
2026-07-17 00:59:11 +04:00
parent ab40a76b62
commit e576ae2cad
4 changed files with 77 additions and 18 deletions
@@ -3768,17 +3768,16 @@ func _process_wmo_render_build_jobs() -> void:
while _render_budget_scheduler.has_remaining_permit(
RENDER_BUDGET_SCHEDULER_SCRIPT.WMO_RENDER_GROUP_BUILD) and _wmo_render_build_queue.has_pending():
var unique_key := _wmo_render_build_queue.front_key()
var job := _wmo_render_build_queue.job_for(unique_key)
if job == null:
if not _wmo_render_build_queue.has_job(unique_key):
_wmo_render_build_queue.pop_front()
continue
var root: Node = job.root()
var root: Node = _wmo_render_build_queue.root_for(unique_key)
if root == null or not is_instance_valid(root):
_cancel_wmo_render_build_job(unique_key)
continue
var render_resource: Resource = job.render_resource()
var render_resource: Resource = _wmo_render_build_queue.render_resource_for(unique_key)
if render_resource == null:
_cancel_wmo_render_build_job(unique_key)
continue
@@ -3786,11 +3785,11 @@ func _process_wmo_render_build_jobs() -> void:
var meshes: Array = render_resource.get("meshes")
var mesh_transforms: Array = render_resource.get("mesh_transforms")
var mesh_names: PackedStringArray = render_resource.get("mesh_names")
var mesh_index := job.mesh_index()
var mesh_index := _wmo_render_build_queue.mesh_index_for(unique_key)
var multimeshes: Array = render_resource.get("multimeshes")
var multimesh_transforms: Array = render_resource.get("multimesh_transforms")
var multimesh_names: PackedStringArray = render_resource.get("multimesh_names")
var multimesh_index := job.multimesh_index()
var multimesh_index := _wmo_render_build_queue.multimesh_index_for(unique_key)
var build_step: Dictionary = _wmo_render_build_step_planner.plan_step(
meshes.size(),
mesh_index,
@@ -3821,7 +3820,8 @@ func _process_wmo_render_build_jobs() -> void:
mesh_instance.visibility_range_end_margin = CHUNK_SIZE
(root as Node3D).add_child(mesh_instance)
_set_editor_owner_recursive(mesh_instance)
job.adopt_cursors(
_wmo_render_build_queue.adopt_cursors(
unique_key,
int(build_step["next_mesh_index"]),
int(build_step["next_multimesh_index"])
)
@@ -3851,7 +3851,8 @@ func _process_wmo_render_build_jobs() -> void:
multimesh_instance.visibility_range_end_margin = CHUNK_SIZE
(root as Node3D).add_child(multimesh_instance)
_set_editor_owner_recursive(multimesh_instance)
job.adopt_cursors(
_wmo_render_build_queue.adopt_cursors(
unique_key,
int(build_step["next_mesh_index"]),
int(build_step["next_multimesh_index"])
)