feat(simulation): auto-build source mesh collision

This commit is contained in:
DCCONSTRUCTIONS
2026-08-28 13:46:55 +03:00
parent 7fcfecd063
commit a2c3385062
5 changed files with 192 additions and 44 deletions
@@ -767,6 +767,24 @@ def _discover_bundle_members(root: Path, entrypoint: str, source_format: str) ->
return _logical_path(logical, "descriptor member")
members = {entrypoint}
source_meshes: list[str] = []
for candidate in root.rglob("*"):
if candidate.is_symlink():
raise GaussianPipelineIntegrityError(
"Gaussian source bundle contains a symlink"
)
if not candidate.is_file():
continue
logical_path = candidate.relative_to(root).as_posix()
if is_xgrids_source_mesh_path(logical_path):
source_meshes.append(logical_path)
source_meshes.sort(key=lambda value: value.encode("utf-8"))
if len(source_meshes) > 1:
raise GaussianPipelineIntegrityError(
"Gaussian source bundle must contain at most one PLY mesh inside Mesh_Files"
)
if source_meshes:
members.add(source_meshes[0])
if source_format == "lcc":
members.update({related("index.bin"), related("data.bin")})
file_type = document.get("fileType")
@@ -810,6 +828,11 @@ def _discover_bundle_members(root: Path, entrypoint: str, source_format: str) ->
return members
def is_xgrids_source_mesh_path(logical_path: str) -> bool:
parts = logical_path.lower().replace("\\", "/").split("/")
return "mesh_files" in parts and parts[-1].endswith(".ply")
def _logical_path(value: str, label: str) -> str:
if (
not value
+19 -2
View File
@@ -26,6 +26,7 @@ from k1link.simulation.gaussian_pipeline_gateway import (
GaussianPipelineUnavailableError,
configured_gaussian_pipeline_gateway,
discover_gaussian_source_bundle,
is_xgrids_source_mesh_path,
)
PROJECT_SCHEMA: Final = "missioncore.simulation-project/v1"
@@ -610,6 +611,22 @@ class SimulationProjectService:
entrypoint=entrypoint,
source_format=source_format,
)
source_mesh_available = any(
is_xgrids_source_mesh_path(member.logical_path)
for member in source.members
)
collision_profile = (
{
"scene_type": project["scene_type"],
"seed_position": [0.0, 0.0, 0.0],
"capsule_height": 0.4,
"capsule_radius": 0.4,
"voxel_size": 0.05,
"mesh_shape": "source",
}
if source_mesh_available
else None
)
request = {
"schema_version": BUILD_REQUEST_SCHEMA,
"idempotency_key": f"missioncore-{project_id}",
@@ -617,10 +634,10 @@ class SimulationProjectService:
"outputs": {
"preview_sog": True,
"streamed_sog": True,
"collision": False,
"collision": source_mesh_available,
},
"preview_lod": "coarsest",
"collision_profile": None,
"collision_profile": collision_profile,
}
submitted = provider.submit_build(request)
job_id = submitted.get("job_id")