| 1446 | } |
| 1447 | |
| 1448 | bool EffectStackModel::importEffects(const std::shared_ptr<EffectStackModel> &sourceStack, PlaylistState::ClipState state) |
| 1449 | { |
| 1450 | QWriteLocker locker(&m_lock); |
| 1451 | // TODO: manage fades, keyframes if clips don't have same size / in point |
| 1452 | bool found = false; |
| 1453 | bool effectEnabled = rootItem->childCount() > 0; |
| 1454 | int imported = 0; |
| 1455 | int builtIn = 0; |
| 1456 | for (int i = 0; i < sourceStack->rowCount(); i++) { |
| 1457 | auto item = sourceStack->getEffectStackRow(i); |
| 1458 | // No undo. this should only be used on project opening |
| 1459 | if (copyEffect(item, state, false)) { |
| 1460 | found = true; |
| 1461 | if (item->isAssetEnabled()) { |
| 1462 | effectEnabled = true; |
| 1463 | } else { |
| 1464 | std::shared_ptr<EffectItemModel> sourceEffect = std::static_pointer_cast<EffectItemModel>(item); |
| 1465 | if (sourceEffect->isBuiltIn()) { |
| 1466 | builtIn++; |
| 1467 | } |
| 1468 | } |
| 1469 | imported++; |
| 1470 | } |
| 1471 | } |
| 1472 | if (!effectEnabled && imported == builtIn) { |
| 1473 | effectEnabled = true; |
| 1474 | } |
| 1475 | m_effectStackEnabled = effectEnabled; |
| 1476 | if (!m_effectStackEnabled) { |
| 1477 | // Mark all effects as disabled by stack |
| 1478 | for (int i = 0; i < rootItem->childCount(); ++i) { |
| 1479 | std::shared_ptr<EffectItemModel> sourceEffect = std::static_pointer_cast<EffectItemModel>(rootItem->child(i)); |
| 1480 | sourceEffect->setEffectStackEnabled(false); |
| 1481 | sourceEffect->setAssetEnabled(true); |
| 1482 | } |
| 1483 | } |
| 1484 | if (found) { |
| 1485 | Q_EMIT modelChanged(); |
| 1486 | } |
| 1487 | return found; |
| 1488 | } |
| 1489 | |
| 1490 | void EffectStackModel::importEffects(const std::weak_ptr<Mlt::Service> &service, PlaylistState::ClipState state, bool alreadyExist, |
| 1491 | const QString &originalDecimalPoint, const QUuid &uuid) |
nothing calls this directly
no test coverage detected