Project: new layers take their item's label colour (#153)

build::default_label picked a new layer's label from its type alone
(comps Sandstone, images Lavender, ...), ignoring the label of the Project
item it was made from.

A layer made from an item (footage, comp, solid, 3D model) now copies the
item's label when it is created; every path that adds an item to a comp
(layer.addItem from the menus, Project panel, Timeline and viewer drops,
models, precomps, imports) builds its layer there. Layers keep their own
label when the item's changes later. Layers without an item keep the type
defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-07 13:32:40 +07:00
co-authored by Claude Opus 5.5
parent 472521954d
commit 1edf858180
2 changed files with 35 additions and 7 deletions
+6 -6
View File
@@ -715,15 +715,15 @@ pub fn audio(ids: &mut Ids) -> PropGroup {
// ---------------------------------------------------------------- layers
/// Default label colour for a layer source (Labels preferences defaults).
/// Label colour for a new layer: its Project item's label when it has one (later changes to the
/// item's label leave existing layers alone), else the Labels preferences default for its type.
pub fn default_label(src: &LayerSource, project: &Project) -> Label {
if let Some(it) = src.item().and_then(|i| project.item(i)) {
return it.label;
}
match src {
LayerSource::Comp { .. } => Label::Sandstone,
LayerSource::Footage { item } => match project.item(*item).map(|i| i.type_name()) {
Some("Image") | Some("Image Sequence") => Label::Lavender,
Some("Audio") => Label::SeaFoam,
_ => Label::Aqua,
},
LayerSource::Footage { .. } => Label::Aqua,
LayerSource::Solid { .. } => Label::Red,
LayerSource::Text => Label::Red,
LayerSource::Shape => Label::Blue,