Commit graph

66 commits

Author SHA1 Message Date
Zyk
bdcce212f8 Add MIT license 2026-05-09 16:05:15 +08:00
Zyk
b18cfa0f02 Fix model stats export and orientation gizmo 2026-05-09 15:11:11 +08:00
flash555588
c079cb32bb fix: annotation projection stability and null safety
- Show hidden pins immediately when camera moves (not just on occlusion frames)
- Throttle scene.pick occlusion checks from every 3 to every 6 frames
- Guard against disposed scene in projection loop
- Replace preview! with preview?. in slider/axis closures
- Use scene.forceWireframe for PBR material support
2026-05-09 14:11:30 +08:00
flash555588
69854aae45 docs: add 3D annotations and i18n to README 2026-05-09 14:11:30 +08:00
Flash
f1e9965776
Merge pull request #3 from flash555588/feat/annotations
feat: 3D annotation/bookmark system with depth-aware occlusion
2026-05-09 13:36:49 +08:00
flash555588
c7476e740c feat: add 3D annotation/bookmark system with depth-aware occlusion
- Click-to-pin: click on 3D model to add labeled bookmarks with color
- Edit existing pins: click pin to edit label/color, or delete
- Camera focus: click pin label in panel to animate camera to pin position
- Depth occlusion: pins behind geometry show blurred/dimmed; fully hidden when camera idle
- Workbench integration: Annotations panel with toggle, pin list, edit/delete/focus actions
- DirectView integration: annotation toolbar button with pin count badge
- Code-block readonly: display saved annotations in inline previews
- ESC to exit annotation mode
- Semi-transparent mode overlay when annotation active
- Coordinate fix: engine render → CSS pixel scaling for accurate pin positioning
- Relative occlusion epsilon for large model compatibility
2026-05-09 13:33:17 +08:00
flash555588
521a442c5a fix: add missing BRepAdaptor_Surface import in STEP color extraction
The build_xde_color_lookup function used BRepAdaptor_Surface without
importing it, causing a silent NameError that left the color lookup
table empty. All STEP faces fell back to default gray [180,180,180].
2026-05-09 01:37:32 +08:00
flash555588
154dae8fe6 feat: add i18n support with auto-detect system locale
- Add en/zh-CN translation dictionaries for all settings strings
- Add t() translation function with locale state management
- Add locale field to PluginSettings with auto-detect on first run
- Replace all hardcoded English strings in settings.ts with t() calls
- Add language selector dropdown at top of settings page
2026-05-09 01:26:06 +08:00
flash555588
aac8b5ec60 fix: orientation gizmo viewport, wireframe root mesh, compact preview height
- orientation-gizmo: set viewport directly on camera instead of manual
  engine.setViewport (which was overridden by scene.render)
- scene: include rootMesh in wireframe iteration for STL/PLY single-mesh models
- direct-view: remove height:100% that caused excessive blank space
- code-block: remove defaultCanvasHeight from min-height, use CSS only;
  grid uses height instead of min-height so CSS max-height can cap it
- styles.css: reduce preview-host min-height, add grid-host max-height
2026-05-09 01:03:07 +08:00
Umr
2cff3e6faa
Merge pull request #2 from flash555588/codex/fix-picking-and-scroll
Fix picking highlight and wheel handling
2026-05-09 00:13:38 +08:00
Zyk
9f57b87789 Fix picking highlight and wheel handling 2026-05-09 00:12:19 +08:00
Umr
3426166472
Merge pull request #1 from flash555588/codex/fix-dependency-conflicts
Fix dependency conflicts
2026-05-08 23:40:16 +08:00
Zyk
e9491556bc Merge remote-tracking branch 'origin/main' into codex/fix-dependency-conflicts
# Conflicts:
#	README.md
2026-05-08 23:40:03 +08:00
Zyk
db5f5fa7de Fix dependency conflicts 2026-05-08 23:35:55 +08:00
flash555588
74c645d5c2 docs: complete bilingual README with clear structure
- Rewrite README.md with table of contents and clear sections
- Add README.zh-CN.md with full Chinese translation
- Add language switch links at top of both files
- Organize: Quick Start, Installation, Format Support, Usage, Settings, Technical Details, Deployment
2026-05-08 22:22:41 +08:00
flash555588
b36da054d5 docs: restructure README, add Chinese translation
- Reorganize README.md with cleaner structure
- Add README.zh-CN.md with full Chinese translation
- Add language switch links between EN/CN versions
- Streamline sections: Features, Usage, Settings, Pipeline, Architecture, Deployment
2026-05-08 22:19:54 +08:00
flash555588
7536bd1486 docs: add deployment environment configuration
- Add development environment setup instructions
- Add build output documentation
- Add Obsidian installation methods (symlink/copy)
- Add environment variables reference
- Add Python/FreeCAD dependencies setup
- Add build configuration details
- Add debugging guide
- Add CI/CD workflow example
2026-05-08 22:09:36 +08:00
flash555588
677dc2d3ff fix: PLY direct buffer loading, add comprehensive format docs
- Add loadPLYBuffer() to bypass SceneLoader for PLY files (same Babylon v9 data-URL fix as STL)
- Update scene.ts to use direct loading for PLY format
- Add Model Import Pipeline section to README with architecture principles
- Add Format Parsing Details (STL/PLY/OBJ/GLB/SPLAT/FBX binary structures)
- Add Complete Format Support Matrix (15 formats)
- Add Format Feature Details comparison table
- Add Known Limitations section
2026-05-08 22:09:36 +08:00
Flash
948601c104
Update README.md 2026-05-08 21:38:08 +08:00
flash555588
46ef05a560 feat: SLDPRT support, portability fixes, comprehensive QA audit, rewrite README
New features:
- Add SLDPRT (SolidWorks) converter via FreeCAD + OpenCASCADE pipeline
- Add IGES/IGS and BREP format support via format-aware Python scripts
- Add 3MF and DAE format support via trimesh/Assimp converter
- Add loading overlay component with progress bar and phase text
- Enable STP files by default in format registry

Portability:
- Remove all hardcoded user paths, use process.env.LOCALAPPDATA for discovery
- Fix .split("/") path separator issues (scene.ts, app.ts, helper-buttons.ts)
- Add macOS Apple Silicon Homebrew paths (/opt/homebrew/bin/)
- Fix escapePyStr + raw string double-escaping (pyPath normalizes to forward slashes)
- Add maxBuffer to all execFileAsync calls (50MB)

Bug fixes:
- Fix OBJ load errors silently swallowed (now re-throw after logging)
- Fix explode position drift on repeated set/reset cycles (store original center)
- Fix explode uses world-space position (switch to local position)
- Fix picking highlight material leak when mesh disposed externally
- Fix grid layerMask collision in compose presets (one cell = one bit)
- Fix renderScale/quality inconsistency (track currentQuality)
- Fix stale loading flag drops model path changes (pendingPath mechanism)
- Fix persist() unhandled rejection on save failure
- Fix Python injection via double-quote in paths (reject quotes in pyPath)
- Fix PLY face indices parsed as floats (Math.round)
- Fix PLY face indices no bounds checking (skip out-of-range)
- Fix ASCII STL produces confusing error (detect and warn)
- Fix WebGL engine leak on live-preview load error
- Fix DirectView race condition on rapid file loads (generation counter)
- Fix MutationObserver not disconnected on code-block load error
- Fix auto-save timer fires after plugin unload (add dispose)
- Fix duplicate conversions on concurrent requests (in-flight dedup)

Other:
- Rewrite README with comprehensive usage, third-party setup, and demo page
- Add docs/demo.md with 11 feature walkthrough sections
- Remove dead code (freecad-stub.ts)
2026-05-08 17:54:59 +08:00
flash555588
f10281553a fix: restore babylonjs-fbx-loader for direct FBX support
Per FORMAT_SUPPORT_DESIGN.md, FBX should have both direct channel
(babylonjs-fbx-loader) and convert channel (FBX2glTF CLI).
Bundle size 7.7MB is within design doc's expected 8.2-10MB range.
2026-05-08 10:47:39 +08:00
flash555588
edda480711 feat: add format conversion pipeline, remove FBX loader, fix build
- Add src/io/ dual-channel architecture (direct + convert)
- Add FreeCAD/obj2gltf/fbx2gltf converter adapters
- Add conversion cache, preview source, format registry
- Add FORMAT_SUPPORT_DESIGN.md design document
- Remove babylonjs-fbx-loader (bundle 7.7MB -> 3.0MB)
- Remove @babylonjs/addons (unused)
- Externalize node: builtins in esbuild config
- Add log utility and settings for converters
2026-05-08 10:38:02 +08:00
flash555588
688b7856fb feat: STL rendering fix, OBJ MTL support, gizmo rewrite, Babylon.js 9.6
- STL: recompute normals from vertices, add emissive+specular material
- OBJ: load MTL from vault, auto-resolve textures (same-dir + OBJ-name fallback)
- Gizmo: larger size (12%), dark background, X/Y/Z labels (DynamicTexture)
- Packages: upgrade all @babylonjs/* to 9.6.0, add gui/materials/serializers
- Settings: add renderScale slider (0.25–2.0)
- Scene: ambientColor + boosted hemispheric light
2026-05-08 01:52:57 +08:00
flash555588
f4818228f3 fix: STL loading (direct parse), live preview widget range and state
- STL: bypass Babylon v9 SceneLoader data URL issue by calling
  parseBinarySTL directly via loadSTLBuffer export
- Live Preview: widget decorations require zero-length range (use .range(from))
- Live Preview: fix findEmbeds to accept EditorState in update callback
  (was passing transaction instead of state, causing .doc undefined error)
- Fixes: RuntimeError loading STL, RangeError widget range, TypeError doc undefined
2026-05-07 23:38:05 +08:00
flash555588
523c6a8d71 fix: add diagnostic logs for STL loading + resolution scale feature
- Added console.log in STL parser (triangle count, buffer size)
- Added console.log in DirectModelView (file path, size, success/failure)
- Wired renderScale through all call sites
- Created 3D Diagnostic Test.md for debugging
2026-05-07 23:30:26 +08:00
flash555588
e53a3b71ed feat: adjustable render resolution scale
- Add renderScale setting (0.25x–2.0x) in PluginSettings
- Settings UI: resolution scale slider with 0.25 step
- Toolbar: quick cycle button (0.5x → 0.75x → 1.0x → 1.5x → 2.0x)
- setRenderScale() on both BabylonModelPreview and GridRenderer
- Integrated with existing renderQuality preset and mobile boost
- Applied in code-block processor and workbench after model load
2026-05-07 22:49:09 +08:00
flash555588
bfcde0f98c fix: code cleanup, mobile rendering, theme compat
- Deduplicate generateNote() in main.ts, reuse app.ts version
- Remove unused formatFileSize() and escapeObsidianMarkup()
- Wire up isMobile() for automatic resolution scaling on mobile
- Replace hardcoded #1e1e22 with CSS variable for theme compat
2026-05-07 22:27:33 +08:00
flash555588
e83df241f9 feat: keyboard shortcuts for 3D preview
- R: reset view
- W: toggle wireframe
- G: toggle orientation gizmo
- B: toggle bounding box
- Space: play/pause animation
- Canvas must have focus (click on it first)
- Works in both 3d and 3dgrid code blocks
2026-05-07 22:03:44 +08:00
flash555588
6949012386 feat: bounding box toggle in preview toolbar
- Yellow wireframe box showing model extents
- Toggle via toolbar button (cube outline icon)
- Added to SnapshotProvider interface
2026-05-07 22:01:27 +08:00
flash555588
4f69b8f4cd feat: orientation axis gizmo in preview corner
- XYZ axis indicator rendered in bottom-left corner of preview
- Separate Babylon scene with its own camera tracking main rotation
- Toggle via toolbar button (compass icon)
- Added to SnapshotProvider interface
2026-05-07 21:58:28 +08:00
flash555588
3622e79c92 feat: implement render quality setting (low/medium/high)
- low: 0.5x resolution, no shadow blur, exponential shadow map
- medium: 0.75x resolution, basic shadow blur
- high: 1.0x resolution, full shadow blur (default)
- Applied in code-block processor and workbench after model load
2026-05-07 21:49:48 +08:00
flash555588
a5b0229204 fix: code review round 4 — robustness and settings wiring
- Serialize generateKnowledgeNote to prevent TOCTOU and duplicates (Fix #33/34)
- Destroy preview on load failure to prevent Engine/Scene leak (Fix #38)
- Clean up stale error messages on model retry
- Pass getSettings to DirectModelView for snapshot save settings
2026-05-07 21:31:36 +08:00
flash555588
59b4e9e2f8 fix: code review round 3 — perf, dedup, correctness
- Replace custom RAF loop with engine.runRenderLoop (Fix #22)
- Unified ensureLoadersRegistered() in shared register.ts (Fix #24-26)
- Extract shared resolveVaultPath to utils/resolve-path.ts (Fix #26)
- Skip escaped \![[ embeds in live preview (Fix #14)
- Fix PLY binary double TextDecoder decode (Fix #37)
2026-05-07 21:15:19 +08:00
flash555588
2b3b5937dc fix: code review round 2 — type safety and robustness
- OBJ monkey-patch concurrency lock to prevent clobbering (Fix #1)
- ShadowGenerator: type guard for light instead of as any (Fix #9)
- instanceof TFile instead of "extension" in file / as any (Fix #10)
- Static Color3 import in grid.ts, remove dynamic import (Fix #13)
- detachControl cameras in destroy() for scene.ts and grid.ts (Fix #35)
- Replace rootMesh! assertions with null guards (Fix #36)
2026-05-07 20:55:54 +08:00
flash555588
279623c22d fix: code review fixes — perf, type safety, code quality
- Replace MutationObserver with rAF polling in live-preview (Fix #3)
- Return typed HelperToolbar from createHelperButtons (Fix #7)
- Extract renderFrame(), remove O(N²) isVisible toggling (Fix #19/#20)
- Fix tooltip stacking with WeakMap dedup (Fix #28)
- Extract shared arrayBufferToBase64 to utils/base64.ts (Fix #23)
- Type AutoRotationBehavior properly (Fix #8)
- Replace as any material casts with instanceof StandardMaterial (Fix #12)
- Apply autoRotate default from settings in code-block processor (Fix #31)
2026-05-07 20:35:41 +08:00
flash555588
e5357ac145 feat: animation playback controls for animated GLB models
- BabylonModelPreview: hasAnimations(), toggleAnimation(), setAnimationSpeed()
- Helper toolbar: play/pause button appears when model has animations,
  toggles between play triangle and pause bars icons
- Workbench sidebar: Play/Pause button in actions when animations detected
- Animation button auto-shows in code-block after model load
2026-05-07 20:35:04 +08:00
flash555588
055a0bda6e feat: wireframe toggle button in helper toolbar
- BabylonModelPreview.toggleWireframe() tracks state and toggles
  all mesh materials
- GridRenderer.toggleWireframe() toggles wireframe across all cells
- Helper toolbar gets a grid icon button with visual active state
  (accent color when wireframe is on)
2026-05-07 20:34:54 +08:00
flash555588
9f42d6dcf7 feat: export model info as Markdown — summary table, mesh breakdown, materials
- BabylonModelPreview.exportModelInfo() generates Markdown with summary
  table, per-mesh breakdown (name/triangles/vertices/material), material list
- GridRenderer.exportModelInfo() generates per-cell summary table
- Helper toolbar: info button copies Markdown to clipboard
- Workbench: "Insert Info" inserts Markdown at cursor in active note
2026-05-07 20:34:45 +08:00
flash555588
04fc972090 feat: add reset view button — restores camera and clears explosion
- BabylonModelPreview.resetView() restores initial camera alpha/beta/
  radius/target and resets explosion
- GridRenderer.resetView() resets all cell cameras to initial state
- Helper toolbar gets a refresh-arrow button (first position)
- Workbench sidebar gets "Reset View" action button when preview is active
2026-05-07 20:34:39 +08:00
Flash
e71763f6f2 feat: animation playback controls 2026-05-07 20:12:10 +08:00
Flash
cf800fbe16 feat: animation playback controls 2026-05-07 20:12:06 +08:00
Flash
92a8f92caf feat: animation playback controls 2026-05-07 20:12:02 +08:00
Flash
fb8384bbd7 feat: animation playback controls 2026-05-07 20:11:58 +08:00
Flash
cb4fc3087a feat: wireframe toggle button 2026-05-07 20:05:12 +08:00
Flash
336de20839 feat: wireframe toggle button 2026-05-07 20:05:08 +08:00
Flash
94920d3e75 feat: wireframe toggle button 2026-05-07 20:05:04 +08:00
Flash
0d4fc77a5e feat: export model info as Markdown 2026-05-07 20:00:26 +08:00
Flash
28f3fad2a3 feat: export model info as Markdown 2026-05-07 20:00:23 +08:00
Flash
98488009b7 feat: export model info as Markdown 2026-05-07 20:00:20 +08:00
Flash
b897f1c588 feat: export model info as Markdown 2026-05-07 20:00:17 +08:00