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:
co-authored by
Claude Opus 5.5
parent
472521954d
commit
1edf858180
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user