Introduce category for compositions that should have default length on insertion.

Related to #549
parent 72c7ad1f
Pipeline #16008 passed with stage
in 13 minutes and 51 seconds
<!DOCTYPE kpartgui>
<transition tag="luma" id="dissolve">
<transition tag="luma" id="dissolve" type="short">
<name>Dissolve</name>
<description>Fade out one video while fading in the other video.</description>
<parameter type="list" name="resource" default="" paramlist="%lumaPaths" optional="1">
......
<!DOCTYPE kpartgui>
<transition tag="composite" id="slide">
<transition tag="composite" id="slide" type="short">
<name>Slide</name>
<description>Slide image from one side to another.</description>
<author>Dan Dennedy</author>
......
<!DOCTYPE kpartgui>
<transition tag="composite" id="wipe">
<transition tag="composite" id="wipe" type="short">
<name>Wipe</name>
<description>Applies a stationary transition between the current and next frames.</description>
<author>Dan Dennedy</author>
......
......@@ -405,8 +405,10 @@ int TimelineController::insertNewComposition(int tid, int clipId, int offset, co
}
}
}
if (duration < 0) {
duration = pCore->currentDoc()->getFramePos(KdenliveSettings::transition_duration());
int defaultLength = pCore->currentDoc()->getFramePos(KdenliveSettings::transition_duration());
bool isShortComposition = TransitionsRepository::get()->getType(transitionId) == TransitionType::VideoShortComposition;
if (duration < 0 || (isShortComposition && duration > 1.5 * defaultLength)) {
duration = defaultLength;
} else if (duration <= 1) {
// if suggested composition duration is lower than 4 frames, use default
duration = pCore->currentDoc()->getFramePos(KdenliveSettings::transition_duration());
......
......@@ -97,6 +97,8 @@ void TransitionsRepository::parseCustomAssetFile(const QString &file_name, std::
QString type = result.xml.attribute(QStringLiteral("type"), QString());
if (type == QLatin1String("hidden")) {
result.type = TransitionType::Hidden;
} else if (type == QLatin1String("short")) {
result.type = TransitionType::VideoShortComposition;
}
customAssets[result.id] = result;
}
......@@ -164,7 +166,7 @@ std::unique_ptr<Mlt::Transition> TransitionsRepository::getTransition(const QStr
bool TransitionsRepository::isComposition(const QString &transitionId) const
{
auto type = getType(transitionId);
return type == TransitionType::AudioComposition || type == TransitionType::VideoComposition;
return type == TransitionType::AudioComposition || type == TransitionType::VideoComposition || type == TransitionType::VideoShortComposition;
}
const QString TransitionsRepository::getCompositingTransition()
......
......@@ -33,7 +33,7 @@
* Note that this class is a Singleton
*/
enum class TransitionType { AudioComposition, VideoComposition, AudioTransition, VideoTransition, Favorites, Hidden = -1 };
enum class TransitionType { AudioComposition, VideoShortComposition, VideoComposition, AudioTransition, VideoTransition, Favorites, Hidden = -1 };
Q_DECLARE_METATYPE(TransitionType)
class TransitionsRepository : public AbstractAssetsRepository<TransitionType>
......
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