diff --git a/catalog.json b/catalog.json index 06c2e4f..b44f932 100644 --- a/catalog.json +++ b/catalog.json @@ -32,7 +32,7 @@ "fr": "Lire et modifier la scène ouverte dans Blender grâce à l'extension OpenCode Link : changements typés en un pas d'annulation, inspection du Blender lancé, rendus de vérification et en arrière-plan." }, "app": { "name": "Blender", "versions": ">=5.3" }, - "host": { "protocol": 1, "range": "^0.4.5" }, + "host": { "protocol": 1, "range": "^0.4.6" }, "docs": "https://github.com/NeuralNomadsAI/opencode-integrations/blob/main/integrations/blender/plugin/README.md", "status": "preview", "sources": { "git": ["github:NeuralNomadsAI/opencode-integrations#main::path:integrations/blender/plugin"] } diff --git a/integrations/blender/host/opencode_link/addon.py b/integrations/blender/host/opencode_link/addon.py index 2005415..73ded6f 100644 --- a/integrations/blender/host/opencode_link/addon.py +++ b/integrations/blender/host/opencode_link/addon.py @@ -322,7 +322,7 @@ def register(): def _start_offer(): # A Blender that OpenCode Link started to render (render.render_animation) is never offered. - if os.environ.get("OPENCODE_LINK_ROLE") == "render": + if os.environ.get("OPENCODE_LINK_ROLE") in ("render", "verify"): # a background Blender of blender_render or verify return None if _session is not None: _session.start(preferences()) diff --git a/integrations/blender/host/opencode_link/blender_manifest.toml b/integrations/blender/host/opencode_link/blender_manifest.toml index 863f2f4..af7a2d1 100644 --- a/integrations/blender/host/opencode_link/blender_manifest.toml +++ b/integrations/blender/host/opencode_link/blender_manifest.toml @@ -1,7 +1,7 @@ schema_version = "1.0.0" id = "opencode_link" -version = "0.4.5" +version = "0.4.6" name = "OpenCode Link" tagline = "Lets OpenCode work on this Blender session" maintainer = "NeuralNomads" diff --git a/integrations/blender/host/opencode_link/hints.py b/integrations/blender/host/opencode_link/hints.py index 467fd2b..702ab7f 100644 --- a/integrations/blender/host/opencode_link/hints.py +++ b/integrations/blender/host/opencode_link/hints.py @@ -154,16 +154,126 @@ def _operator_poll(error, text, code, filename): seen[member] = value.type else: seen[member] = getattr(value, "name", None) or type(value).__name__ - hint = {"operator": idname, "poll": m.group(3).strip()[:300], "context": seen, - "give_context": "with bpy.context.temp_override(window=..., area=..., region=..., id=..., active_object=...)"} + hint = {"operator": idname, "poll": m.group(3).strip()[:300], "context": seen} try: rna = getattr(getattr(bpy.ops, m.group(1)), m.group(2)).get_rna_type() hint["description"] = (rna.description or "")[:300] except Exception: # noqa: BLE001 pass + hint.update(context_help(m.group(1), m.group(2))) return hint +# -- what would let a refused operator run: its poll() tried, the operator never executed --------------------------- +TRIES = 400 # poll() calls at most per refused operator +_ROOTS = ("active_object", "scene", "view_layer") + + +def context_help(module, name): + """For an operator whose poll refuses the current context: the operators of its group whose poll passes now, + and the context members that make its poll pass, found by trying, with temp_override, the data reachable from + the active object, the scene and the view layer (a member is named after the property that leads to it, or after + a collection's item type), then the screen's areas. Only poll() runs.""" + out = {} + try: + group = getattr(bpy.ops, module) + op = getattr(group, name) + except Exception: # noqa: BLE001 + return out + passing = [] + for other in sorted(dir(group)): + if other != name and _polls(getattr(group, other, None)): + passing.append("%s.%s" % (module, other)) + if passing: + out["same_group_passing"] = passing[:12] + found, tries = [], [0] + + def attempt(override, shown): + if tries[0] >= TRIES or len(found) >= 4: + return + tries[0] += 1 + try: + with bpy.context.temp_override(**override): + if op.poll(): + found.append(shown) + except Exception: # noqa: BLE001 - a member this context does not take + pass + + for member, value, path in _candidates(): + attempt({member: value}, {member: path}) + window = getattr(bpy.context, "window", None) + if not found and window is not None: + for area in window.screen.areas: + region = next((r for r in area.regions if r.type == "WINDOW"), None) + attempt({"window": window, "area": area, "region": region}, + {"area": "the %s area of bpy.context.window.screen, with its WINDOW region" % area.type}) + if found: + out["passes_with"] = [{"temp_override": shown} for shown in found] + out["note"] = "found by trying poll() only; the operator did not run" + else: + out["give_context"] = "with bpy.context.temp_override(window=..., area=..., region=..., id=..., active_object=...)" + return out + + +def _polls(op): + try: + return bool(op.poll()) + except Exception: # noqa: BLE001 + return False + + +def _snake(identifier): + return re.sub(r"(?<=[a-z0-9])(?=[A-Z])", "_", identifier).lower() + + +def _candidates(): + """(member, value, Python path) for the data two steps from the context's roots: pointers named after their + property, collection items after the collection's item type (modifiers -> modifier), IDs also as id.""" + seen = set() + for root in _ROOTS: + value = getattr(bpy.context, root, None) + if value is None: + continue + base = "bpy.context.%s" % root + if isinstance(value, bpy.types.ID): + yield "id", value, base + for member, item, path in _children(value, base): + key = (member, item.as_pointer() if hasattr(item, "as_pointer") else id(item)) + if key not in seen: + seen.add(key) + yield member, item, path + for member2, item2, path2 in _children(item, path): + key = (member2, item2.as_pointer() if hasattr(item2, "as_pointer") else id(item2)) + if key not in seen: + seen.add(key) + yield member2, item2, path2 + + +def _children(struct, path): + rna = getattr(struct, "bl_rna", None) + if rna is None or isinstance(struct, bpy.types.PropertyGroup): + return + for p in rna.properties: + if p.identifier == "rna_type" or p.type not in ("POINTER", "COLLECTION"): + continue + try: + value = getattr(struct, p.identifier) + except Exception: # noqa: BLE001 + continue + if value is None: + continue + if p.type == "POINTER": + yield p.identifier, value, "%s.%s" % (path, p.identifier) + else: + member = _snake(p.fixed_type.identifier) + for index, item in enumerate(value): + if index >= 8: + break + key = getattr(item, "name", None) + shown = "%s.%s[%r]" % (path, p.identifier, key) if key else "%s.%s[%d]" % (path, p.identifier, index) + yield member, item, shown + + def _operator_arguments(error, text, code, filename): idname, rna = _operator_rna(error) if rna is None or not isinstance(error, (TypeError, ValueError)): diff --git a/integrations/blender/host/ops.json b/integrations/blender/host/ops.json index 82dc6bc..1786fde 100644 --- a/integrations/blender/host/ops.json +++ b/integrations/blender/host/ops.json @@ -1,6 +1,6 @@ { "addon": "opencode_link", - "version": "0.4.5", + "version": "0.4.6", "protocol": 1, "method": "apply", "wire": "params.operations: [{op, args}] with every op below (an edit batch); unknown ops and fields are refused", diff --git a/integrations/blender/plugin/README.md b/integrations/blender/plugin/README.md index 9f2a87e..864b32e 100644 --- a/integrations/blender/plugin/README.md +++ b/integrations/blender/plugin/README.md @@ -44,19 +44,19 @@ The **Plugins** section lists OpenCode for Blender as an integration: its versio ## Tools -| Tool | What it does | -| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `blender_hosts` | The offered Blenders (label, document, Blender version, whether this conversation or another one is attached to each) and the add-on's install state; `attach` attaches one (asks permission), `detach` releases this conversation's. | -| `blender_install_host` | Installs or updates OpenCode Link in the newest Blender 5.3 or later (asks permission). | -| `blender_context` | A compact read of the scene: revision, scene settings, collections, markers, a page of objects with their transforms; `ref` gives one object in detail (world bounds, pose bones); `include: ["parts"]` lists a mesh's loose parts (world box, material, dominant vertex group), `region` keeps those in a world box. | -| `blender_apply` | Up to 50 typed operations as one undo step, checked whole before anything changes; a failure part-way restores every changed field. See [Typed operations](#typed-operations). | -| `blender_execute_code` | Python in Blender; every run asks the `blender_execute_code` permission. See [Code execution](#code-execution). | -| `blender_lab` | One of Blender Lab's tools (object and file summaries, screenshots, views, thumbnails), run by the add-on; images come back as attachments. | -| `blender_inspect` | What this Blender really exposes: `search` (words found in its types, properties, functions and operators, with their paths and the properties that lead to a type), a type (properties, functions; a node type's real sockets, made in the `tree` named), an operator (parameters, the element type of its collections, its poll here with Blender's reason) or live data; entries beyond `limit` are named, `match` takes a glob or words. With the links to the API docs, manual and release notes of its version. | -| `blender_verify` | `criteria`: the agent's checks (a read-only expression or a `bpy.data` path, a comparison, a value, frames), each measured on the evaluated scene and passed or failed with the value; `visible`: whether an object shows in the render at a frame, otherwise every reason found (out of frame, hidden in render, collection excluded, view layer not rendered, holdout, transparent or zero-density material, no geometry, hidden behind another object). Without them, or with `render` or `view`: a low-resolution render of the scene's final output, or from a free viewpoint (`view`: location, target, lens), with facts: black or transparent, brightness, the camera used and why, strips, instances. `frames` returns several frames as one contact sheet; `scene` chooses the scene (the facts name the one read, and warn when it is a shot of a montage). `caches` names the simulation caches the checked frames read without a current bake (not baked, outdated, frames outside it) (Blender marks a rigid body bake outdated whenever its file is opened, and says so in `note`); `unsaved`, what the saved file lacks. Settings, cameras and frame are restored; the revision stays. | -| `blender_render` | A render in a separate background Blender to an exact output (an image, a frame pattern or an H.264 video, with the montage's sound when it has any; the result lists the streams written), followed as a task (`task`, `wait_s` up to an hour, `cancel`). It renders the saved file (`unsaved`). | -| `blender_save` | Saves the file, under a path, or a copy, and says what it wrote (bytes; `wrote_steps`, the OpenCode steps now in the file, an empty list when none was pending) and, after a copy, what the open file still lacks (`unsaved`); a save that failed because another process held the file a moment is retried once and says so (`retried`). | -| `blender_import` | BlenderKit and Sketchfab searches, and imports from them or from a file (glTF, FBX, OBJ, USD; a path or an https URL), followed as a task (`task`, `wait_s`, `cancel`). BlenderKit and Sketchfab need their add-ons. | +| Tool | What it does | +| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `blender_hosts` | The offered Blenders (label, document, Blender version, whether this conversation or another one is attached to each) and the add-on's install state; `attach` attaches one (asks permission), `detach` releases this conversation's. | +| `blender_install_host` | Installs or updates OpenCode Link in the newest Blender 5.3 or later (asks permission). | +| `blender_context` | A compact read of the scene: revision, scene settings, collections, markers, a page of objects with their transforms; `ref` gives one object in detail (world bounds, pose bones); `include: ["parts"]` lists a mesh's loose parts (world box, material, dominant vertex group), `region` keeps those in a world box. | +| `blender_apply` | Up to 50 typed operations as one undo step, checked whole before anything changes; a failure part-way restores every changed field. See [Typed operations](#typed-operations). | +| `blender_execute_code` | Python in Blender; every run asks the `blender_execute_code` permission. See [Code execution](#code-execution). | +| `blender_lab` | One of Blender Lab's tools (object and file summaries, screenshots, views, thumbnails), run by the add-on; images come back as attachments. | +| `blender_inspect` | What this Blender really exposes: `search` (words found in its types, properties, functions and operators, with their paths and the properties that lead to a type), a type (properties, functions; a node type's real sockets, made in the `tree` named), an operator (parameters, the element type of its collections, its poll here with Blender's reason) or live data; entries beyond `limit` are named, `match` takes a glob or words. With the links to the API docs, manual and release notes of its version. | +| `blender_verify` | `criteria`: the agent's checks (a read-only expression or a `bpy.data` path, a comparison, a value, frames), each measured on the evaluated scene and passed or failed with the value; `visible`: whether an object shows in the render at a frame, otherwise every reason found (out of frame, hidden in render, collection excluded, view layer not rendered, holdout, transparent or zero-density material, no geometry, hidden behind another object). Without them, or with `render` or `view`: a low-resolution render of the scene's final output, or from a free viewpoint (`view`: location, target, lens), with facts: black or transparent, brightness, the camera used and why, strips, instances. `frames` returns several frames as one contact sheet; `scene` chooses the scene (the facts name the one read, and warn when it is a shot of a montage). `geometry` says what is wrong with the meshes in view (closed meshes with inward normals, open or non-manifold edges, zero-area faces, faces of two objects on one plane toward the camera), and a render names its near-black areas with the object a camera ray meets there; `caches` names the simulation caches the checked frames read without a current bake (not baked, outdated, frames outside it) (Blender marks a rigid body bake outdated whenever its file is opened, and says so in `note`); `unsaved`, what the saved file lacks; `saved` reads the file as written on disk instead (a background Blender opens it: same criteria, `visible` and render; `read` names the file). Settings, cameras and frame are restored; the revision stays. | +| `blender_render` | A render in a separate background Blender to an exact output (an image, a frame pattern or an H.264 video, with the montage's sound when it has any; the result lists the streams written), followed as a task (`task`, `wait_s` up to an hour, `cancel`). It renders the saved file (`unsaved`). | +| `blender_save` | Saves the file, under a path, or a copy, and says what it wrote (bytes; `wrote_steps`, the OpenCode steps now in the file, an empty list when none was pending) and, after a copy, what the open file still lacks (`unsaved`); a save that failed because another process held the file a moment is retried once and says so (`retried`). | +| `blender_import` | BlenderKit and Sketchfab searches, and imports from them or from a file (glTF, FBX, OBJ, USD; a path or an https URL), followed as a task (`task`, `wait_s`, `cancel`). BlenderKit and Sketchfab need their add-ons. | `blender_inspect`, `blender_verify`, `blender_render` and `blender_save` send fixed programs of the package (`programs/*.py`) through the host's code execution, read only, with their parameters as JSON data; they ask no permission because they run no code from the model. Without `if_revision` and `command_id`, `blender_apply` applies to the document as it is now under a new `command_id`; with them it is refused when the scene changed, and a replayed `command_id` applies nothing. @@ -131,7 +131,7 @@ Add-on settings (Preferences ▸ Add-ons ▸ OpenCode Link): _OpenCode service_ When the open document differs from its file, the results of `blender_context`, `blender_apply`, `blender_execute_code` and `blender_verify` carry `unsaved`: the file's name (`never_saved` for a new document) and the OpenCode steps since its last save or load (changes made by hand are not listed); saving a copy leaves it, a run that saves the open file and changes nothing after clears it, and a run that opens a file pushes no step into it. -A run that fails on Blender's API carries a `hint` read from that Blender before the run is undone: for an unknown attribute, the closest names and the type's properties; for an operator's arguments, its real signature (with the element type of its collections) and the closest names; for an invalid enumeration value, the closest items; for a missing key, the collection's keys (a node's sockets included); for an unknown node type, the closest types the tree creates, with their sockets; for a failed poll, Blender's reason and the context the code had. While a run executes, OpenCode Link prepares two calls Blender 5.3 closes on from a script, as Blender's interactive path prepares them, and says so in `warnings`: a mask stroke (`sculpt.brush_stroke` with the Mask brush or `brush_toggle='MASK'`) on a multiresolution object gets its mask layer first, and in a Blender without interface a sculpt-mode operator gets a first undo step when none was pushed yet. If the attached Blender closes, the next call says so with the crash report it wrote (`.crash.txt` in its temporary folder), instead of an unreachable host. +A run that fails on Blender's API carries a `hint` read from that Blender before the run is undone: for an unknown attribute, the closest names and the type's properties; for an operator's arguments, its real signature (with the element type of its collections) and the closest names; for an invalid enumeration value, the closest items; for a missing key, the collection's keys (a node's sockets included); for an unknown node type, the closest types the tree creates, with their sockets; for a failed poll, Blender's reason, the context the code had, the operators of its group whose poll passes, and the context members (with their path) or editor area that make it pass, found by trying `poll()` only. While a run executes, OpenCode Link prepares two calls Blender 5.3 closes on from a script, as Blender's interactive path prepares them, and says so in `warnings`: a mask stroke (`sculpt.brush_stroke` with the Mask brush or `brush_toggle='MASK'`) on a multiresolution object gets its mask layer first, and in a Blender without interface a sculpt-mode operator gets a first undo step when none was pushed yet. If the attached Blender closes, the next call says so with the crash report it wrote (`.crash.txt` in its temporary folder), instead of an unreachable host. ## Blender limits diff --git a/integrations/blender/plugin/host/blender/opencode_link-0.4.5.zip b/integrations/blender/plugin/host/blender/opencode_link-0.4.6.zip similarity index 99% rename from integrations/blender/plugin/host/blender/opencode_link-0.4.5.zip rename to integrations/blender/plugin/host/blender/opencode_link-0.4.6.zip index 70d9a9a..46aaa7c 100644 Binary files a/integrations/blender/plugin/host/blender/opencode_link-0.4.5.zip and b/integrations/blender/plugin/host/blender/opencode_link-0.4.6.zip differ diff --git a/integrations/blender/plugin/methods/tools/blender_verify.json b/integrations/blender/plugin/methods/tools/blender_verify.json index ab67b98..3298851 100644 --- a/integrations/blender/plugin/methods/tools/blender_verify.json +++ b/integrations/blender/plugin/methods/tools/blender_verify.json @@ -1,7 +1,7 @@ { "name": "blender_verify", "domain": "tools", - "description": "Check a result by measurement. criteria: your own acceptance checks, each measured on the evaluated scene at its frames and passed or failed with the measured value. visible: whether an object shows in the render at a frame, otherwise every reason found (out of frame, hidden in render, collection excluded, view layer not rendered, holdout, transparent or zero-density material, no geometry, hidden behind another object). Render (the default without criteria or visible, or with render or view): low-resolution frames with facts (black or transparent, brightness, the camera used and why, sequencer, compositing, instances). caches: simulation caches the checked frames read without a current bake (not baked, outdated, frames outside); unsaved: the file lacks changes you checked here. Settings, cameras and the current frame are restored; the revision stays.", + "description": "Check a result by measurement. criteria: your own acceptance checks, each measured on the evaluated scene at its frames and passed or failed with the measured value. visible: whether an object shows in the render at a frame, otherwise every reason found (out of frame, hidden in render, collection excluded, view layer not rendered, holdout, transparent or zero-density material, no geometry, hidden behind another object). Render (the default without criteria or visible, or with render or view): low-resolution frames with facts (black or transparent, brightness, the camera used and why, sequencer, compositing, instances). geometry: what is wrong with the meshes in view (inward normals, open or non-manifold edges, zero-area faces, coplanar overlapping faces between objects); a render names its near-black areas and the object there. caches: simulation caches the checked frames read without a current bake (not baked, outdated, frames outside); unsaved: the file lacks changes you checked here. Settings, cameras and the current frame are restored; the revision stays.", "kind": "host-backed", "risk": "read", "args": { @@ -16,6 +16,10 @@ "type": "object", "description": "{object, frame or frames}: does it show in the render, and why not." }, + "saved": { + "type": "any", + "description": "true: read the open file as saved on disk (a background Blender opens it; same criteria, visible and render), or a .blend path. Compare it with the open document." + }, "render": { "type": "boolean", "description": "Also render (default: only without criteria and visible)." diff --git a/integrations/blender/plugin/package.json b/integrations/blender/plugin/package.json index b503940..4f9b4eb 100644 --- a/integrations/blender/plugin/package.json +++ b/integrations/blender/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@neuralnomads/opencode-blender", - "version": "0.4.5", + "version": "0.4.6", "description": "OpenCode for Blender: lets OpenCode read and change an open Blender scene through an authenticated local host, with typed edits, inspection, verification renders and background renders.", "license": "MIT AND GPL-3.0-or-later", "type": "module", @@ -60,10 +60,10 @@ "host": { "app": "blender", "protocol": 1, - "range": "^0.4.5", + "range": "^0.4.6", "appVersions": ">=5.3", - "payload": "host/blender/opencode_link-0.4.5.zip", - "sha256": "82ca90eca45d454f0d1fe403c2c4dd4cffc1d3990e1bd6e374ab515314adfb73" + "payload": "host/blender/opencode_link-0.4.6.zip", + "sha256": "c5defc03b74f70744899f16c02d95be76769582cf8f04d3fec75ff0efa7184ac" } } } diff --git a/integrations/blender/plugin/programs/inspect.py b/integrations/blender/plugin/programs/inspect.py index 5b41589..6f1e6f4 100644 --- a/integrations/blender/plugin/programs/inspect.py +++ b/integrations/blender/plugin/programs/inspect.py @@ -360,7 +360,11 @@ def node_info(rna, live=None, tree_type=None): "region": ctx.region.type if ctx.region else None, "mode": ctx.mode, "active_object": ctx.active_object.name if ctx.active_object else None, "id": getattr(ctx, "id", None) is not None} - report["give_context"] = "bpy.context.temp_override(window=..., area=..., region=..., id=..., active_object=...)" + # What would let it run, found by the add-on trying poll() only (hints.context_help). + import sys + helper = next((m for k, m in list(sys.modules.items()) if k.endswith("opencode_link.hints")), None) + found = helper.context_help(module, name) if helper is not None and hasattr(helper, "context_help") else {} + report.update(found or {"give_context": "bpy.context.temp_override(window=..., area=..., region=..., id=..., active_object=...)"}) props = [p for p in rna.properties if p.identifier != "rna_type"] info = { "id": P["operator"], "name": rna.name, "desc": (rna.description or "")[:300], diff --git a/integrations/blender/plugin/programs/verify.py b/integrations/blender/plugin/programs/verify.py index 06be24b..4aa0573 100644 --- a/integrations/blender/plugin/programs/verify.py +++ b/integrations/blender/plugin/programs/verify.py @@ -474,6 +474,67 @@ def run_checks(): checks = run_checks() if (CRITERIA or VISIBLE) else {} +BLACK = 0.02 # luminance of a near-black pixel +GRID = 32 # cells across the image + + +def black_regions(w, h, lum, alpha, cam, dg): + """Near-black, opaque areas of a rendered image (cells mostly below BLACK, joined), largest first, each with its + box (0..1, from the top left) and the object a ray from the camera meets at its centre.""" + side = max(1, w // GRID) + cols, rows = (w + side - 1) // side, (h + side - 1) // side + dark, total = [0] * (cols * rows), [0] * (cols * rows) + for i, value in enumerate(lum): + cell = ((i // w) // side) * cols + (i % w) // side + total[cell] += 1 + if value < BLACK and alpha[i] > 0.5: + dark[cell] += 1 + black = {c for c in range(cols * rows) if total[c] and dark[c] >= 0.9 * total[c]} + found, seen = [], set() + for start in black: + if start in seen: + continue + group, stack = [], [start] + seen.add(start) + while stack: + c = stack.pop() + group.append(c) + r, q = divmod(c, cols) + for nr, nq in ((r - 1, q), (r + 1, q), (r, q - 1), (r, q + 1)): + n = nr * cols + nq + if 0 <= nr < rows and 0 <= nq < cols and n in black and n not in seen: + seen.add(n) + stack.append(n) + share = sum(total[c] for c in group) / (w * h) + if share < 0.003: + continue + rs, qs = [c // cols for c in group], [c % cols for c in group] + # Pixel rows run bottom-up: the box is given from the top left, like the image as seen. + x0, x1 = min(qs) * side / w, min(w, (max(qs) + 1) * side) / w + y0, y1 = min(rs) * side / h, min(h, (max(rs) + 1) * side) / h + box = [round(x0, 3), round(1 - y1, 3), round(x1, 3), round(1 - y0, 3)] + found.append((share, {"box": box, "share": round(share, 4), "object": seen_at(cam, dg, (x0 + x1) / 2, (y0 + y1) / 2)})) + found.sort(key=lambda item: -item[0]) + return [entry for _share, entry in found[:6]] + + +def seen_at(cam, dg, u, v): + """The object a camera ray meets at (u, v) of the frame (0..1, from the bottom left), or the world.""" + if cam is None: + return None + ev = cam.evaluated_get(dg) + corners = ev.data.view_frame(scene=scene) # top right, bottom right, bottom left, top left + local = corners[2] + (corners[1] - corners[2]) * u + (corners[3] - corners[2]) * v + mw = ev.matrix_world + if ev.data.type == "ORTHO": + origin, direction = mw @ Vector((local.x, local.y, 0.0)), mw.to_3x3() @ Vector((0.0, 0.0, -1.0)) + else: + origin = mw.translation.copy() + direction = (mw @ local) - origin + hit, _loc, _normal, _index, obj, _matrix = scene.ray_cast(dg, origin, direction.normalized()) + return obj.original.name if hit and obj is not None else "the world (no object)" + + def render_frames(): """The renders (unchanged since 0.4.2): settings, cameras and the current frame restored; the PNG or sheet.""" old_frame = scene.frame_current @@ -541,6 +602,10 @@ def render_frames(): facts["image"]["black"] = max(lum) < 0.02 facts["image"]["transparent"] = facts["image"]["mean_alpha"] < 0.01 facts["image"]["uniform"] = std < 0.002 + if not facts["image"]["black"]: + regions = black_regions(w, h, lum, alpha, scene.camera, dg) + if regions: + facts["image"]["black_regions"] = regions if len(frames) == 1: with open(path, "rb") as fh: image_b64 = base64.b64encode(fh.read()).decode("ascii") @@ -653,6 +718,117 @@ def point_cache(owner, pc): return out[:20] +GEOMETRY_FACES = 200_000 # faces read at most, all objects together +OVERLAP_MIN = 0.01 # m2 of coplanar overlap worth saying + + +def in_view(obj, dg, cam): + """Whether obj's evaluated bounds meet the camera's frame (every mesh when there is no camera).""" + if cam is None: + return True + from bpy_extras.object_utils import world_to_camera_view + ev = obj.evaluated_get(dg) + pts = [world_to_camera_view(scene, cam, ev.matrix_world @ Vector(c)) for c in ev.bound_box] + if max(p.z for p in pts) <= 0: + return False + return not (max(p.x for p in pts) < 0 or min(p.x for p in pts) > 1 or max(p.y for p in pts) < 0 or min(p.y for p in pts) > 1) + + +def geometry_health(f): + """Facts about the evaluated meshes in view at frame f, read from their geometry; only what is found: closed + meshes whose normals point inward, open or non-manifold edges, zero-area faces, and faces of two objects on + the same plane, facing the same way toward the camera (z-fighting; a surface inside another closed mesh).""" + scene.frame_set(f) + dg = depsgraph_at() + cam_name, _via = camera_at(scene, f) + cam = bpy.data.objects.get(cam_name) if cam_name else None + eye = cam.evaluated_get(dg).matrix_world.translation if cam is not None else None + out = {"inward_normals": [], "open_edges": {}, "non_manifold_edges": {}, "zero_area_faces": {}} + planes, budget = {}, GEOMETRY_FACES + for obj in scene.objects: + if obj.type not in ("MESH", "CURVE", "SURFACE", "FONT", "META") or obj.hide_render or not obj.visible_get(): + continue + if not in_view(obj, dg, cam): + continue + ev = obj.evaluated_get(dg) + mesh = ev.to_mesh() + try: + if len(mesh.polygons) > budget: + out.setdefault("skipped", []).append(obj.name) + continue + budget -= len(mesh.polygons) + mw = ev.matrix_world + co = [mw @ v.co for v in mesh.vertices] + users = {} + volume, zero = 0.0, 0 + for poly in mesh.polygons: + idx = list(poly.vertices) + for key in poly.edge_keys: + users[key] = users.get(key, 0) + 1 + a = co[idx[0]] + normal, area = Vector(), 0.0 + for i in range(1, len(idx) - 1): + b, c = co[idx[i]], co[idx[i + 1]] + cross = (b - a).cross(c - a) + normal += cross + area += cross.length / 2 + volume += a.dot(b.cross(c)) / 6 + if area < 1e-10: + zero += 1 + continue + normal.normalize() + if eye is not None and normal.dot(eye - a) <= 0: + continue # faces away from the camera + # The plane, its sign fixed so both orientations share a key; the face keeps its own orientation. + key_n = normal if (normal.x, normal.y, normal.z) > (0, 0, 0) else -normal + key = (round(key_n.x, 3), round(key_n.y, 3), round(key_n.z, 3), round(key_n.dot(a), 3)) + axes = sorted(range(3), key=lambda k: abs(normal[k]))[:2] + pts = [co[i] for i in idx] + box = [min(p[axes[0]] for p in pts), min(p[axes[1]] for p in pts), + max(p[axes[0]] for p in pts), max(p[axes[1]] for p in pts)] + planes.setdefault(key, []).append((obj.name, normal, box)) + boundary = sum(1 for n in users.values() if n == 1) + many = sum(1 for n in users.values() if n > 2) + if many: + out["non_manifold_edges"][obj.name] = many + if boundary and boundary <= 0.2 * len(users): + out["open_edges"][obj.name] = boundary # a mostly closed mesh with holes + if not boundary and not many and users and volume < -1e-9: + out["inward_normals"].append(obj.name) + if zero: + out["zero_area_faces"][obj.name] = zero + finally: + ev.to_mesh_clear() + pairs = {} + for faces in planes.values(): + if len({name for name, _n, _b in faces}) < 2: + continue + for i, (name_a, n_a, a) in enumerate(faces): + for name_b, n_b, b in faces[i + 1:]: + if name_a == name_b or n_a.dot(n_b) < 0.999: + continue + w, h = min(a[2], b[2]) - max(a[0], b[0]), min(a[3], b[3]) - max(a[1], b[1]) + if w > 1e-6 and h > 1e-6: + pair = tuple(sorted((name_a, name_b))) + pairs[pair] = pairs.get(pair, 0.0) + w * h + found = {k: v for k, v in out.items() if v} + overlaps = sorted(((area, pair) for pair, area in pairs.items() if area >= OVERLAP_MIN), reverse=True) + if overlaps: + found["coplanar_overlaps"] = [{"objects": list(pair), "area_m2": round(area, 3)} for area, pair in overlaps[:8]] + found["coplanar_note"] = "faces of both objects on one plane toward the camera: they fight (z-fighting), and a surface inside another closed mesh renders dark" + if found: + found["frame"] = f + return found + + +old_frame = scene.frame_current +try: + checked = checked_frames() or frames + geometry = geometry_health(checked[0]) +finally: + scene.frame_set(old_frame) +if geometry: + checks["geometry"] = geometry caches = simulation_caches(checked_frames()) if caches: checks["caches"] = caches diff --git a/integrations/blender/plugin/programs/verify_saved.py b/integrations/blender/plugin/programs/verify_saved.py new file mode 100644 index 0000000..9446b64 --- /dev/null +++ b/integrations/blender/plugin/programs/verify_saved.py @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# blender_verify with saved (fixed program): the same verification, read from the file as written on disk instead +# of the open document: a background Blender opens the file and runs the verify program there (criteria, visible, +# render), so what is written can be compared with what the open document shows. +# PARAMS: the verify parameters with "saved": true (the open file) or a .blend path. JOB: verify.py, prepended by +# the plugin. +import json +import os +import shutil +import subprocess +import tempfile +import time + +import bpy + +P = PARAMS # noqa: F821 +target = P.get("saved") +current = bpy.data.filepath +if target is True: + if not current: + raise ValueError("saved: the open file was never saved, there is no file to read (blender_save first)") + path = current +elif isinstance(target, str) and target: + path = target if os.path.isabs(target) else os.path.join(os.path.dirname(current) if current else os.getcwd(), target) + path = os.path.normpath(path) +else: + raise ValueError("saved: true (the open file as saved) or a .blend path") +if not os.path.isfile(path): + raise ValueError("saved: no file %s" % path) + +params = {key: value for key, value in P.items() if key != "saved"} +work = tempfile.mkdtemp(prefix="opencode_verify_saved_") +try: + out_path = os.path.join(work, "result.json") + script = os.path.join(work, "verify.py") + with open(script, "w", encoding="utf-8") as fh: + fh.write("import json\nPARAMS = json.loads(%r)\n" % json.dumps(params)) + fh.write(JOB) # noqa: F821 - verify.py, prepended by the plugin + fh.write("\nwith open(%r, 'w', encoding='utf-8') as _out:\n json.dump(result, _out, default=repr)\n" % out_path) + env = {k: v for k, v in os.environ.items() if not k.upper().startswith("BLENDER_SYSTEM_") and k != "OPENCODE_LINK_OFFER_KEY"} + env["OPENCODE_LINK_ROLE"] = "verify" # never offered to OpenCode + kwargs = {"stdin": subprocess.DEVNULL, "stdout": subprocess.PIPE, "stderr": subprocess.STDOUT, "env": env} + if os.name == "nt": + kwargs["creationflags"] = 0x08000000 # no console window + started = time.time() + run = subprocess.run([bpy.app.binary_path, "-b", path, "--python-exit-code", "1", "--python", script], + timeout=int(P.get("timeout_s") or 540), **kwargs) + if not os.path.exists(out_path): + tail = run.stdout.decode("utf-8", "replace")[-1500:] if run.stdout else "" + raise RuntimeError("the background Blender reading %s gave no result (exit %s):\n%s" % (path, run.returncode, tail)) + with open(out_path, encoding="utf-8") as fh: + result = json.load(fh) +finally: + shutil.rmtree(work, ignore_errors=True) +stat = os.stat(path) +result["read"] = {"file": path, "saved_at": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(stat.st_mtime)), + "bytes": stat.st_size, "seconds": round(time.time() - started, 1), + "by": "a background Blender on the file as written on disk, not the open document"} diff --git a/integrations/blender/plugin/src/integration.ts b/integrations/blender/plugin/src/integration.ts index e968d81..f8b2b81 100644 --- a/integrations/blender/plugin/src/integration.ts +++ b/integrations/blender/plugin/src/integration.ts @@ -598,7 +598,11 @@ export async function setupBlender(ctx: Plugin.Context, deps: BlenderDeps = {}) }, async blender_verify(args, context) { - const run = await programRun(context, "verify", args, VERIFY_TIMEOUT_MS) + // saved: the file as written on disk, read by a background Blender, instead of the open document. + const saved = args.saved !== undefined && args.saved !== false + if (saved && args.saved !== true && typeof args.saved !== "string") + throw new Error("saved: true (the open file as saved) or a .blend path.") + const run = await programRun(context, saved ? "verify_saved" : "verify", args, VERIFY_TIMEOUT_MS) const { image_base64, ...rest } = run.result as { image_base64?: string } & Record // Criteria first: what passed and failed, measured, then what the saved file lacks, then the facts. const { blender, facts, ...checks } = rest diff --git a/integrations/blender/plugin/src/programs.ts b/integrations/blender/plugin/src/programs.ts index ade0301..63805ec 100644 --- a/integrations/blender/plugin/src/programs.ts +++ b/integrations/blender/plugin/src/programs.ts @@ -13,13 +13,17 @@ const PROGRAMS = { verify: read("verify.py"), render: read("render.py"), save: read("save.py"), + verify_saved: read("verify_saved.py"), +} +// The background Blender's script: render.py's job, and for verify_saved the verify program itself. +const JOBS: Partial> = { + render: read("render_job.py"), + verify_saved: PROGRAMS.verify, } -// The background render Blender's script, which render.py writes next to its log. -const RENDER_JOB = read("render_job.py") export type ProgramName = keyof typeof PROGRAMS export function programCode(name: ProgramName, params: unknown) { - const job = name === "render" ? `JOB = ${JSON.stringify(RENDER_JOB)}\n` : "" + const job = JOBS[name] === undefined ? "" : `JOB = ${JSON.stringify(JOBS[name])}\n` return `import json\nPARAMS = json.loads(${JSON.stringify(JSON.stringify(params))})\n${job}${PROGRAMS[name]}` } diff --git a/integrations/blender/test/blender.test.ts b/integrations/blender/test/blender.test.ts index c431018..c412891 100644 --- a/integrations/blender/test/blender.test.ts +++ b/integrations/blender/test/blender.test.ts @@ -20,6 +20,8 @@ const OPS043_TESTS = 3 const OPS044_TESTS = 12 // The tests of ops045_tests.py: the 0.4.4 exercises' findings (QA journal, Luna section). const OPS045_TESTS = 8 +// The tests of ops046_tests.py: the 0.4.5 exercises' findings (QA journal, Luna section). +const OPS046_TESTS = 3 const folder = join(import.meta.dirname, "blender") type Result = { passed: string[]; failed: Array<{ name: string; error: string; trace: string }> } @@ -348,6 +350,96 @@ describe("OpenCode Link in Blender (background)", { skip }, () => { } }) + it("passes the tests of the 0.4.5 exercises' findings (0.4.6)", async () => { + assert.equal((await hostScript("ops046_tests.py", (scratch) => [scratch], 400_000)).passed.length, OPS046_TESTS) + }) + + it("blender_inspect says what lets a refused operator run; blender_verify reads the saved file (0.4.6)", async () => { + const { iso, plugin, stop, json } = await served() + try { + const code = async (text: string) => { + const out = json(await plugin.tool("blender_execute_code", { code: text })) + assert.equal(out.status, "executed", JSON.stringify(out).slice(0, 1200)) + return out + } + await code( + "import bpy\nbpy.ops.mesh.primitive_plane_add()\nbpy.context.object.name = 'Sheet'\n" + + "bpy.context.object.modifiers.new('Cloth', 'CLOTH')", + ) + const poll = json(await plugin.tool("blender_inspect", { operator: "ptcache.bake" })).operator.poll + assert.equal(poll.in_this_context, false) + assert.ok(poll.same_group_passing.includes("ptcache.bake_all"), JSON.stringify(poll)) + assert.deepEqual(poll.passes_with[0], { + temp_override: { point_cache: "bpy.context.active_object.modifiers['Cloth'].point_cache" }, + }) + // ex09: the open document moved the sheet after the save; the file still has it where it was. + const file = join(iso.root, "shot.blend") + await code( + `import bpy\nbpy.data.objects['Sheet'].location.z = 1\nbpy.ops.wm.save_as_mainfile(filepath=${JSON.stringify(file)})`, + ) + await code("import bpy\nbpy.data.objects['Sheet'].location.z = 5") + const criteria = [{ label: "sheet height", expr: "world('Sheet').z", op: "==", value: 5 }] + const live = json(await plugin.tool("blender_verify", { criteria })) + assert.equal(live.criteria[0].measured, 5) + assert.equal(live.read, undefined) + const saved = json(await plugin.tool("blender_verify", { criteria, saved: true })) + assert.equal(saved.criteria[0].measured, 1, JSON.stringify(saved).slice(0, 1500)) + assert.equal(saved.criteria[0].passed, false) + assert.equal(saved.read.file, file) + assert.equal(saved.unsaved.file, "shot.blend", "and the open document still differs from it") + await assert.rejects(plugin.tool("blender_verify", { criteria, saved: join(iso.root, "none.blend") }), /no file/) + } finally { + await stop() + } + }) + + it("blender_verify states the geometry health of what is in view and the black areas of its render (0.4.6)", async () => { + const { plugin, stop, json } = await served() + try { + const built = json( + await plugin.tool("blender_execute_code", { + code: [ + "import bpy, math", + "sc = bpy.context.scene", + "bpy.data.objects.remove(bpy.data.objects['Cube'])", + "sc.render.engine = 'BLENDER_WORKBENCH'", + "sc.display.shading.light = 'FLAT'", + "sc.display.shading.color_type = 'MATERIAL'", + "cam = bpy.data.objects['Camera']", + "cam.location, cam.rotation_euler = (0, -10, 1), (math.radians(90), 0, 0)", + "def box(name, loc, scale):", + " bpy.ops.mesh.primitive_cube_add(size=1, location=loc)", + " o = bpy.context.object; o.name = name; o.scale = scale", + " bpy.ops.object.transform_apply(scale=True)", + " return o", + // the archviz case: two wall pieces overlapping, their room-side faces on one plane + "box('Wall A', (2, 2, 1), (2, 0.2, 1)); box('Wall B', (2.5, 2, 1), (2, 0.2, 1))", + "box('Inside out', (-2.5, 2, 1), (1, 1, 1)).data.flip_normals()", + "bpy.ops.mesh.primitive_uv_sphere_add(location=(-2.5, 2, 2.6), radius=0.5); s = bpy.context.object; s.name = 'Holed'", + "import bmesh; bm = bmesh.new(); bm.from_mesh(s.data); bm.faces.ensure_lookup_table(); bmesh.ops.delete(bm, geom=[bm.faces[0]], context='FACES_ONLY'); bm.to_mesh(s.data); bm.free()", + "me = bpy.data.meshes.new('Sliver'); me.from_pydata([(0, 2, 0), (0.5, 2, 0), (1, 2, 0)], [], [(0, 1, 2)])", + "sc.collection.objects.link(bpy.data.objects.new('Sliver', me))", + "bpy.ops.mesh.primitive_plane_add(size=2, location=(0, 1, 1), rotation=(math.radians(90), 0, 0)); b = bpy.context.object; b.name = 'Board'", + "m = bpy.data.materials.new('Black'); m.diffuse_color = (0, 0, 0, 1); b.data.materials.append(m)", + ].join("\n"), + }), + ) + assert.equal(built.status, "executed", JSON.stringify(built).slice(0, 1500)) + const out = await plugin.tool("blender_verify", { render: true, size: 320 }) + const checked = JSON.parse(String((out.content as ReadonlyArray<{ text?: string }>)[0]?.text)) + const geometry = checked.geometry + assert.deepEqual(geometry.coplanar_overlaps[0].objects, ["Wall A", "Wall B"], JSON.stringify(geometry)) + assert.ok(geometry.coplanar_overlaps[0].area_m2 > 1.4) + assert.deepEqual(geometry.inward_normals, ["Inside out"]) + assert.equal(geometry.open_edges.Holed > 0, true) + assert.equal(geometry.zero_area_faces.Sliver, 1) + const regions = checked.facts.image.black_regions + assert.equal(regions[0].object, "Board", JSON.stringify(regions)) + } finally { + await stop() + } + }) + it("passes the tests of the western film's v7 frictions (0.4.2)", async () => { assert.equal((await hostScript("ops042_tests.py", (scratch) => [scratch], 400_000)).passed.length, OPS042_TESTS) }) diff --git a/integrations/blender/test/blender/ops046_tests.py b/integrations/blender/test/blender/ops046_tests.py new file mode 100644 index 0000000..d4fdc72 --- /dev/null +++ b/integrations/blender/test/blender/ops046_tests.py @@ -0,0 +1,103 @@ +"""The 0.4.5 exercises' findings (QA journal, Luna section, ex06): an operator refused its context (ptcache.bake) and +the error said only "context is incorrect". The hint now says, read from this Blender by trying poll() only, which +operators of its group pass and which context member makes it pass. Each test fails on the 0.4.5 add-on and passes +on 0.4.6, in a private background Blender 5.3 (run by blender.test.ts). Prints RESULT . +Usage: blender -b --factory-startup --python ops046_tests.py -- +""" + +import importlib +import json +import sys +import traceback + +import addon_utils +import bpy + +MODULE = "bl_ext.user_default.opencode_link" +addon_utils.enable(MODULE, default_set=True, handle_error=None) +addon = importlib.import_module(MODULE + ".addon") +session = addon.session() +core, app = session.core, session.app +session.stop() +SCRATCH = sys.argv[sys.argv.index("--") + 1] + +results = {"passed": [], "failed": [], "host_version": core.version} +TESTS = [] + + +def test(fn): + TESTS.append(fn) + return fn + + +def check(condition, message): + if not condition: + raise AssertionError(message) + + +def empty(): + bpy.ops.wm.read_factory_settings(use_empty=True) + core.quarantined = False + core.quarantine = None + bpy.context.view_layer.update() + addon.pump(0.05) + + +def run_code(text, read_only=False): + params = {"script_handle": app.script_handle(), "code": text} + if read_only: + params["read_only"] = True + return core.handle("execute_code", params) + + +@test +def p06_a_refused_bake_says_which_context_member_makes_it_pass(): + empty() + run_code("import bpy\nbpy.ops.mesh.primitive_plane_add()\nbpy.context.object.name = 'Cloth_Sheet'\n" + "bpy.context.object.modifiers.new('Cloth', 'CLOTH')\nbpy.ops.mesh.primitive_cube_add(location=(0, 0, 3))\n" + "bpy.ops.rigidbody.object_add()\nbpy.context.view_layer.objects.active = bpy.data.objects['Cloth_Sheet']") + out = run_code("import bpy\nbpy.ops.ptcache.bake(bake=True)") + check(out["status"] == "failed", "refused: %s" % out) + hint = out.get("hint") or {} + check(hint.get("operator") == "ptcache.bake", "the operator named: %s" % hint) + check({"ptcache.bake_all", "ptcache.free_bake_all"} <= set(hint.get("same_group_passing", [])), + "its group's passing operators: %s" % hint.get("same_group_passing")) + overrides = [entry["temp_override"] for entry in hint.get("passes_with", [])] + check(any(o.get("point_cache") == "bpy.context.active_object.modifiers['Cloth'].point_cache" for o in overrides), + "the member that makes it pass, with its path: %s" % overrides) + cache = bpy.data.objects["Cloth_Sheet"].modifiers["Cloth"].point_cache + check(not cache.is_baked, "only poll() was tried: nothing baked") + # The path given works as written. + done = run_code("import bpy\nwith bpy.context.temp_override(point_cache=%s):\n bpy.ops.ptcache.bake(bake=True)\n" + "result = {'baked': bpy.data.objects['Cloth_Sheet'].modifiers['Cloth'].point_cache.is_baked}" + % overrides[0]["point_cache"]) + check(done["status"] == "executed" and done["result"] == {"baked": True}, "the override runs it: %s" % done) + + +@test +def p_an_operator_needing_an_editor_gets_the_area_that_passes(): + empty() + out = run_code("import bpy\nbpy.ops.view3d.view_all()") + hint = out.get("hint") or {} + check(hint.get("poll") == "Expected a view3d region", "Blender's own reason: %s" % hint.get("poll")) + areas = [entry["temp_override"].get("area", "") for entry in hint.get("passes_with", [])] + check(any("VIEW_3D" in area for area in areas), "the area that passes: %s" % hint.get("passes_with")) + + +@test +def p_nothing_found_keeps_the_generic_advice(): + empty() + out = run_code("import bpy\nbpy.ops.sculpt.brush_stroke(stroke=[])") + hint = out.get("hint") or {} + check(hint.get("operator") == "sculpt.brush_stroke" and "passes_with" not in hint, "nothing passes here: %s" % hint) + check("temp_override" in hint.get("give_context", ""), "the generic advice stays: %s" % hint) + + +for fn in TESTS: + try: + fn() + results["passed"].append(fn.__name__) + except Exception as error: # noqa: BLE001 + results["failed"].append({"name": fn.__name__, "error": "%s: %s" % (type(error).__name__, error), + "trace": traceback.format_exc()[-1500:]}) +print("RESULT " + json.dumps(results), flush=True) diff --git a/integrations/blender/test/plugin.test.ts b/integrations/blender/test/plugin.test.ts index cb0dc76..7c79127 100644 --- a/integrations/blender/test/plugin.test.ts +++ b/integrations/blender/test/plugin.test.ts @@ -27,7 +27,7 @@ async function plugin(input: Parameters[0] = {}): Promise { const other = await plugin() await other.rpc("advertise", announcement(old.endpoint, old.scriptHandle)) other.registry.attach(other.registry.hosts().offers[0]?.offerID as string, "ses_test") - await assert.rejects(other.tool("blender_context"), /no scene method: install OpenCode Link 0\.4\.5/) + await assert.rejects(other.tool("blender_context"), /no scene method: install OpenCode Link 0\.4\.6/) assert.ok(loaded) }) }) diff --git a/integrations/blender/test/publication.test.ts b/integrations/blender/test/publication.test.ts index 4f8cf77..c16f6e7 100644 --- a/integrations/blender/test/publication.test.ts +++ b/integrations/blender/test/publication.test.ts @@ -6,7 +6,7 @@ test("only Blender is publishable, with public access and trusted-publishing met const plugin = new URL("../plugin/", import.meta.url) const pkg = JSON.parse(readFileSync(new URL("package.json", plugin), "utf8")) assert.equal(pkg.name, "@neuralnomads/opencode-blender") - assert.equal(pkg.version, "0.4.5") + assert.equal(pkg.version, "0.4.6") assert.equal(pkg.private, undefined) assert.equal(pkg.publishConfig.access, "public") assert.equal(pkg.repository.url, "https://github.com/NeuralNomadsAI/opencode-integrations") diff --git a/package-lock.json b/package-lock.json index 2765099..35cef54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ }, "integrations/blender/plugin": { "name": "@neuralnomads/opencode-blender", - "version": "0.4.5", + "version": "0.4.6", "license": "MIT AND GPL-3.0-or-later", "devDependencies": { "@opencode/plugin": "2.2.5", diff --git a/spec/README.md b/spec/README.md index f88646e..41de3a4 100644 --- a/spec/README.md +++ b/spec/README.md @@ -19,9 +19,9 @@ The integration's `package.json` carries a marker under `opencodeIntegration`, r "host": { "app": "blender", "protocol": 1, - "range": "^0.4.5", + "range": "^0.4.6", "appVersions": ">=5.3", - "payload": "host/blender/opencode_link-0.4.5.zip", + "payload": "host/blender/opencode_link-0.4.6.zip", "sha256": "" } }