Add nested audio tracks
This commit is contained in:
@@ -1310,8 +1310,8 @@ impl AssetLibraryPane {
|
||||
|
||||
/// Check if an asset is currently in use (has clip instances on layers)
|
||||
fn is_asset_in_use(document: &Document, asset_id: Uuid, category: AssetCategory) -> bool {
|
||||
// Check all layers for clip instances referencing this asset
|
||||
for layer in &document.root.children {
|
||||
// Check all layers (root + inside movie clips) for clip instances referencing this asset
|
||||
for layer in document.all_layers() {
|
||||
match layer {
|
||||
lightningbeam_core::layer::AnyLayer::Vector(vl) => {
|
||||
if category == AssetCategory::Vector {
|
||||
|
||||
@@ -636,10 +636,12 @@ impl NodeGraphPane {
|
||||
let mut controller = audio_controller.lock().unwrap();
|
||||
// Node graph actions don't use clip instances, so we use an empty map
|
||||
let mut empty_clip_map = std::collections::HashMap::new();
|
||||
let empty_metatrack_map = std::collections::HashMap::new();
|
||||
let mut backend_context = lightningbeam_core::action::BackendContext {
|
||||
audio_controller: Some(&mut *controller),
|
||||
layer_to_track_map: shared.layer_to_track_map,
|
||||
clip_instance_to_backend_map: &mut empty_clip_map,
|
||||
clip_to_metatrack_map: &empty_metatrack_map,
|
||||
};
|
||||
|
||||
if let Err(e) = shared.action_executor.execute_with_backend(action, &mut backend_context) {
|
||||
|
||||
@@ -110,8 +110,8 @@ fn effective_clip_duration(
|
||||
let end = vl.group_visibility_end(&clip_instance.id, clip_instance.timeline_start, frame_duration);
|
||||
Some((end - clip_instance.timeline_start).max(0.0))
|
||||
} else {
|
||||
// Movie clips: duration based on internal keyframe content
|
||||
Some(vc.content_duration(document.framerate))
|
||||
// Movie clips: duration based on all internal content (keyframes + clip instances)
|
||||
document.get_clip_duration(&clip_instance.clip_id)
|
||||
}
|
||||
}
|
||||
AnyLayer::Audio(_) => document.get_audio_clip(&clip_instance.clip_id).map(|c| c.duration),
|
||||
@@ -315,9 +315,7 @@ impl TimelinePane {
|
||||
let clip_instance = ClipInstance::new(doc_clip_id)
|
||||
.with_timeline_start(start_time);
|
||||
|
||||
if let Some(layer) = shared.action_executor.document_mut().root.children.iter_mut()
|
||||
.find(|l| l.id() == active_layer_id)
|
||||
{
|
||||
if let Some(layer) = shared.action_executor.document_mut().get_layer_mut(&active_layer_id) {
|
||||
if let lightningbeam_core::layer::AnyLayer::Audio(audio_layer) = layer {
|
||||
audio_layer.clip_instances.push(clip_instance);
|
||||
}
|
||||
@@ -3313,8 +3311,15 @@ impl PaneRenderer for TimelinePane {
|
||||
let new_layer = super::create_layer_for_clip_type(dragging.clip_type, &layer_name);
|
||||
let new_layer_id = new_layer.id();
|
||||
|
||||
// Add the layer
|
||||
shared.action_executor.document_mut().root.add_child(new_layer);
|
||||
// Add the layer to the current editing context
|
||||
if let Some(clip_id) = shared.editing_clip_id {
|
||||
if let Some(clip) = shared.action_executor.document_mut().vector_clips.get_mut(&clip_id) {
|
||||
clip.layers.add_root(new_layer);
|
||||
}
|
||||
shared.action_executor.document_mut().layer_to_clip_map.insert(new_layer_id, clip_id);
|
||||
} else {
|
||||
shared.action_executor.document_mut().root.add_child(new_layer);
|
||||
}
|
||||
|
||||
// Now add the clip to the new layer
|
||||
if dragging.clip_type == DragClipType::Effect {
|
||||
|
||||
Reference in New Issue
Block a user