Files
FreeCADWasmDev/docs/current/bim-image-display-20260914.md
wangdequan 9a7c4f0335 Save FreeCAD Web workspace sources and user validation evidence
IFC native binding remains incomplete; preserve accurate test results.
2026-09-15 22:01:58 +08:00

3.9 KiB

BIM Image Display Repair

Implemented, built and synchronized. Formal receipt: bim-image-display-pipeline.json, one ready and zero missing. No automated tests, browser checks, acceptance or benchmarks ran. This is not full BIM or project completion.

Actual Defects Fixed

  • Image Plane created a native object but object_state returned no image display payload. The existing BIM viewport only rendered shapes and lines.
  • The creation helper called PySide.QtGui.QImage, while BIM's headless PySide declaration layer has no QImage. A compiled helper alone did not make that Python operation callable.

The creation helper now calls a native Python function backed by QImageReader and QImage from the already linked Qt WASM library. It decodes the actual file, rejects unsupported decoders and invalid dimensions, and returns real width and height. No synthetic image dimensions or new image parser were introduced.

The existing FreeCAD Image::ImagePlane object, placement, WorkingPlane and FCStd serialization remain in use. PNG/JPEG/BMP input is limited to 16 MiB and decoding to 32 megapixels; invalid input reports an error before creating the object.

For image objects, the existing document serializer now returns original image bytes, content-derived MIME type and placed corners. Corner ordering and UV mapping follow supplied src/Gui/ViewProviderImagePlane.cpp: resizePlane and the texture coordinate setup. These are display data, not new modeling geometry.

The BIM response adapter checks image coordinates and payload format. BimFrameView uses the current document registry and camera host to display the texture, fit the view and select the native object name. Browser decode errors are displayed; late texture callbacks cannot update a disposed view. Texture, material, geometry and object URLs are released on document change/unmount. The main BIM object view now mounts this renderer when images exist, without duplicating the frame task.

The implementation packet includes the image contract, renderer and upload task, so future continuation sees the actual frontend files, not just native markers.

Recorded Costs

Step Seconds
Initial native display payload compile/link 41.992
Initial native artifact synchronization 3.177
Initial frontend build 5.466
Native Qt decoder correction compile/link 40.789
Isolated implementation packet preparation 1.794
Formal pipeline total 13.104
Pipeline capability generation 8.719
Pipeline build dependency check 0.219
Pipeline final artifact synchronization 3.038
Final frontend build/publication 6.040
Public asset sync inside final frontend build 4.480

Both native builds and both frontend builds exited 0. The second native build was necessary because the missing PySide decoder was discovered after the first display build. The final pipeline build had no compile/link work; it reused the fresh artifact. Existing OCCT/FreeCAD libraries were not rebuilt from scratch.

Remaining Scope

  • The registry remains 1337/1451 routed with 114 requiring implementation. This repairs an already-counted route, so it is not a new route-count gain.
  • Runtime creation, browser rendering and FCStd reopen have not been exercised automatically. Reopened image objects use their restored native ImageFile; missing/unsupported assets fail explicitly rather than render a fake plane.
  • Other image formats, desktop drag-placement interaction, read/cancel task parity and image editing remain separate work. Decoder availability follows the supplied Qt WASM build; unavailable formats are not claimed as supported.
  • Global WASM document ownership and all-module OCCT interface unification are not established by this image display work. No new geometry kernel was added.

Continuation should reuse the native decoder and display payload. Do not restore PySide QImage declarations or count native object creation alone as visible UI.