refactor(M03): extract M2 build batch planner

This commit is contained in:
2026-07-17 00:12:42 +04:00
parent a562d126b9
commit be6db7f7e0
10 changed files with 478 additions and 13 deletions
+30
View File
@@ -0,0 +1,30 @@
class_name M2BuildBatchPlanner
extends RefCounted
## Stateless M2 build batch sizing and group-cursor progression.
## Plans one static or animated build batch. The returned Dictionary is detached
## and contains effective_batch_size, batch_count, next_offset and group_complete.
func plan_batch(
transform_count: int,
current_offset: int,
has_animated_prototype: bool,
animated_batch_limit: int,
static_batch_limit: int
) -> Dictionary:
var selected_batch_limit := (
animated_batch_limit if has_animated_prototype else static_batch_limit
)
var effective_batch_size := maxi(1, selected_batch_limit)
var remaining_transform_count := maxi(0, transform_count - current_offset)
var batch_count := mini(effective_batch_size, remaining_transform_count)
var is_group_complete := (
batch_count <= 0 or current_offset + batch_count >= transform_count
)
return {
"effective_batch_size": effective_batch_size,
"batch_count": batch_count,
"next_offset": 0 if is_group_complete else current_offset + batch_count,
"group_complete": is_group_complete,
}
@@ -0,0 +1 @@
uid://d0my7yntfsvuy