Skip to content

Add interactive 3D preview viewer#3

Open
dirlligafu wants to merge 5 commits into
6wheel:mainfrom
dirlligafu:three-js-preview
Open

Add interactive 3D preview viewer#3
dirlligafu wants to merge 5 commits into
6wheel:mainfrom
dirlligafu:three-js-preview

Conversation

@dirlligafu

@dirlligafu dirlligafu commented Jul 10, 2026

Copy link
Copy Markdown

What?

Adds a Three.js-based 3D preview panel in the Parts section.

Why?

Selecting parts to include in the final render is currently a trial-and-error process: you have to run the render to see what each part looks like. The 3D preview panel lets users visually identify parts before committing to a render.

What it does

  • Displays the uploaded model in an interactive viewer (orbit, zoom, pan) directly in the UI
  • Toggling a part's checkbox in the list immediately shows/hides it in the viewer
  • Bidirectional hover highlight: hovering a list row highlights the mesh in the viewer, and vice versa
  • Three shading modes: Clay, Faceted, Glossy
  • Diffuse color picker
  • Supported formats: .obj, .dae, .stl, .gltf, .glb, .kn5 (.kn5 files are previewed via the OBJ produced by the existing KN5 converter) .zip uploads are not supported by the preview

Non-invasive by design

The viewer is a visual aid only. It reads from the existing part selection list and has no effect on the render pipeline. The final render works exactly as before. Users who ignore the panel are not affected in any way.

Changes

  • app.py: uploaded file is kept on disk for the session duration; new /preview/ endpoint serves it to Three.js; preview_ext added to upload JSON response
  • model_loader.py: kn5_preview_out parameter saves the converted OBJ before the temp directory is cleaned up
  • templates/index.html: Three.js viewer + all UI controls
  • static/vendor/three/: Three.js r168 and required addons vendored locally. No internet connection required, no new Python dependencies

Preview

image
image
image

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.

2 participants