Merge pull request #987 from manongjohn/draw_keyframe_instead_of_image

Draw keyframe instead of using image
This commit is contained in:
manongjohn 2022-04-30 07:23:54 -04:00 committed by GitHub
commit 6c3e4c9a43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 64 deletions

View file

@ -172,6 +172,7 @@ enum class PredefinedPath {
VOLUME_SLIDER_TRACK, //! slider track
VOLUME_SLIDER_HEAD, //! slider head
TIME_INDICATOR_HEAD, //! current time indicator head
FRAME_MARKER_DIAMOND_SMALL,
FRAME_MARKER_DIAMOND,
FRAME_MARKER_DIAMOND_LARGE,
NAVIGATION_TAG

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="11px" height="11px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g id="rect4" transform="matrix(1,0,0,1,0,-1)">
<rect x="0" y="0" width="11" height="13" style="fill:none;"/>
</g>
<path d="M5.5,0L11,5.5L5.5,11L0,5.5L5.5,0Z"/>
<g transform="matrix(0.817027,0,0,0.776366,1.00635,1.22999)">
<path d="M5.5,0L11,5.5L5.5,11L0,5.5L5.5,0Z" style="fill:white;"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 760 B

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="11px" height="11px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g id="rect4" transform="matrix(1,0,0,1,0,-1)">
<rect x="0" y="0" width="11" height="13" style="fill:none;"/>
</g>
<path d="M5.5,0L11,5.5L5.5,11L0,5.5L5.5,0Z"/>
<g transform="matrix(0.817027,0,0,0.776366,1.00635,1.22999)">
<path d="M5.5,0L11,5.5L5.5,11L0,5.5L5.5,0Z" style="fill:rgb(171,206,255);"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 771 B

View file

@ -597,7 +597,6 @@
<file>Resources/iron.png</file>
<file>Resources/iconplay.png</file>
<file>Resources/iconpause.png</file>
<file>Resources/key.svg</file>
<file>Resources/magnet.png</file>
<file>Resources/motionpath.svg</file>
<file>Resources/motionpath_delete.svg</file>
@ -634,7 +633,6 @@
<file>Resources/schematic_spin_arrows.svg</file>
<file>Resources/schematic_spline_aim_rhomb.svg</file>
<file>Resources/schematic_spline_aim_square.svg</file>
<file>Resources/selected_key.svg</file>
<file>Resources/selection_add.png</file>
<file>Resources/selection_convert.png</file>
<file>Resources/shear.png</file>

View file

@ -1898,16 +1898,17 @@ void CellArea::drawFrameMarker(QPainter &p, const QPoint &xy, QColor color,
->rect(PredefinedRect::FRAME_MARKER_AREA)
.translated(xy)
.translated(-frameAdj / 2);
bool useSmall =
m_viewer->getFrameZoomFactor() <=
m_viewer->orientation()->dimension(PredefinedDimension::SCALE_THRESHOLD);
if (isKeyFrame) {
if (isCamera && !m_viewer->orientation()->isVerticalTimeline() &&
m_viewer->getFrameZoomFactor() <=
m_viewer->orientation()->dimension(
PredefinedDimension::SCALE_THRESHOLD))
if (isCamera && !m_viewer->orientation()->isVerticalTimeline())
dotRect.adjust(0, -3, 0, -3);
PredefinedPath diamondPath =
keyHighlight ? PredefinedPath::FRAME_MARKER_DIAMOND_LARGE
: PredefinedPath::FRAME_MARKER_DIAMOND;
: useSmall ? PredefinedPath::FRAME_MARKER_DIAMOND_SMALL
: PredefinedPath::FRAME_MARKER_DIAMOND;
m_viewer->drawPredefinedPath(p, diamondPath,
dotRect.adjusted(1, 1, 1, 1).center(), color,
outlineColor);
@ -3068,8 +3069,6 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) {
c0 = visible.from().layer();
c1 = visible.to().layer();
static QPixmap selectedKey = svgToPixmap(":Resources/selected_key.svg");
static QPixmap key = svgToPixmap(":Resources/key.svg");
QPoint frameAdj = m_viewer->getFrameZoomAdjustment();
const QRect &keyRect =
o->rect(PredefinedRect::KEY_ICON).translated(-frameAdj / 2);
@ -3150,46 +3149,27 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated) {
if (pegbar->isKeyframe(row)) {
QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
QPoint target = tmpKeyRect.translated(xy).topLeft();
QColor color = Qt::white;
if (m_viewer->getKeyframeSelection() &&
m_viewer->getKeyframeSelection()->isSelected(row, col))
color = QColor(85, 157, 255);
int x = xy.x();
int y = xy.y();
if (m_viewer->getFrameZoomFactor() <=
o->dimension(PredefinedDimension::SCALE_THRESHOLD)) {
QColor color = Qt::white;
int x = xy.x();
int y = xy.y();
if (row == 0) {
if (o->isVerticalTimeline())
xy.setY(xy.y() + 1);
else
xy.setX(xy.x() + 1);
}
if (m_viewer->getKeyframeSelection() &&
m_viewer->getKeyframeSelection()->isSelected(row, col))
color = QColor(85, 157, 255);
drawFrameMarker(p, QPoint(x, y), color, true, (col < 0),
(m_keyHighlight == QPoint(row, col)));
} else {
QPixmap keyPM;
if (o->isVerticalTimeline())
target = QPoint(target.x() - 2, target.y() + 2);
if (m_viewer->getKeyframeSelection() &&
m_viewer->getKeyframeSelection()->isSelected(row, col)) {
// keyframe selected
keyPM = selectedKey;
} else {
// keyframe not selected
keyPM = key;
}
if (m_keyHighlight == QPoint(row, col)) {
keyPM = keyPM.scaled(keyPM.width() + 10, keyPM.height() + 10);
target.setX(target.x() - 3);
target.setY(target.y() - 3);
}
p.drawPixmap(target, keyPM);
}
drawFrameMarker(p, QPoint(x, y), color, true, (col < 0),
(m_keyHighlight == QPoint(row, col)));
}
}

View file

@ -16,8 +16,9 @@ const int PLAY_MARKER_SIZE = 10;
const int PINNED_SIZE = 11;
const int NAV_TAG_WIDTH = 7;
const int NAV_TAG_HEIGHT = 13;
const int FRAME_MARKER_SIZE = 4;
const int FRAME_MARKER_SIZE_LARGE = FRAME_MARKER_SIZE + 2;
const int FRAME_MARKER_SIZE_SMALL = 4;
const int FRAME_MARKER_SIZE = FRAME_MARKER_SIZE_SMALL + 1;
const int FRAME_MARKER_SIZE_LARGE = FRAME_MARKER_SIZE_SMALL + 2;
const int FOLDED_CELL_SIZE = 9;
const int SHIFTTRACE_DOT_SIZE = 12;
@ -943,6 +944,13 @@ TopToBottomOrientation::TopToBottomOrientation() {
corner.lineTo(QPointF(0, CELL_HEIGHT));
addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner);
QPainterPath diamondSmall(QPointF(0, -FRAME_MARKER_SIZE_SMALL));
diamondSmall.lineTo(FRAME_MARKER_SIZE_SMALL, 0);
diamondSmall.lineTo(0, FRAME_MARKER_SIZE_SMALL);
diamondSmall.lineTo(-FRAME_MARKER_SIZE_SMALL, 0);
diamondSmall.lineTo(0, -FRAME_MARKER_SIZE_SMALL);
addPath(PredefinedPath::FRAME_MARKER_DIAMOND_SMALL, diamondSmall);
QPainterPath diamond(QPointF(0, -FRAME_MARKER_SIZE));
diamond.lineTo(FRAME_MARKER_SIZE, 0);
diamond.lineTo(0, FRAME_MARKER_SIZE);
@ -1407,6 +1415,13 @@ LeftToRightOrientation::LeftToRightOrientation() {
corner.lineTo(QPointF(CELL_WIDTH, 0));
addPath(PredefinedPath::DRAG_HANDLE_CORNER, corner);
QPainterPath diamondSmall(QPointF(0, -FRAME_MARKER_SIZE_SMALL));
diamondSmall.lineTo(FRAME_MARKER_SIZE_SMALL, 0);
diamondSmall.lineTo(0, FRAME_MARKER_SIZE_SMALL);
diamondSmall.lineTo(-FRAME_MARKER_SIZE_SMALL, 0);
diamondSmall.lineTo(0, -FRAME_MARKER_SIZE_SMALL);
addPath(PredefinedPath::FRAME_MARKER_DIAMOND_SMALL, diamondSmall);
QPainterPath diamond(QPointF(0, -FRAME_MARKER_SIZE));
diamond.lineTo(FRAME_MARKER_SIZE, 0);
diamond.lineTo(0, FRAME_MARKER_SIZE);