Update color of color clips in timeline when it is changed by user

parent 4c12556e
......@@ -428,6 +428,7 @@ void ProjectClip::createVideoMasterProducer()
m_effectStack->addService(m_videoProducer);
}
}
void ProjectClip::createDisabledMasterProducer()
{
if (!m_disabledProducer) {
......@@ -763,6 +764,7 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
QStringList keys;
keys << QStringLiteral("luma_duration") << QStringLiteral("luma_file") << QStringLiteral("fade") << QStringLiteral("ttl") << QStringLiteral("softness")
<< QStringLiteral("crop") << QStringLiteral("animation");
QVector<int> updateRoles;
while (i.hasNext()) {
i.next();
setProducerProperty(i.key(), i.value());
......@@ -796,6 +798,7 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
reloadProducer();
} else {
reload = true;
updateRoles << TimelineModel::ResourceRole;
}
}
if (properties.contains(QStringLiteral("xmldata")) || !passProperties.isEmpty()) {
......@@ -830,7 +833,12 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
if (reload) {
// producer has changed, refresh monitor and thumbnail
reloadProducer(refreshOnly);
if (auto ptr = m_model.lock()) emit std::static_pointer_cast<ProjectItemModel>(ptr)->refreshClip(m_binId);
if (auto ptr = m_model.lock()) {
emit std::static_pointer_cast<ProjectItemModel>(ptr)->refreshClip(m_binId);
}
if (!updateRoles.isEmpty()) {
updateTimelineClips(updateRoles);
}
}
if (!passProperties.isEmpty()) {
if (auto ptr = m_model.lock()) emit std::static_pointer_cast<ProjectItemModel>(ptr)->updateTimelineProducers(m_binId, passProperties);
......
......@@ -87,6 +87,12 @@ Rectangle {
ColorAnimation { from: "#ff3300"; to: Qt.darker(getColor()); duration: 100 }
}
onClipResourceChanged: {
if (mltService === 'color') {
color: Qt.darker(getColor())
}
}
onGroupDragChanged: {
// Clip belonging to current timeline selection changed, update list
if (clipRoot.groupDrag) {
......@@ -161,17 +167,13 @@ Rectangle {
function getColor() {
if (mltService === 'color') {
//console.log('clip color', clipResource, " / ", '#' + clipResource.substring(3, 9))
if (clipResource.length == 10) {
// 0xRRGGBBAA
return '#' + clipResource.substring(2, 8)
} else if (clipResource.length == 9) {
// 0xAARRGGBB
return '#' + clipResource.substring(3, 9)
var color = clipResource.substring(clipResource.length - 9)
if (color[0] == '#') {
return color
}
return '#' + color.substring(color.length - 8, color.length - 2)
}
return isAudio? '#445f5a' : '#416e8c'
//root.shotcutBlue
}
function reparent(track) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment