Skip to content

Official Codebase of 3DCodeVerse

Python

languages: build_command knobs nobody passes; preview_times was one call to gl_render.gif_times

gaoypengf03c2445b1e2
diff --git a/harness/codeverse3d/languages/_gl_common.py b/harness/codeverse3d/languages/_gl_common.py
index 5c6f2fc8..190d16ae 100644
--- a/harness/codeverse3d/languages/_gl_common.py
+++ b/harness/codeverse3d/languages/_gl_common.py
@@ -5,7 +5,7 @@
``artifacts/preview.gif``, ``artifacts/metrics.json`` (frame stats + the
``gl_frames`` gate), ``artifacts/build.json`` — and a typed :class:`BuildResult`
(``glb_path`` is always None: the deliverable is code + frames).
-``judge_times`` / ``preview_times`` derive the sampled times from the plan's duration.
+``judge_times`` derives the judged times from the plan's duration.
``make_host`` is the one place a runtime turns settings into a :class:`GlHost`.
GLSL info-log parsing lives here too (:class:`GlslMessage`, :class:`LineMap`,
@@ -29,7 +29,6 @@ from codeverse3d.spatial.gl_render import (
RESULT_NAME,
GlHost,
GlResult,
- gif_times,
write_contact_sheet,
write_gif,
)
@@ -97,10 +96,6 @@ def judge_times(duration_s: float | None) -> list[float]:
return ts
-def preview_times(duration_s: float | None, n: int = 12) -> list[float]:
- return gif_times(float(duration_s or 8.0), n)
-
-
def finish_build(ws: Workspace, res: GlResult, *, language: str, error_file: str = "", error_line: int | None = None,
error_message: str | None = None, census: dict | None = None, motion_expected: bool = True) -> BuildResult:
"""Write derived artifacts + build.json and return the BuildResult."""
diff --git a/harness/codeverse3d/languages/blender/__init__.py b/harness/codeverse3d/languages/blender/__init__.py
index 67c85f5e..2e72db25 100644
--- a/harness/codeverse3d/languages/blender/__init__.py
+++ b/harness/codeverse3d/languages/blender/__init__.py
@@ -723,12 +723,12 @@ class BlenderRuntime(RuntimeDocs):
def build_command(
self, ws: Workspace, *, stl: bool = True, blend: bool = False, seed: int = 0,
- tri_limit: int = MAX_TRIS_OBJECT, rlimit_gb: float | None = None,
+ tri_limit: int = MAX_TRIS_OBJECT,
) -> list[str]:
cmd = [
self.blender_binary(), "-b", "--factory-startup", "--python", str(WRAPPER), "--",
"--script", str(self.entry_file(ws)), "--out", str(ws.artifacts),
- "--rlimit-gb", str(rlimit_gb if rlimit_gb is not None else self._settings.limits.bpy_rlimit_gb),
+ "--rlimit-gb", str(self._settings.limits.bpy_rlimit_gb),
"--tri-limit", str(tri_limit), "--seed", str(seed),
]
if stl:
diff --git a/harness/codeverse3d/languages/cadquery/__init__.py b/harness/codeverse3d/languages/cadquery/__init__.py
index 5b51fc16..d8ff3122 100644
--- a/harness/codeverse3d/languages/cadquery/__init__.py
+++ b/harness/codeverse3d/languages/cadquery/__init__.py
@@ -340,12 +340,11 @@ class CadQueryRuntime(RuntimeDocs):
def entry_file(self, ws: Workspace) -> Path:
return ws.src / "model.py"
- def build_command(self, ws: Workspace, *, seed: int = 0, tri_limit: int = MAX_TRIS_OBJECT,
- tolerance: float = 0.001, angular_tolerance: float = 0.15) -> list[str]:
+ def build_command(self, ws: Workspace, *, seed: int = 0, tri_limit: int = MAX_TRIS_OBJECT) -> list[str]:
+ """The wrapper's own --tolerance / --angular-tolerance defaults are the tessellation."""
return [
self._python, str(WRAPPER), "--script", str(self.entry_file(ws)), "--out", str(ws.artifacts),
"--rlimit-gb", str(self._rlimit_gb), "--tri-limit", str(tri_limit), "--seed", str(seed),
- "--tolerance", str(tolerance), "--angular-tolerance", str(angular_tolerance),
]
# ------------------------------------------------------------------ protocol
diff --git a/harness/codeverse3d/languages/glsl_shader/__init__.py b/harness/codeverse3d/languages/glsl_shader/__init__.py
index 953b1906..aff63044 100644
--- a/harness/codeverse3d/languages/glsl_shader/__init__.py
+++ b/harness/codeverse3d/languages/glsl_shader/__init__.py
@@ -22,10 +22,9 @@ from codeverse3d.languages._gl_common import ( # noqa: F401 — re-exported
load_plan,
make_host,
parse_glsl_log,
- preview_times,
resolution_for,
)
-from codeverse3d.spatial.gl_render import GlHost, GlResult
+from codeverse3d.spatial.gl_render import GlHost, GlResult, gif_times
from codeverse3d.workspace import Workspace
# ===================================================================== wrap
@@ -427,7 +426,7 @@ class GlslShaderRuntime(RuntimeDocs):
res = host.render_fragment_shader(
image.source, ws.artifacts, width=w, height=h, times=times or judge_times(duration),
buffer_a_src=buffer_a.source if buffer_a else None, feedback=image.uses_feedback or buffer_a is not None,
- extra_times=preview_times(duration) if preview else (),
+ extra_times=gif_times(duration or 8.0) if preview else (),
)
census = {"convention": image.convention, "has_common": (ws.root / COMMON).is_file(), "has_buffer_a": buffer_a is not None,
"has_recipes": (ws.root / RECIPES).is_file(), "resolution": [w, h]}
diff --git a/harness/codeverse3d/languages/opengl_python/__init__.py b/harness/codeverse3d/languages/opengl_python/__init__.py
index 092eaef5..237ef143 100644
--- a/harness/codeverse3d/languages/opengl_python/__init__.py
+++ b/harness/codeverse3d/languages/opengl_python/__init__.py
@@ -24,11 +24,10 @@ from codeverse3d.languages._gl_common import (
load_plan,
make_host,
parse_glsl_log,
- preview_times,
resolution_for,
traceback_location,
)
-from codeverse3d.spatial.gl_render import GlHost, GlResult
+from codeverse3d.spatial.gl_render import GlHost, GlResult, gif_times
from codeverse3d.workspace import Workspace
# ===================================================================== lint
@@ -369,7 +368,7 @@ class OpenGLPythonRuntime(RuntimeDocs):
w, h = int(width), int(height)
duration = plan.duration_s if plan else None
res = self.host(timeout_s).run_program(program, ws.artifacts, width=w, height=h, times=times or judge_times(duration),
- extra_times=preview_times(duration) if preview else (), cwd=ws.src)
+ extra_times=gif_times(duration or 8.0) if preview else (), cwd=ws.src)
err_file, err_line, err_msg = "", None, None
if not res.ok:
err_file, err_line = traceback_location(res.traceback, program)
diff --git a/harness/tests/graphics/test_track.py b/harness/tests/graphics/test_track.py
index b6e13f8b..5cd3ab91 100644
--- a/harness/tests/graphics/test_track.py
+++ b/harness/tests/graphics/test_track.py
@@ -17,11 +17,11 @@ from codeverse3d.contracts.plan import GraphicsPlan
from codeverse3d.contracts.run import RunStatus
from codeverse3d.contracts.spec import Constraints, Spec
from codeverse3d.judges.rubrics import load_rubric
-from codeverse3d.languages._gl_common import finish_build, judge_times, preview_times
+from codeverse3d.languages._gl_common import finish_build, judge_times
from codeverse3d.languages.glsl_shader import lint_workspace, write_skeleton
from codeverse3d.proc import EventLog
from codeverse3d.prompts import render
-from codeverse3d.spatial.gl_render import GlFrame, GlResult
+from codeverse3d.spatial.gl_render import GlFrame, GlResult, gif_times
from codeverse3d.tracks import get_track
from codeverse3d.tracks.graphics import (
GraphicsPipeline,
@@ -76,7 +76,7 @@ class FakeGlRuntime:
error_message="src/shader.frag:3: error: `nope' undeclared")
return finish_build(ws, res, language="glsl_shader", error_file="src/shader.frag", error_line=3)
frames = []
- for i, t in enumerate(judge_times(8.0) + preview_times(8.0, 4)):
+ for i, t in enumerate(judge_times(8.0) + gif_times(8.0, 4)):
p = ws.artifacts / "frames" / f"f{i:02d}_t{t:06.2f}.png"
_frame(p, t, STATIC_MARK in src)
frames.append(GlFrame(index=i, time=t, path=str(p), judge=i < 5))