Skip to content

fix(blender): OpenCode for Blender 0.4.5, say what the saved file lacks - #27

Merged
pascalandr merged 2 commits into
mainfrom
feat/blender-0.4.5
Nov 14, 2026
Merged

pascalandr merged 2 commits into
mainfrom
feat/blender-0.4.5

Conversation

@pascalandr

Copy link
Copy Markdown
Collaborator

OpenCode for Blender 0.4.5, from the 0.4.4 trial (ex06, ex09): the agent checked the open document and concluded while the saved file lacked its last changes (robot pose, light-linking receiver) and the physics cache was outdated. Short facts in existing results; no new tool, nothing imposed.

What changes

  • unsaved in blender_context, blender_apply, blender_execute_code and blender_verify results, only when the open document differs from its file: {file, never_saved?, opencode_steps} (the OpenCode undo steps since the last save or load; changes by hand are not listed).
  • blender_save says what it wrote: bytes, wrote_steps (the OpenCode steps now in the file); after a copy, unsaved (the open file still lacks them). A copy no longer counts as a save of the open file (0.4.4 took Blender's save_post for a copy as one).
  • caches in blender_verify: the simulation caches its checked frames read without a current bake (rigid body world, cloth, soft body, dynamic paint, simulated particles, fluid): not baked, baked but outdated, or checked_frames_outside the bake.
  • A code run that opens a file pushes no undo step into it (the barrier was the old document's), so the opened file is as saved.

Validation

  • ops045_tests.py (5) and one plugin test in a background Blender 5.3: fail on 0.4.4, pass on 0.4.5.
  • Trial through the plugin on copies of the exercises' files (background Blender 5.3): ex06 at frame 120 → caches: [{"cache": "rigid body world", "baked": true, "outdated": true, "info": "120 frames in memory (85 KiB), cache is outdated!"}]; ex09, a change after the save → unsaved: {"file": "shot010.blend", "opencode_steps": ["OpenCode: code"]} in execute_code, context and verify; blender_save → wrote_steps: ["OpenCode: code"], nothing unsaved after.
  • lint, typecheck, npm test, build, check:markers, trace scan, Blender suites, native sessions with OpenCode 2.2.5.

In the 0.4.4 exercises (ex06, ex09) the agent checked the open document and
concluded, while the saved file lacked its last changes (the robot's pose, the
light-linking receiver) and the physics cache it measured was outdated. 0.4.5
adds short facts to existing results; nothing is imposed on the agent.

unsaved: when the open document differs from its file, the results of
blender_context, blender_apply, blender_execute_code and blender_verify say so:
the file's name (never_saved for a new document) and the OpenCode undo steps
pushed since its last save or load (changes made by hand are not listed). The
adapter keeps those steps (barriers excluded) and clears them on a save of the
open file or a load.

blender_save says what it wrote: bytes and wrote_steps, the OpenCode steps now
in the file; after a copy, what the open file still lacks. Blender calls the
save handler for a copy too, with the copy's path: a copy no longer counts as
a save of the open file (0.4.4 took it for one, and a background Blender then
called the open file saved).

caches: blender_verify names the simulation caches its checked frames read
without a current bake: rigid body world, cloth, soft body, dynamic paint,
simulated particles and fluid domains, not baked, baked but outdated (made
before a later change), or baked without a checked frame. On the exercise's
own file, frame 120 now reports the rigid body cache "cache is outdated!".

A code run that opens a file pushes no undo step into it (its barrier was the
old document's), so an opened file is as saved instead of modified.

Validation: ops045_tests.py (5 tests) and one plugin test in a background
Blender 5.3 fail on 0.4.4 and pass on 0.4.5; a trial through the plugin on
copies of the exercises' files (ex06: outdated rigid cache at frame 120; ex09:
a change after the save named in context, execute_code and verify, then
blender_save's wrote_steps, nothing unsaved after). lint, typecheck, npm test,
build, check:markers, trace scan, the Blender suites and native sessions with
OpenCode 2.2.5 pass.
…ed bakes

The 0.4.5 trial (ex06, ex09) saved through execute_code
(bpy.ops.wm.save_as_mainfile) rather than blender_save, in an interface
Blender. Replayed there with the trial's own calls, on a desktop never shown:

- every run that saved still answered unsaved: right after the save, inside
  the run, an interface Blender keeps is_dirty set until its next event loop
  (a background Blender keeps it after any undo step: a run that changed the
  document, then saved, answered unsaved there too; the tests saved without
  changing anything). A document whose revision is the one saved is now saved
  whatever is_dirty says, and a run that saved and changed nothing after it
  (its content compared with the one saved) leaves it so.
- saved_steps listed "OpenCode: failed code": the step a failed run pushes is
  undone at once by its restoration, and is no change of the file. A run that
  changes then saves lists its own change ("OpenCode: code (this run)").
- blender_save after a save in code had nothing pending and returned no
  wrote_steps, read as missing: a save of the open file always says it, an
  empty list when nothing was pending (execute_code's saved_steps too).
- verify listed no cache: the rigid body cache baked in that run was current
  (is_outdated false) at every verify. The QA read it outdated by reopening
  the file: Blender 5.3 flags every rigid body bake outdated when its file is
  opened (the cloth's stays current) and still plays its frames (same
  positions at frame 120). caches now says so in a note on that entry.

Validation: three ops045 tests and the plugin test fail on the PR head
(5facbba) and pass; the trial's sequence replayed in an interface Blender on
the hidden desktop answers no unsaved after the save, saved_steps without
restorations, wrote_steps [] then ["OpenCode: code"]. lint, typecheck,
npm test, build, check:markers, trace scan, the Blender suites (22/22,
extension 1/1) and native sessions with OpenCode 2.2.5 pass.
@pascalandr
pascalandr merged commit 834689d into main Nov 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant