Clean up build warnings
This commit is contained in:
@@ -62,6 +62,7 @@ const SEARCH_BAR_HEIGHT: f32 = 30.0;
|
||||
const CATEGORY_TAB_HEIGHT: f32 = 28.0;
|
||||
const BREADCRUMB_HEIGHT: f32 = 24.0;
|
||||
const ITEM_HEIGHT: f32 = 40.0;
|
||||
#[allow(dead_code)]
|
||||
const ITEM_PADDING: f32 = 4.0;
|
||||
const LIST_THUMBNAIL_SIZE: f32 = 32.0;
|
||||
const GRID_ITEM_SIZE: f32 = 80.0;
|
||||
@@ -137,6 +138,7 @@ impl ThumbnailCache {
|
||||
}
|
||||
|
||||
/// Check if a thumbnail is already cached (and not dirty)
|
||||
#[allow(dead_code)]
|
||||
pub fn has(&self, asset_id: &Uuid) -> bool {
|
||||
self.textures.contains_key(asset_id) && !self.dirty.contains(asset_id)
|
||||
}
|
||||
@@ -146,11 +148,6 @@ impl ThumbnailCache {
|
||||
self.dirty.insert(*asset_id);
|
||||
}
|
||||
|
||||
/// Clear all cached thumbnails
|
||||
pub fn clear(&mut self) {
|
||||
self.textures.clear();
|
||||
self.dirty.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -285,7 +282,7 @@ fn generate_waveform_thumbnail(
|
||||
|
||||
// Draw waveform
|
||||
let center_y = size / 2;
|
||||
let num_peaks = waveform_peaks.len().min(size);
|
||||
let _num_peaks = waveform_peaks.len().min(size);
|
||||
|
||||
for (x, &(min_val, max_val)) in waveform_peaks.iter().take(size).enumerate() {
|
||||
// Scale peaks to pixel range (center ± half height)
|
||||
@@ -552,6 +549,7 @@ fn shape_color_to_tiny_skia(color: &ShapeColor) -> tiny_skia::Color {
|
||||
}
|
||||
|
||||
/// Generate a simple effect thumbnail with a pink gradient
|
||||
#[allow(dead_code)]
|
||||
fn generate_effect_thumbnail() -> Vec<u8> {
|
||||
let size = THUMBNAIL_SIZE as usize;
|
||||
let mut rgba = vec![0u8; size * size * 4];
|
||||
@@ -628,6 +626,7 @@ fn generate_effect_thumbnail() -> Vec<u8> {
|
||||
}
|
||||
|
||||
/// Ellipsize a string to fit within a maximum character count
|
||||
#[allow(dead_code)]
|
||||
fn ellipsize(s: &str, max_chars: usize) -> String {
|
||||
if s.chars().count() <= max_chars {
|
||||
s.to_string()
|
||||
@@ -706,6 +705,7 @@ pub struct AssetEntry {
|
||||
pub struct FolderEntry {
|
||||
pub id: Uuid,
|
||||
pub name: String,
|
||||
#[allow(dead_code)]
|
||||
pub category: AssetCategory,
|
||||
pub item_count: usize,
|
||||
}
|
||||
@@ -718,6 +718,7 @@ pub enum LibraryItem {
|
||||
}
|
||||
|
||||
impl LibraryItem {
|
||||
#[allow(dead_code)]
|
||||
pub fn id(&self) -> Uuid {
|
||||
match self {
|
||||
LibraryItem::Folder(f) => f.id,
|
||||
@@ -810,6 +811,7 @@ pub struct AssetLibraryPane {
|
||||
current_folders: HashMap<u8, Option<Uuid>>,
|
||||
|
||||
/// Set of expanded folder IDs (for tree view - future enhancement)
|
||||
#[allow(dead_code)]
|
||||
expanded_folders: HashSet<Uuid>,
|
||||
|
||||
/// Cached folder icon texture
|
||||
@@ -1283,6 +1285,7 @@ impl AssetLibraryPane {
|
||||
}
|
||||
|
||||
/// Filter assets based on current category and search text
|
||||
#[allow(dead_code)]
|
||||
fn filter_assets<'a>(&self, assets: &'a [AssetEntry]) -> Vec<&'a AssetEntry> {
|
||||
let search_lower = self.search_filter.to_lowercase();
|
||||
|
||||
@@ -1727,6 +1730,7 @@ impl AssetLibraryPane {
|
||||
}
|
||||
|
||||
/// Render a section header for effect categories
|
||||
#[allow(dead_code)] // Part of List/Grid view rendering subsystem, not yet wired
|
||||
fn render_section_header(ui: &mut egui::Ui, label: &str, color: egui::Color32) {
|
||||
ui.add_space(4.0);
|
||||
let (header_rect, _) = ui.allocate_exact_size(
|
||||
@@ -1744,7 +1748,7 @@ impl AssetLibraryPane {
|
||||
}
|
||||
|
||||
/// Render a grid of asset items
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[allow(clippy::too_many_arguments, dead_code)]
|
||||
fn render_grid_items(
|
||||
&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
@@ -1755,7 +1759,7 @@ impl AssetLibraryPane {
|
||||
shared: &mut SharedPaneState,
|
||||
document: &Document,
|
||||
text_color: egui::Color32,
|
||||
secondary_text_color: egui::Color32,
|
||||
_secondary_text_color: egui::Color32,
|
||||
) {
|
||||
if assets.is_empty() {
|
||||
return;
|
||||
@@ -2003,7 +2007,7 @@ impl AssetLibraryPane {
|
||||
&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
rect: egui::Rect,
|
||||
path: &NodePath,
|
||||
_path: &NodePath,
|
||||
shared: &mut SharedPaneState,
|
||||
items: &[&LibraryItem],
|
||||
document: &Document,
|
||||
@@ -2012,7 +2016,7 @@ impl AssetLibraryPane {
|
||||
let folder_icon = self.get_folder_icon(ui.ctx()).cloned();
|
||||
|
||||
let _scroll_area = egui::ScrollArea::vertical()
|
||||
.id_source("asset_library_scroll")
|
||||
.id_salt("asset_library_scroll")
|
||||
.show_viewport(ui, |ui, viewport| {
|
||||
ui.set_min_width(rect.width());
|
||||
|
||||
@@ -2171,7 +2175,7 @@ impl AssetLibraryPane {
|
||||
// Load folder icon if needed
|
||||
let folder_icon = self.get_folder_icon(ui.ctx()).cloned();
|
||||
|
||||
ui.allocate_new_ui(egui::UiBuilder::new().max_rect(rect), |ui| {
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect), |ui| {
|
||||
egui::ScrollArea::vertical()
|
||||
.id_salt(("asset_library_grid_scroll", path))
|
||||
.auto_shrink([false, false])
|
||||
@@ -2661,6 +2665,7 @@ impl AssetLibraryPane {
|
||||
}
|
||||
|
||||
/// Render assets based on current view mode
|
||||
#[allow(dead_code)]
|
||||
fn render_assets(
|
||||
&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
@@ -2681,6 +2686,7 @@ impl AssetLibraryPane {
|
||||
}
|
||||
|
||||
/// Render the asset list view
|
||||
#[allow(dead_code)]
|
||||
fn render_asset_list_view(
|
||||
&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
@@ -2724,7 +2730,7 @@ impl AssetLibraryPane {
|
||||
|
||||
// Use egui's built-in ScrollArea for scrolling
|
||||
let scroll_area_rect = rect;
|
||||
ui.allocate_new_ui(egui::UiBuilder::new().max_rect(scroll_area_rect), |ui| {
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(scroll_area_rect), |ui| {
|
||||
egui::ScrollArea::vertical()
|
||||
.id_salt(("asset_list_scroll", path))
|
||||
.auto_shrink([false, false])
|
||||
@@ -2757,7 +2763,7 @@ impl AssetLibraryPane {
|
||||
};
|
||||
let mut rendered_builtin_header = false;
|
||||
let mut rendered_custom_header = false;
|
||||
let mut builtin_rendered = 0;
|
||||
let mut _builtin_rendered = 0;
|
||||
|
||||
for asset in assets_to_render {
|
||||
// Render section headers for Effects tab
|
||||
@@ -2781,7 +2787,7 @@ impl AssetLibraryPane {
|
||||
rendered_custom_header = true;
|
||||
}
|
||||
if asset.is_builtin {
|
||||
builtin_rendered += 1;
|
||||
_builtin_rendered += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3093,6 +3099,7 @@ impl AssetLibraryPane {
|
||||
}
|
||||
|
||||
/// Render the asset grid view
|
||||
#[allow(dead_code)]
|
||||
fn render_asset_grid_view(
|
||||
&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
@@ -3165,7 +3172,7 @@ impl AssetLibraryPane {
|
||||
0
|
||||
};
|
||||
|
||||
ui.allocate_new_ui(egui::UiBuilder::new().max_rect(rect), |ui| {
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect), |ui| {
|
||||
egui::ScrollArea::vertical()
|
||||
.id_salt(("asset_grid_scroll", path))
|
||||
.auto_shrink([false, false])
|
||||
|
||||
@@ -47,6 +47,7 @@ pub struct DraggingAsset {
|
||||
/// Display name
|
||||
pub name: String,
|
||||
/// Duration in seconds
|
||||
#[allow(dead_code)] // Populated during drag, consumed when drag-and-drop features expand
|
||||
pub duration: f64,
|
||||
/// Dimensions (width, height) for vector/video clips, None for audio
|
||||
pub dimensions: Option<(f64, f64)>,
|
||||
@@ -132,6 +133,7 @@ pub fn find_sampled_audio_track(document: &lightningbeam_core::document::Documen
|
||||
/// Shared state that all panes can access
|
||||
pub struct SharedPaneState<'a> {
|
||||
pub tool_icon_cache: &'a mut crate::ToolIconCache,
|
||||
#[allow(dead_code)] // Used by pane chrome rendering in main.rs
|
||||
pub icon_cache: &'a mut crate::IconCache,
|
||||
pub selected_tool: &'a mut Tool,
|
||||
pub fill_color: &'a mut egui::Color32,
|
||||
@@ -220,7 +222,7 @@ pub trait PaneRenderer {
|
||||
/// Render the optional header section with controls
|
||||
///
|
||||
/// Returns true if a header was rendered, false if no header
|
||||
fn render_header(&mut self, ui: &mut egui::Ui, shared: &mut SharedPaneState) -> bool {
|
||||
fn render_header(&mut self, _ui: &mut egui::Ui, _shared: &mut SharedPaneState) -> bool {
|
||||
false // Default: no header
|
||||
}
|
||||
|
||||
@@ -234,6 +236,7 @@ pub trait PaneRenderer {
|
||||
);
|
||||
|
||||
/// Get the display name of this pane
|
||||
#[allow(dead_code)] // Implemented by all panes, dispatch infrastructure complete
|
||||
fn name(&self) -> &str;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ use uuid::Uuid;
|
||||
pub enum NodeGraphAction {
|
||||
AddNode(AddNodeAction),
|
||||
RemoveNode(RemoveNodeAction),
|
||||
#[allow(dead_code)]
|
||||
MoveNode(MoveNodeAction),
|
||||
Connect(ConnectAction),
|
||||
Disconnect(DisconnectAction),
|
||||
@@ -240,6 +241,7 @@ impl RemoveNodeAction {
|
||||
// MoveNodeAction
|
||||
// ============================================================================
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct MoveNodeAction {
|
||||
layer_id: Uuid,
|
||||
backend_node_id: BackendNodeId,
|
||||
@@ -248,6 +250,7 @@ pub struct MoveNodeAction {
|
||||
}
|
||||
|
||||
impl MoveNodeAction {
|
||||
#[allow(dead_code)]
|
||||
pub fn new(layer_id: Uuid, backend_node_id: BackendNodeId, new_position: (f32, f32)) -> Self {
|
||||
Self {
|
||||
layer_id,
|
||||
|
||||
@@ -17,8 +17,8 @@ pub struct AudioGraphBackend {
|
||||
audio_controller: Arc<Mutex<EngineController>>,
|
||||
|
||||
/// Maps backend NodeIndex to stable IDs for round-trip serialization
|
||||
node_index_to_stable: HashMap<NodeIndex, u32>,
|
||||
next_stable_id: u32,
|
||||
_node_index_to_stable: HashMap<NodeIndex, u32>,
|
||||
_next_stable_id: u32,
|
||||
}
|
||||
|
||||
impl AudioGraphBackend {
|
||||
@@ -26,8 +26,8 @@ impl AudioGraphBackend {
|
||||
Self {
|
||||
track_id,
|
||||
audio_controller,
|
||||
node_index_to_stable: HashMap::new(),
|
||||
next_stable_id: 0,
|
||||
_node_index_to_stable: HashMap::new(),
|
||||
_next_stable_id: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,25 +41,23 @@ impl GraphBackend for AudioGraphBackend {
|
||||
|
||||
// Generate placeholder node ID
|
||||
// This will be replaced with actual backend NodeIndex from sync query
|
||||
let stable_id = self.next_stable_id;
|
||||
self.next_stable_id += 1;
|
||||
let stable_id = self._next_stable_id;
|
||||
self._next_stable_id += 1;
|
||||
|
||||
// Placeholder: use stable_id as backend index (will be wrong, but compiles)
|
||||
let node_idx = NodeIndex::new(stable_id as usize);
|
||||
self.node_index_to_stable.insert(node_idx, stable_id);
|
||||
self._node_index_to_stable.insert(node_idx, stable_id);
|
||||
|
||||
Ok(BackendNodeId::Audio(node_idx))
|
||||
}
|
||||
|
||||
fn remove_node(&mut self, backend_id: BackendNodeId) -> Result<(), String> {
|
||||
let BackendNodeId::Audio(node_idx) = backend_id else {
|
||||
return Err("Invalid backend node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(node_idx) = backend_id;
|
||||
|
||||
let mut controller = self.audio_controller.lock().unwrap();
|
||||
controller.graph_remove_node(self.track_id, node_idx.index() as u32);
|
||||
|
||||
self.node_index_to_stable.remove(&node_idx);
|
||||
self._node_index_to_stable.remove(&node_idx);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -71,12 +69,8 @@ impl GraphBackend for AudioGraphBackend {
|
||||
input_node: BackendNodeId,
|
||||
input_port: usize,
|
||||
) -> Result<(), String> {
|
||||
let BackendNodeId::Audio(from_idx) = output_node else {
|
||||
return Err("Invalid output node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(to_idx) = input_node else {
|
||||
return Err("Invalid input node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(from_idx) = output_node;
|
||||
let BackendNodeId::Audio(to_idx) = input_node;
|
||||
|
||||
let mut controller = self.audio_controller.lock().unwrap();
|
||||
controller.graph_connect(
|
||||
@@ -97,12 +91,8 @@ impl GraphBackend for AudioGraphBackend {
|
||||
input_node: BackendNodeId,
|
||||
input_port: usize,
|
||||
) -> Result<(), String> {
|
||||
let BackendNodeId::Audio(from_idx) = output_node else {
|
||||
return Err("Invalid output node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(to_idx) = input_node else {
|
||||
return Err("Invalid input node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(from_idx) = output_node;
|
||||
let BackendNodeId::Audio(to_idx) = input_node;
|
||||
|
||||
let mut controller = self.audio_controller.lock().unwrap();
|
||||
controller.graph_disconnect(
|
||||
@@ -122,9 +112,7 @@ impl GraphBackend for AudioGraphBackend {
|
||||
param_id: u32,
|
||||
value: f64,
|
||||
) -> Result<(), String> {
|
||||
let BackendNodeId::Audio(node_idx) = backend_id else {
|
||||
return Err("Invalid backend node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(node_idx) = backend_id;
|
||||
|
||||
let mut controller = self.audio_controller.lock().unwrap();
|
||||
controller.graph_set_parameter(
|
||||
@@ -180,9 +168,7 @@ impl GraphBackend for AudioGraphBackend {
|
||||
x: f32,
|
||||
y: f32,
|
||||
) -> Result<BackendNodeId, String> {
|
||||
let BackendNodeId::Audio(allocator_idx) = voice_allocator_id else {
|
||||
return Err("Invalid voice allocator node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(allocator_idx) = voice_allocator_id;
|
||||
|
||||
let mut controller = self.audio_controller.lock().unwrap();
|
||||
controller.graph_add_node_to_template(
|
||||
@@ -194,8 +180,8 @@ impl GraphBackend for AudioGraphBackend {
|
||||
);
|
||||
|
||||
// Placeholder return
|
||||
let stable_id = self.next_stable_id;
|
||||
self.next_stable_id += 1;
|
||||
let stable_id = self._next_stable_id;
|
||||
self._next_stable_id += 1;
|
||||
let node_idx = NodeIndex::new(stable_id as usize);
|
||||
|
||||
Ok(BackendNodeId::Audio(node_idx))
|
||||
@@ -209,15 +195,9 @@ impl GraphBackend for AudioGraphBackend {
|
||||
input_node: BackendNodeId,
|
||||
input_port: usize,
|
||||
) -> Result<(), String> {
|
||||
let BackendNodeId::Audio(allocator_idx) = voice_allocator_id else {
|
||||
return Err("Invalid voice allocator node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(from_idx) = output_node else {
|
||||
return Err("Invalid output node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(to_idx) = input_node else {
|
||||
return Err("Invalid input node type".to_string());
|
||||
};
|
||||
let BackendNodeId::Audio(allocator_idx) = voice_allocator_id;
|
||||
let BackendNodeId::Audio(from_idx) = output_node;
|
||||
let BackendNodeId::Audio(to_idx) = input_node;
|
||||
|
||||
let mut controller = self.audio_controller.lock().unwrap();
|
||||
controller.graph_connect_in_template(
|
||||
|
||||
@@ -18,6 +18,7 @@ pub enum BackendNodeId {
|
||||
/// Implementations:
|
||||
/// - AudioGraphBackend: Wraps daw_backend::AudioGraph via EngineController
|
||||
/// - VfxGraphBackend (future): GPU-based shader graph
|
||||
#[allow(dead_code)]
|
||||
pub trait GraphBackend: Send {
|
||||
/// Add a node to the backend graph
|
||||
fn add_node(&mut self, node_type: &str, x: f32, y: f32) -> Result<BackendNodeId, String>;
|
||||
|
||||
@@ -67,6 +67,7 @@ impl NodeGraphPane {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn with_track_id(
|
||||
track_id: Uuid,
|
||||
audio_controller: std::sync::Arc<std::sync::Mutex<daw_backend::EngineController>>,
|
||||
@@ -207,7 +208,7 @@ impl NodeGraphPane {
|
||||
// Set parameter values
|
||||
for (¶m_id, &value) in &node.parameters {
|
||||
// Find the input param in the graph and set its value
|
||||
if let Some(node_data) = self.state.graph.nodes.get_mut(frontend_id) {
|
||||
if let Some(_node_data) = self.state.graph.nodes.get_mut(frontend_id) {
|
||||
// TODO: Set parameter values on the node's input params
|
||||
// This requires matching param_id to the input param by index
|
||||
let _ = (param_id, value); // Silence unused warning for now
|
||||
@@ -428,25 +429,25 @@ impl NodeGraphPane {
|
||||
|
||||
fn check_parameter_changes(&mut self) {
|
||||
// Check all input parameters for value changes
|
||||
let mut checked_count = 0;
|
||||
let mut connection_only_count = 0;
|
||||
let mut non_float_count = 0;
|
||||
let mut _checked_count = 0;
|
||||
let mut _connection_only_count = 0;
|
||||
let mut _non_float_count = 0;
|
||||
|
||||
for (input_id, input_param) in &self.state.graph.inputs {
|
||||
// Only check parameters that can have constant values (not ConnectionOnly)
|
||||
if matches!(input_param.kind, InputParamKind::ConnectionOnly) {
|
||||
connection_only_count += 1;
|
||||
_connection_only_count += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get current value
|
||||
let current_value = match &input_param.value {
|
||||
ValueType::Float { value } => {
|
||||
checked_count += 1;
|
||||
_checked_count += 1;
|
||||
*value
|
||||
},
|
||||
other => {
|
||||
non_float_count += 1;
|
||||
_non_float_count += 1;
|
||||
eprintln!("[DEBUG] Non-float parameter type: {:?}", std::mem::discriminant(other));
|
||||
continue;
|
||||
}
|
||||
@@ -572,7 +573,7 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
|
||||
// Check if track is MIDI or Audio
|
||||
if let Some(audio_controller) = &shared.audio_controller {
|
||||
let is_valid_track = {
|
||||
let controller = audio_controller.lock().unwrap();
|
||||
let _controller = audio_controller.lock().unwrap();
|
||||
// TODO: Query track type from backend
|
||||
// For now, assume it's valid if we have a track ID mapping
|
||||
true
|
||||
@@ -624,7 +625,7 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
|
||||
let grid_color = grid_style.background_color.unwrap_or(egui::Color32::from_gray(55));
|
||||
|
||||
// Allocate the rect and render the graph editor within it
|
||||
ui.allocate_ui_at_rect(rect, |ui| {
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect), |ui| {
|
||||
// Check for scroll input to override library's default zoom behavior
|
||||
// Only handle scroll when mouse is over the node graph area
|
||||
let pointer_over_graph = ui.rect_contains_pointer(rect);
|
||||
@@ -705,8 +706,8 @@ impl crate::panes::PaneRenderer for NodeGraphPane {
|
||||
|
||||
// Draw menu button in top-left corner
|
||||
let button_pos = rect.min + egui::vec2(8.0, 8.0);
|
||||
ui.allocate_ui_at_rect(
|
||||
egui::Rect::from_min_size(button_pos, egui::vec2(100.0, 24.0)),
|
||||
ui.scope_builder(
|
||||
egui::UiBuilder::new().max_rect(egui::Rect::from_min_size(button_pos, egui::vec2(100.0, 24.0))),
|
||||
|ui| {
|
||||
if ui.button("➕ Add Node").clicked() {
|
||||
// Open node finder at button's top-left position
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(dead_code)]
|
||||
//! Node Type Registry
|
||||
//!
|
||||
//! Defines metadata for all available node types
|
||||
|
||||
@@ -38,7 +38,7 @@ impl NodePalette {
|
||||
.rect_filled(rect, 0.0, egui::Color32::from_rgb(30, 30, 30));
|
||||
|
||||
// Create UI within the palette rect
|
||||
ui.allocate_ui_at_rect(rect, |ui| {
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect), |ui| {
|
||||
ui.vertical(|ui| {
|
||||
ui.add_space(8.0);
|
||||
|
||||
|
||||
@@ -219,6 +219,7 @@ pub struct ShaderEditorPane {
|
||||
/// The shader source code being edited
|
||||
shader_code: String,
|
||||
/// Whether to show the template selector
|
||||
#[allow(dead_code)]
|
||||
show_templates: bool,
|
||||
/// Error message from last compilation attempt (if any)
|
||||
compile_error: Option<String>,
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
use eframe::egui;
|
||||
use lightningbeam_core::action::Action;
|
||||
use lightningbeam_core::clip::ClipInstance;
|
||||
use lightningbeam_core::gpu::{BufferPool, BufferFormat, BufferSpec, Compositor, EffectProcessor, HDR_FORMAT, SrgbToLinearConverter};
|
||||
use lightningbeam_core::layer::{AnyLayer, AudioLayer, AudioLayerType, VideoLayer, VectorLayer};
|
||||
use lightningbeam_core::gpu::{BufferPool, BufferFormat, BufferSpec, Compositor, EffectProcessor, SrgbToLinearConverter};
|
||||
use lightningbeam_core::layer::{AnyLayer, AudioLayer};
|
||||
use lightningbeam_core::renderer::RenderedLayerType;
|
||||
use super::{DragClipType, NodePath, PaneRenderer, SharedPaneState};
|
||||
use std::sync::{Arc, Mutex, OnceLock};
|
||||
@@ -872,7 +872,7 @@ impl egui_wgpu::CallbackTrait for VelloCallback {
|
||||
}
|
||||
|
||||
// Also draw selection outlines for clip instances
|
||||
let clip_instance_count = self.selection.clip_instances().len();
|
||||
let _clip_instance_count = self.selection.clip_instances().len();
|
||||
for &clip_id in self.selection.clip_instances() {
|
||||
if let Some(clip_instance) = vector_layer.clip_instances.iter().find(|ci| ci.id == clip_id) {
|
||||
// Calculate clip-local time
|
||||
@@ -1865,7 +1865,7 @@ impl egui_wgpu::CallbackTrait for VelloCallback {
|
||||
// Clamp to texture bounds
|
||||
if tex_x < width && tex_y < height {
|
||||
// Create a staging buffer to read back the pixel
|
||||
let bytes_per_pixel = 4; // RGBA8
|
||||
let _bytes_per_pixel = 4; // RGBA8
|
||||
// Align bytes_per_row to 256 (wgpu::COPY_BYTES_PER_ROW_ALIGNMENT)
|
||||
let bytes_per_row_alignment = 256u32;
|
||||
let bytes_per_row = bytes_per_row_alignment; // Single pixel, use minimum alignment
|
||||
@@ -2128,7 +2128,6 @@ impl StagePane {
|
||||
use lightningbeam_core::tool::ToolState;
|
||||
use lightningbeam_core::layer::AnyLayer;
|
||||
use lightningbeam_core::hit_test::{self, hit_test_vector_editing, EditingHitTolerance, VectorEditHit};
|
||||
use lightningbeam_core::bezpath_editing::{extract_editable_curves, mold_curve};
|
||||
use vello::kurbo::{Point, Rect as KurboRect, Affine};
|
||||
|
||||
// Check if we have an active vector layer
|
||||
@@ -2618,9 +2617,8 @@ impl StagePane {
|
||||
mouse_pos: vello::kurbo::Point,
|
||||
shared: &mut SharedPaneState,
|
||||
) {
|
||||
use lightningbeam_core::bezpath_editing::{mold_curve, rebuild_bezpath};
|
||||
use lightningbeam_core::bezpath_editing::mold_curve;
|
||||
use lightningbeam_core::tool::ToolState;
|
||||
use vello::kurbo::Point;
|
||||
|
||||
// Clone tool state to get owned values
|
||||
let tool_state = shared.tool_state.clone();
|
||||
@@ -2799,12 +2797,12 @@ impl StagePane {
|
||||
ui: &mut egui::Ui,
|
||||
response: &egui::Response,
|
||||
world_pos: egui::Vec2,
|
||||
shift_held: bool,
|
||||
_shift_held: bool,
|
||||
shared: &mut SharedPaneState,
|
||||
) {
|
||||
use lightningbeam_core::tool::ToolState;
|
||||
use lightningbeam_core::layer::AnyLayer;
|
||||
use lightningbeam_core::hit_test::{self, hit_test_vector_editing, EditingHitTolerance, VectorEditHit};
|
||||
use lightningbeam_core::hit_test::{hit_test_vector_editing, EditingHitTolerance, VectorEditHit};
|
||||
use vello::kurbo::{Point, Affine};
|
||||
|
||||
// Check if we have an active vector layer
|
||||
@@ -2897,7 +2895,7 @@ impl StagePane {
|
||||
shape_instance_id: uuid::Uuid,
|
||||
curve_index: usize,
|
||||
point_index: u8,
|
||||
mouse_pos: vello::kurbo::Point,
|
||||
_mouse_pos: vello::kurbo::Point,
|
||||
active_layer_id: uuid::Uuid,
|
||||
shared: &mut SharedPaneState,
|
||||
) {
|
||||
@@ -3606,7 +3604,7 @@ impl StagePane {
|
||||
|
||||
// Mouse drag: add points to path
|
||||
if response.dragged() {
|
||||
if let ToolState::DrawingPath { points, simplify_mode } = &mut *shared.tool_state {
|
||||
if let ToolState::DrawingPath { points, simplify_mode: _ } = &mut *shared.tool_state {
|
||||
// Only add point if it's far enough from the last point (reduce noise)
|
||||
const MIN_POINT_DISTANCE: f64 = 2.0;
|
||||
|
||||
@@ -3760,63 +3758,12 @@ impl StagePane {
|
||||
}
|
||||
}
|
||||
|
||||
/// Decompose an affine matrix into transform components
|
||||
/// Returns (translation_x, translation_y, rotation_deg, scale_x, scale_y, skew_x_deg, skew_y_deg)
|
||||
fn decompose_affine(affine: kurbo::Affine) -> (f64, f64, f64, f64, f64, f64, f64) {
|
||||
let coeffs = affine.as_coeffs();
|
||||
let a = coeffs[0];
|
||||
let b = coeffs[1];
|
||||
let c = coeffs[2];
|
||||
let d = coeffs[3];
|
||||
let e = coeffs[4]; // translation_x
|
||||
let f = coeffs[5]; // translation_y
|
||||
|
||||
// Extract translation
|
||||
let tx = e;
|
||||
let ty = f;
|
||||
|
||||
// Decompose linear part [[a, c], [b, d]] into rotate * scale * skew
|
||||
// Using QR-like decomposition
|
||||
|
||||
// Extract rotation
|
||||
let rotation_rad = b.atan2(a);
|
||||
let cos_r = rotation_rad.cos();
|
||||
let sin_r = rotation_rad.sin();
|
||||
|
||||
// Remove rotation to get scale * skew
|
||||
// R^(-1) * M where M = [[a, c], [b, d]]
|
||||
let m11 = a * cos_r + b * sin_r;
|
||||
let m12 = c * cos_r + d * sin_r;
|
||||
let m21 = -a * sin_r + b * cos_r;
|
||||
let m22 = -c * sin_r + d * cos_r;
|
||||
|
||||
// Now [[m11, m12], [m21, m22]] = scale * skew
|
||||
// scale * skew = [[sx, 0], [0, sy]] * [[1, tan(skew_y)], [tan(skew_x), 1]]
|
||||
// = [[sx, sx*tan(skew_y)], [sy*tan(skew_x), sy]]
|
||||
|
||||
let scale_x = m11;
|
||||
let scale_y = m22;
|
||||
|
||||
let skew_x_rad = if scale_y.abs() > 0.001 { (m21 / scale_y).atan() } else { 0.0 };
|
||||
let skew_y_rad = if scale_x.abs() > 0.001 { (m12 / scale_x).atan() } else { 0.0 };
|
||||
|
||||
(
|
||||
tx,
|
||||
ty,
|
||||
rotation_rad.to_degrees(),
|
||||
scale_x,
|
||||
scale_y,
|
||||
skew_x_rad.to_degrees(),
|
||||
skew_y_rad.to_degrees(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Apply transform preview to objects based on current mouse position
|
||||
fn apply_transform_preview(
|
||||
vector_layer: &mut lightningbeam_core::layer::VectorLayer,
|
||||
mode: &lightningbeam_core::tool::TransformMode,
|
||||
original_transforms: &std::collections::HashMap<uuid::Uuid, lightningbeam_core::object::Transform>,
|
||||
pivot: vello::kurbo::Point,
|
||||
_pivot: vello::kurbo::Point,
|
||||
start_mouse: vello::kurbo::Point,
|
||||
current_mouse: vello::kurbo::Point,
|
||||
original_bbox: vello::kurbo::Rect,
|
||||
@@ -4784,7 +4731,6 @@ impl StagePane {
|
||||
_ => egui::CursorIcon::Default,
|
||||
};
|
||||
ui.ctx().set_cursor_icon(cursor);
|
||||
hovering_handle = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5219,7 +5165,6 @@ impl StagePane {
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
} else if let AnyLayer::Video(video_layer) = layer {
|
||||
|
||||
@@ -125,6 +125,7 @@ impl TimelinePane {
|
||||
|
||||
/// Execute a view action with the given parameters
|
||||
/// Called from main.rs after determining this is the best handler
|
||||
#[allow(dead_code)] // Mirrors StagePane; wiring in main.rs pending (see TODO at view action dispatch)
|
||||
pub fn execute_view_action(&mut self, action: &crate::menu::MenuAction, zoom_center: egui::Vec2) {
|
||||
use crate::menu::MenuAction;
|
||||
match action {
|
||||
@@ -781,7 +782,7 @@ impl TimelinePane {
|
||||
|
||||
// Mute button
|
||||
// TODO: Replace with SVG icon (volume-up-fill.svg / volume-mute.svg)
|
||||
let mute_response = ui.allocate_new_ui(egui::UiBuilder::new().max_rect(mute_button_rect), |ui| {
|
||||
let mute_response = ui.scope_builder(egui::UiBuilder::new().max_rect(mute_button_rect), |ui| {
|
||||
let mute_text = if is_muted { "🔇" } else { "🔊" };
|
||||
let button = egui::Button::new(mute_text)
|
||||
.fill(if is_muted {
|
||||
@@ -805,7 +806,7 @@ impl TimelinePane {
|
||||
|
||||
// Solo button
|
||||
// TODO: Replace with SVG headphones icon
|
||||
let solo_response = ui.allocate_new_ui(egui::UiBuilder::new().max_rect(solo_button_rect), |ui| {
|
||||
let solo_response = ui.scope_builder(egui::UiBuilder::new().max_rect(solo_button_rect), |ui| {
|
||||
let button = egui::Button::new("🎧")
|
||||
.fill(if is_soloed {
|
||||
egui::Color32::from_rgba_unmultiplied(100, 200, 100, 100)
|
||||
@@ -828,7 +829,7 @@ impl TimelinePane {
|
||||
|
||||
// Lock button
|
||||
// TODO: Replace with SVG lock/lock-open icons
|
||||
let lock_response = ui.allocate_new_ui(egui::UiBuilder::new().max_rect(lock_button_rect), |ui| {
|
||||
let lock_response = ui.scope_builder(egui::UiBuilder::new().max_rect(lock_button_rect), |ui| {
|
||||
let lock_text = if is_locked { "🔒" } else { "🔓" };
|
||||
let button = egui::Button::new(lock_text)
|
||||
.fill(if is_locked {
|
||||
@@ -851,7 +852,7 @@ impl TimelinePane {
|
||||
}
|
||||
|
||||
// Volume slider (nonlinear: 0-70% slider = 0-100% volume, 70-100% slider = 100-200% volume)
|
||||
let volume_response = ui.allocate_new_ui(egui::UiBuilder::new().max_rect(volume_slider_rect), |ui| {
|
||||
let volume_response = ui.scope_builder(egui::UiBuilder::new().max_rect(volume_slider_rect), |ui| {
|
||||
// Map volume (0.0-2.0) to slider position (0.0-1.0)
|
||||
let slider_value = if current_volume <= 1.0 {
|
||||
// 0.0-1.0 volume maps to 0.0-0.7 slider (70%)
|
||||
@@ -1217,7 +1218,7 @@ impl TimelinePane {
|
||||
if let Some((samples, sr, ch)) = raw_audio_cache.get(audio_pool_index) {
|
||||
let total_frames = samples.len() / (*ch).max(1) as usize;
|
||||
let audio_file_duration = total_frames as f64 / *sr as f64;
|
||||
let screen_size = ui.ctx().screen_rect().size();
|
||||
let screen_size = ui.ctx().content_rect().size();
|
||||
|
||||
let pending_upload = if waveform_gpu_dirty.contains(audio_pool_index) {
|
||||
waveform_gpu_dirty.remove(audio_pool_index);
|
||||
@@ -1347,7 +1348,7 @@ impl TimelinePane {
|
||||
fn handle_input(
|
||||
&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
full_timeline_rect: egui::Rect,
|
||||
_full_timeline_rect: egui::Rect,
|
||||
ruler_rect: egui::Rect,
|
||||
content_rect: egui::Rect,
|
||||
header_rect: egui::Rect,
|
||||
@@ -1357,7 +1358,7 @@ impl TimelinePane {
|
||||
selection: &mut lightningbeam_core::selection::Selection,
|
||||
pending_actions: &mut Vec<Box<dyn lightningbeam_core::action::Action>>,
|
||||
playback_time: &mut f64,
|
||||
is_playing: &mut bool,
|
||||
_is_playing: &mut bool,
|
||||
audio_controller: Option<&std::sync::Arc<std::sync::Mutex<daw_backend::EngineController>>>,
|
||||
) {
|
||||
// Don't allocate the header area for input - let widgets handle it directly
|
||||
@@ -2296,7 +2297,7 @@ impl PaneRenderer for TimelinePane {
|
||||
*shared.dragging_asset = None;
|
||||
} else {
|
||||
// Get document dimensions for centering and create clip instance
|
||||
let (center_x, center_y, mut clip_instance) = {
|
||||
let (_center_x, _center_y, clip_instance) = {
|
||||
let doc = shared.action_executor.document();
|
||||
let center_x = doc.width / 2.0;
|
||||
let center_y = doc.height / 2.0;
|
||||
|
||||
@@ -215,7 +215,7 @@ impl VirtualPianoPane {
|
||||
|
||||
// Handle interaction (skip if a black key is being interacted with)
|
||||
let key_id = ui.id().with(("white_key", note));
|
||||
let response = ui.interact(key_rect, key_id, egui::Sense::click_and_drag());
|
||||
let _response = ui.interact(key_rect, key_id, egui::Sense::click_and_drag());
|
||||
|
||||
// Visual feedback for pressed keys (check both pressed_notes and current pointer state)
|
||||
let pointer_over_key = ui.input(|i| {
|
||||
@@ -298,7 +298,7 @@ impl VirtualPianoPane {
|
||||
|
||||
// Handle interaction (same as white keys)
|
||||
let key_id = ui.id().with(("black_key", note));
|
||||
let response = ui.interact(key_rect, key_id, egui::Sense::click_and_drag());
|
||||
let _response = ui.interact(key_rect, key_id, egui::Sense::click_and_drag());
|
||||
|
||||
// Visual feedback for pressed keys (check both pressed_notes and current pointer state)
|
||||
let pointer_over_key = ui.input(|i| {
|
||||
|
||||
Reference in New Issue
Block a user