Correctly reload mix params on project opening

parent d8f08ed3
......@@ -54,8 +54,8 @@ AssetPanel::AssetPanel(QWidget *parent)
, m_lay(new QVBoxLayout(this))
, m_assetTitle(new KSqueezedTextLabel(this))
, m_container(new QWidget(this))
, m_mixWidget(new MixStackView(this))
, m_transitionWidget(new TransitionStackView(this))
, m_mixWidget(new MixStackView(this))
, m_effectStackWidget(new EffectStackView(this))
{
auto *buttonToolbar = new QToolBar(this);
......@@ -181,7 +181,7 @@ void AssetPanel::showMix(int cid, const std::shared_ptr<AssetParameterModel> &tr
return;
}
clear();
m_switchAction->setVisible(true);
m_switchAction->setVisible(false);
m_titleAction->setVisible(false);
m_assetTitle->clear();
m_mixWidget->setVisible(true);
......
......@@ -2153,7 +2153,22 @@ bool TrackModel::loadMix(Mlt::Transition *t)
const QString assetId(t->get("mlt_service"));
std::unique_ptr<Mlt::Transition>tr(t);
QDomElement xml = TransitionsRepository::get()->getXml(assetId);
qDebug()<<"=====\n\nLOADING MIX: "<<assetId<<", XML: \n\n"<<xml.ownerDocument().toString()<<"\n\n==================";
// Paste parameters from existing mix
//std::unique_ptr<Mlt::Properties> sourceProperties(t);
QStringList sourceProps;
for (int i = 0; i < tr->count(); i++) {
sourceProps << tr->get_name(i);
}
QDomNodeList params = xml.elementsByTagName(QStringLiteral("parameter"));
for (int i = 0; i < params.count(); ++i) {
QDomElement currentParameter = params.item(i).toElement();
QString paramName = currentParameter.attribute(QStringLiteral("name"));
if (!sourceProps.contains(paramName)) {
continue;
}
QString paramValue = tr->get(paramName.toUtf8().constData());
currentParameter.setAttribute(QStringLiteral("value"), paramValue);
}
std::shared_ptr<AssetParameterModel> asset(new AssetParameterModel(std::move(tr), xml, assetId, {ObjectType::TimelineMix, cid2}, QString()));
m_sameCompositions[cid2] = asset;
m_mixList.insert(cid1, cid2);
......
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