Skip to content

Commit

Permalink
Fixed moving annotations when there are dissolves.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed May 20, 2024
1 parent 43b803d commit eaba11f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
3 changes: 2 additions & 1 deletion mrv2/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ v1.1.7
22.04.4 LTS.
- Added 120 FPS, which drops frames but it is still nice to quickly browse a
movie.
- Darby's Rec709 coefficients and shaders were incorrect leading to subtle
- Darby's Rec709 coefficients and YUV shader were incorrect leading to subtle
color shifts. Now they are fixed.
- Fixed shifting clips with annotations when transitions were present.


v1.1.6
Expand Down
44 changes: 34 additions & 10 deletions mrv2/lib/mrvEdit/mrvEditCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2179,30 +2179,48 @@ namespace mrv

for (const auto& move : moves)
{
if (move.fromIndex < 0 || move.fromTrack < 0 || move.toTrack < 0 ||
if (move.toIndex < 0 || move.toTrack < 0 ||
move.toTrack >= tracks.size())
{
LOG_ERROR("Invalid TO track or index");
continue;

}
if (move.fromIndex < 0 ||
move.fromTrack < 0 ||
move.fromTrack >= tracks.size())
{
LOG_ERROR("Invalid FROM track or index");
continue;
}

if (auto track = otio::dynamic_retainer_cast<otio::Track>(
tracks[move.fromTrack]))
{
if (track->kind() != otio::Track::Kind::video)
continue;
}

int toIndex = move.toIndex;
if (move.fromTrack == move.toTrack && move.fromIndex < toIndex)
int toIndex = move.toOtioIndex;
if (move.fromTrack == move.toTrack &&
move.fromIndex < move.toIndex)
{
--toIndex;
}

if (auto track = otio::dynamic_retainer_cast<otio::Track>(
tracks[move.fromTrack]))
{
auto child = track->children()[move.fromIndex];
auto child = track->children()[move.fromOtioIndex];
auto item = otio::dynamic_retainer_cast<otio::Item>(child);
if (!item)
{
LOG_ERROR("From track=" << move.fromTrack
<< " item=" << move.fromIndex
<< " otio=" << move.fromOtioIndex
<< " name=" << child->name()
<< " not an item ");
continue;
}

auto rate = track->trimmed_range().duration().rate();

Expand All @@ -2218,8 +2236,15 @@ namespace mrv
auto child = track->children()[toIndex];
auto item = otio::dynamic_retainer_cast<otio::Item>(child);
if (!item)
{
LOG_ERROR("To track=" << move.toTrack
<< " item=" << toIndex
<< " otio=" << move.toOtioIndex
<< " name=" << child->name()
<< " not an item");
continue;

}

auto insertRange = item->trimmed_range_in_parent().value();

otime::RationalTime insertTime;
Expand Down Expand Up @@ -2247,10 +2272,6 @@ namespace mrv
otio::ErrorStatus errorStatus;
for (const auto& move : moves)
{
if (move.fromIndex < 0 || move.fromTrack < 0 || move.toTrack < 0 ||
move.toTrack >= tracks.size())
continue;

std::vector<int> fromOtioIndexes;
std::vector<int> toOtioIndexes;
if (auto track = otio::dynamic_retainer_cast<otio::Track>(
Expand Down Expand Up @@ -2289,6 +2310,9 @@ namespace mrv
if (auto track = otio::dynamic_retainer_cast<otio::Track>(
tracks[move.toTrack]))
{
if (move.toOtioIndex >= track->children().size())
continue;

auto child = track->children()[move.toOtioIndex];

auto item = otio::dynamic_retainer_cast<otio::Item>(child);
Expand Down
2 changes: 1 addition & 1 deletion tlRender

0 comments on commit eaba11f

Please sign in to comment.