Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
92eaf0f5
Commit
92eaf0f5
authored
Feb 24, 2021
by
Julius Künzel
Browse files
AnimatedRect: add "adjustcenter" default (Pillar Echo effect)
Fixes
#891
parent
f84d0f36
Changes
9
Hide whitespace changes
Inline
Side-by-side
data/effects/README.md
View file @
92eaf0f5
...
...
@@ -179,6 +179,8 @@ For double values these placeholders are avaible:
|
`showrotation`
| _(default =
`"0"`
)_ use to enable support to 3 axis rotation |
|
`opacity`
| _(default =
`"true"`
)_ use to disable support of the opacity setting |
You can set
`default`
to
`"adjustcenter"`
to adjust the geometry to the frame size
##### `"url"`
*
url/path
...
...
data/effects/pillar_echo.xml
View file @
92eaf0f5
...
...
@@ -3,7 +3,7 @@
<name>
Pillar Echo
</name>
<description>
Create an echo effect (blur) outside of an area of interest.
</description>
<author>
Meltytech, LLC
</author>
<parameter
type=
"animatedrect"
name=
"rect"
default=
"
25% 0% 50% 100%
"
fixed=
"1"
opacity=
"false"
>
<parameter
type=
"animatedrect"
name=
"rect"
default=
"
adjustcenter
"
fixed=
"1"
opacity=
"false"
>
<name>
Rectangle
</name>
</parameter>
<parameter
type=
"constant"
name=
"blur"
max=
"50"
min=
"0"
default=
"4"
suffix=
"%"
>
...
...
src/assets/model/assetparametermodel.cpp
View file @
92eaf0f5
...
...
@@ -630,10 +630,28 @@ QVariant AssetParameterModel::parseAttribute(const ObjectId &owner, const QStrin
}
ParamType
type
=
paramTypeFromStr
(
element
.
attribute
(
QStringLiteral
(
"type"
)));
QString
content
=
element
.
attribute
(
attribute
);
if
(
content
.
contains
(
QLatin1Char
(
'%'
)))
{
std
::
unique_ptr
<
ProfileModel
>
&
profile
=
pCore
->
getCurrentProfile
();
int
width
=
profile
->
width
();
int
height
=
profile
->
height
();
std
::
unique_ptr
<
ProfileModel
>
&
profile
=
pCore
->
getCurrentProfile
();
int
width
=
profile
->
width
();
int
height
=
profile
->
height
();
if
(
type
==
ParamType
::
AnimatedRect
&&
content
==
"adjustcenter"
)
{
QSize
frameSize
=
pCore
->
getItemFrameSize
(
owner
);
int
contentHeight
;
int
contentWidth
;
double
sourceDar
=
frameSize
.
width
()
/
frameSize
.
height
();
if
(
sourceDar
>
pCore
->
getCurrentDar
())
{
// Fit to width
double
factor
=
(
double
)
width
/
frameSize
.
width
()
*
pCore
->
getCurrentSar
();
contentHeight
=
(
int
)(
height
*
factor
+
0.5
);
contentWidth
=
width
;
}
else
{
// Fit to height
double
factor
=
(
double
)
height
/
frameSize
.
height
();
contentHeight
=
height
;
contentWidth
=
(
int
)(
frameSize
.
width
()
/
pCore
->
getCurrentSar
()
*
factor
+
0.5
);
}
// Center
content
=
QString
(
"%1 %2 %3 %4"
).
arg
((
width
-
contentWidth
)
/
2
).
arg
((
height
-
contentHeight
)
/
2
).
arg
(
contentWidth
).
arg
(
contentHeight
);
}
else
if
(
content
.
contains
(
QLatin1Char
(
'%'
)))
{
int
in
=
pCore
->
getItemIn
(
owner
);
int
out
=
in
+
pCore
->
getItemDuration
(
owner
)
-
1
;
int
frame_duration
=
pCore
->
getDurationFromString
(
KdenliveSettings
::
fade_duration
());
...
...
src/bin/bin.cpp
View file @
92eaf0f5
...
...
@@ -4185,6 +4185,13 @@ size_t Bin::getClipDuration(int itemId) const
return
clip
->
frameDuration
();
}
QSize
Bin
::
getFrameSize
(
int
itemId
)
const
{
std
::
shared_ptr
<
ProjectClip
>
clip
=
m_itemModel
->
getClipByBinID
(
QString
::
number
(
itemId
));
Q_ASSERT
(
clip
!=
nullptr
);
return
clip
->
frameSize
();
}
PlaylistState
::
ClipState
Bin
::
getClipState
(
int
itemId
)
const
{
std
::
shared_ptr
<
ProjectClip
>
clip
=
m_itemModel
->
getClipByBinID
(
QString
::
number
(
itemId
));
...
...
src/bin/bin.h
View file @
92eaf0f5
...
...
@@ -220,6 +220,8 @@ public:
const
QString
getBinClipName
(
const
QString
&
id
)
const
;
/** @brief Returns the duration of a given clip. */
size_t
getClipDuration
(
int
itemId
)
const
;
/** @brief Returns the frame size of a given clip. */
QSize
getFrameSize
(
int
itemId
)
const
;
/** @brief Returns the state of a given clip: AudioOnly, VideoOnly, Disabled (Disabled means it has audio and video capabilities */
PlaylistState
::
ClipState
getClipState
(
int
itemId
)
const
;
...
...
src/bin/projectclip.cpp
View file @
92eaf0f5
...
...
@@ -351,6 +351,11 @@ const QString ProjectClip::url() const
return
clipUrl
();
}
const
QSize
ProjectClip
::
frameSize
()
const
{
return
getFrameSize
();
}
GenTime
ProjectClip
::
duration
()
const
{
return
getPlaytime
();
...
...
src/bin/projectclip.h
View file @
92eaf0f5
...
...
@@ -122,6 +122,9 @@ public:
/** @brief Returns the clip's url. */
const
QString
url
()
const
;
/** @brief Returns the clip's frame size. */
const
QSize
frameSize
()
const
;
/** @brief Returns the clip's duration. */
GenTime
duration
()
const
;
size_t
frameDuration
()
const
;
...
...
src/core.cpp
View file @
92eaf0f5
...
...
@@ -583,6 +583,27 @@ int Core::getItemDuration(const ObjectId &id)
return
0
;
}
QSize
Core
::
getItemFrameSize
(
const
ObjectId
&
id
)
{
if
(
!
m_guiConstructed
)
return
QSize
();
switch
(
id
.
first
)
{
case
ObjectType
::
TimelineClip
:
if
(
m_mainWindow
->
getCurrentTimeline
()
->
controller
()
->
getModel
()
->
isClip
(
id
.
second
))
{
return
m_mainWindow
->
getCurrentTimeline
()
->
controller
()
->
getModel
()
->
getClipFrameSize
(
id
.
second
);
}
break
;
case
ObjectType
::
BinClip
:
return
m_binWidget
->
getFrameSize
(
id
.
second
);
break
;
case
ObjectType
::
TimelineTrack
:
case
ObjectType
::
Master
:
return
pCore
->
getCurrentFrameSize
();
default:
qWarning
()
<<
"unhandled object type"
;
}
return
pCore
->
getCurrentFrameSize
();
}
int
Core
::
getItemTrack
(
const
ObjectId
&
id
)
{
if
(
!
m_guiConstructed
)
return
0
;
...
...
src/core.h
View file @
92eaf0f5
...
...
@@ -175,6 +175,7 @@ public:
int
getItemIn
(
const
ObjectId
&
id
);
int
getItemTrack
(
const
ObjectId
&
id
);
int
getItemDuration
(
const
ObjectId
&
id
);
QSize
getItemFrameSize
(
const
ObjectId
&
id
);
/** @brief Returns the capabilities of a clip: AudioOnly, VideoOnly or Disabled if both are allowed */
PlaylistState
::
ClipState
getItemState
(
const
ObjectId
&
id
);
/** @brief Get a list of video track names with indexes */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment