Skip to content

Commit

Permalink
Fixed thumbnails in all panels.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Mar 14, 2024
1 parent e2c39b0 commit c1bebb8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 47 deletions.
26 changes: 12 additions & 14 deletions mrv2/lib/mrvApp/mrvApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1242,28 +1242,26 @@ namespace mrv
TLRENDER_P();

std::shared_ptr<TimelinePlayer> player;
if (!activeFiles.empty())
if (!p.activeFiles.empty() && p.player)
{
p.activeFiles[0]->speed = p.player->speed();
p.activeFiles[0]->playback = p.player->playback();
p.activeFiles[0]->loop = p.player->loop();
p.activeFiles[0]->currentTime = p.player->currentTime();
p.activeFiles[0]->inOutRange = p.player->inOutRange();
p.activeFiles[0]->audioOffset = p.player->audioOffset();
p.activeFiles[0]->annotations = p.player->getAllAnnotations();
p.activeFiles[0]->ocioIcs = image::ocioIcs();
}

if (!activeFiles.empty())
{
if (!p.activeFiles.empty() && activeFiles[0] == p.activeFiles[0])
{
player = p.player;
}
else
{
if (!p.activeFiles.empty() && p.player)
{
player = p.player;

p.activeFiles[0]->speed = player->speed();
p.activeFiles[0]->playback = player->playback();
p.activeFiles[0]->loop = player->loop();
p.activeFiles[0]->currentTime = player->currentTime();
p.activeFiles[0]->inOutRange = player->inOutRange();
p.activeFiles[0]->audioOffset = player->audioOffset();
p.activeFiles[0]->annotations = player->getAllAnnotations();
p.activeFiles[0]->ocioIcs = image::ocioIcs();
}

auto i =
std::find(p.files.begin(), p.files.end(), activeFiles[0]);
Expand Down
12 changes: 6 additions & 6 deletions mrv2/lib/mrvPanels/mrvComparePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ namespace mrv
if (Bindex == i)
{
b->value(1);
if (player)
time = player->currentTime();
break;
}
}
Expand Down Expand Up @@ -654,7 +652,7 @@ namespace mrv
const auto player = p.ui->uiView->getTimelinePlayer();
if (!player)
return;
otio::RationalTime time = player->currentTime();
otio::RationalTime time;

const image::Size size(128, 64);

Expand Down Expand Up @@ -687,7 +685,6 @@ namespace mrv
b->value(0);
found = true;
layerId = p.ui->uiColorChannel->value();
time = player->currentTime();
}

for (auto Bindex : Bindices)
Expand All @@ -696,11 +693,14 @@ namespace mrv
{
found = true;
b->value(1);
time = player->currentTime();
break;
}
}
if (!found)
if (found)
{
time = player->currentTime();
}
else
{
b->value(0);
time = media->currentTime;
Expand Down
31 changes: 5 additions & 26 deletions mrv2/lib/mrvPanels/mrvFilesPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ namespace mrv
otio::RationalTime time = otio::RationalTime(0.0, 1.0);

const auto player = p.ui->uiView->getTimelinePlayer();
if (!player)
return;

image::Size size(128, 64);

Expand All @@ -437,11 +439,11 @@ namespace mrv
const auto& media = files->getItem(i);
const auto& path = media->path;

const std::string protocol = path.getProtocol();
const std::string& protocol = path.getProtocol();
const std::string& dir = path.getDirectory();
const std::string file =
path.getBaseName() + path.getNumber() + path.getExtension();
const std::string fullfile = protocol + dir + file;
const std::string& fullfile = protocol + dir + file;
FileButton* b = m.second;

uint16_t layerId = media->videoLayer;
Expand All @@ -455,34 +457,11 @@ namespace mrv
if (Aindex != i)
{
b->value(0);
auto bIndexes = model->observeBIndexes()->get();
auto stereoIndex = model->observeStereoIndex()->get();

bool doThumbnail = false;
for (const auto& bIndex : bIndexes)
{
if (bIndex == i)
{
doThumbnail = true;
break;
}
}

if (i == stereoIndex)
{
doThumbnail = true;
}

if (!doThumbnail)
continue;
}
else
{
b->value(1);
if (player)
{
time = player->currentTime();
}
time = player->currentTime();
}

layerId = p.ui->uiColorChannel->value();
Expand Down
4 changes: 3 additions & 1 deletion mrv2/lib/mrvPanels/mrvStereo3DPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ namespace mrv
otio::RationalTime time = otio::RationalTime(0.0, 1.0);

const auto player = p.ui->uiView->getTimelinePlayer();
if (!player)
return;

image::Size size(128, 64);

Expand Down Expand Up @@ -506,7 +508,7 @@ namespace mrv
b->value(1);
}

if (found && player)
if (found)
time = player->currentTime();
else
time = media->currentTime;
Expand Down

0 comments on commit c1bebb8

Please sign in to comment.