return m_clip->producer(trackSpecific ? track : -1);
}
-QMap<int, QDomElement> ClipItem::adjustEffectsToDuration(int width, int height, int previous, int current, bool fromStart)
+QMap<int, QDomElement> ClipItem::adjustEffectsToDuration(int width, int height, ItemInfo oldInfo)
{
QMap<int, QDomElement> effects;
for (int i = 0; i < m_effectList.count(); i++) {
setFadeOut(out - in);
}
continue;
- } else if (fromStart && effect.attribute("id") == "freeze") {
+ } else if (effect.attribute("id") == "freeze" && cropStart() != oldInfo.cropStart) {
effects[i] = effect.cloneNode().toElement();
- int diff = previous - current;
+ int diff = (oldInfo.cropStart - cropStart()).frames(m_fps);
int frame = EffectsList::parameter(effect, "frame").toInt();
EffectsList::setParameter(effect, "frame", QString::number(frame - diff));
continue;
bool updateNormalKeyframes(QDomElement parameter);
/** @brief Adjusts effects after a clip duration change. */
- QMap<int, QDomElement> adjustEffectsToDuration(int width, int height, int previous, int current, bool fromStart);
+ QMap<int, QDomElement> adjustEffectsToDuration(int width, int height, ItemInfo oldInfo);
/** Returns the necessary (audio, video, general) producer.
* @param track Track of the requested producer
// put a resize command before & after checking keyframes so that
// we are sure the resize is performed before whenever we do or undo the action
new ResizeClipCommand(this, oldInfo, info, false, true, command);
- adjustEffects(clip, oldInfo, true, command);
+ adjustEffects(clip, oldInfo, command);
new ResizeClipCommand(this, oldInfo, info, false, true, command);
emit clipItemSelected(clip);
} else {
// put a resize command before & after checking keyframes so that
// we are sure the resize is performed before whenever we do or undo the action
new ResizeClipCommand(this, oldInfo, info, false, true, command);
- adjustEffects(clip, oldInfo, false, command);
+ adjustEffects(clip, oldInfo, command);
new ResizeClipCommand(this, oldInfo, info, false, true, command);
emit clipItemSelected(clip);
} else {
}
}
-void CustomTrackView::adjustEffects(ClipItem* item, ItemInfo oldInfo, bool fromStart, QUndoCommand* command)
+void CustomTrackView::adjustEffects(ClipItem* item, ItemInfo oldInfo, QUndoCommand* command)
{
QMap<int, QDomElement> effects;
- if (fromStart)
- effects = item->adjustEffectsToDuration(m_document->width(), m_document->height(), oldInfo.cropStart.frames(m_document->fps()), item->cropStart().frames(m_document->fps()), true);
- else
- effects = item->adjustEffectsToDuration(m_document->width(), m_document->height(), (oldInfo.cropStart + oldInfo.cropDuration).frames(m_document->fps()) - 1,
- (item->cropStart() + item->cropDuration()).frames(m_document->fps()) - 1, false);
+ item->adjustEffectsToDuration(m_document->width(), m_document->height(), oldInfo);
if (effects.count()) {
QMap<int, QDomElement>::const_iterator i = effects.constBegin();
* @param oldInfo pre resize info
* @param fromStart false = resize from end
* @param command Used as a parent for EditEffectCommand */
- void adjustEffects(ClipItem *item, ItemInfo oldInfo, bool fromStart, QUndoCommand *command);
+ void adjustEffects(ClipItem *item, ItemInfo oldInfo, QUndoCommand *command);
private slots:
void slotRefreshGuides();