M7.2: 3D viewer — 3D views, camera tools, camera/light wireframes, Camera/Light Settings dialogs
- Viewer renders through the comp's 3D view (RenderOpts.view; FrameKey hashes the view camera), shows the view name, and the bottom-bar 3D View dropdown (automation id viewer.view3d) switches Active Camera/Front/…/Custom View 3. - Orbit / Pan / Dolly tools drag the current view (camera layer in Active Camera, merged into one undo step; view cameras otherwise). - Handles, gizmo and picking go through the view camera; 3D layers move in the view plane at their depth. - Camera frustum + POI and light position/direction wireframes (viewer.camera.<id>, viewer.light.<id>). - Camera Settings / Light Settings dialogs open from New Camera/Light, Camera/Light Settings and Layer Settings; OK runs the engine commands. - Timeline: POI only for two-node cameras/auto-oriented lights; "Z Rotation" label on 3D layers. - Headless egui_kittest tests (UI wiring + opt-in wgpu snapshots); fix the remaining workspace clippy lints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
76ac3f74f7
commit
16a5fa7a83
@@ -41,6 +41,8 @@ pub enum Dialog {
|
||||
CompSettings,
|
||||
SolidSettings,
|
||||
CommandPalette,
|
||||
CameraSettings,
|
||||
LightSettings,
|
||||
}
|
||||
|
||||
/// Host hooks provided by the native app (file pickers etc.).
|
||||
@@ -175,7 +177,22 @@ impl EffectcraftApp {
|
||||
}
|
||||
|
||||
pub fn frame_key(&self, comp: ItemId, frame: i64, scale: f64) -> FrameKey {
|
||||
FrameKey { revision: self.session.revision, comp: comp.0, frame, scale: (scale * 1000.0).round() as u32 }
|
||||
FrameKey { revision: self.session.revision, comp: comp.0, frame, scale: (scale * 1000.0).round() as u32, view: self.view_hash(comp) }
|
||||
}
|
||||
|
||||
/// Hash of the comp viewer's 3D view camera (0 for the active camera view).
|
||||
pub fn view_hash(&self, comp: ItemId) -> u64 {
|
||||
use std::hash::{Hash, Hasher};
|
||||
let Some(cam) = self.session.view_camera(comp) else { return 0 };
|
||||
let mut h = std::collections::hash_map::DefaultHasher::new();
|
||||
for row in cam.view.0 {
|
||||
for v in row {
|
||||
v.to_bits().hash(&mut h);
|
||||
}
|
||||
}
|
||||
cam.zoom.to_bits().hash(&mut h);
|
||||
cam.ortho.hash(&mut h);
|
||||
h.finish() | 1
|
||||
}
|
||||
|
||||
/// Request a frame render (no-op if cached/in flight).
|
||||
@@ -183,7 +200,7 @@ impl EffectcraftApp {
|
||||
let Some(c) = self.session.project.comp(comp) else { return };
|
||||
let key = self.frame_key(comp, frame, scale);
|
||||
let t = c.frame_rate.tick_of(frame);
|
||||
let opts = RenderOpts { scale, motion_blur: true, guides: true, draft: self.ui.viewer.fast_preview, view: None };
|
||||
let opts = RenderOpts { scale, motion_blur: true, guides: true, draft: self.ui.viewer.fast_preview, view: self.session.view_camera(comp) };
|
||||
self.frames.request(&self.render_source(), key, comp, t, opts);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user