Skip to content

Commit

Permalink
Added Image/Compare and Image/Compare Mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Sep 18, 2024
1 parent f572c36 commit 78c5d4a
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 42 deletions.
7 changes: 3 additions & 4 deletions src/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ v1.2.8
- A/B Wipe Comparison now properly follows the cursor when zoomed in.
- Fixed and simplified bakeOCIO.py demo script. Now, you can bake OCIO
from the command-line by just doing something like:

```
mrv2 <INPUT_FILE> -ics ACEScg -od 'sRGB - Display' -pythonScript bakeOCIO.py -pythonArgs <BAKED.mov>
```

Note that this script bakes without annotations support so if saving a float
EXR to an 8 or 16-bit image, you will get banding.

- Fixed changing displayOptions through python not reflecting the changes in
the UI.
- Fixed cmd.compare() to refresh the comparison immediately.
Expand All @@ -30,12 +27,14 @@ v1.2.8
- Fixed a precision issue on Windows with arbitrary scalings like 115%.
- Added Image/Previous Limited and Image/Next Limited to go from previous to
next images, without looping.
- Added Image/Go to/<Clip> to switch from one clip to the next without having
- Added "Image/Go to/<Clip>" to switch from one clip to the next without having
to bring up the Files Panel.
- Made UI at start up wider to account for new menus and new language
translations.
- Added HDR metadata to Media Information Panel.
- Very minor playback improvement for non HDR videos.
- Added "Image/Compare/<Clip>" and "Image/Compare Mode" to compare images
without bringing up the Compare Panel.


v1.2.7
Expand Down
94 changes: 94 additions & 0 deletions src/lib/mrvFl/mrvCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,14 @@ namespace mrv
{
auto model = ui->app->filesModel();
model->prev();
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void next_file_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = ui->app->filesModel();
model->next();
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void previous_file_limited_cb(Fl_Widget* w, ViewerUI* ui)
Expand All @@ -263,6 +265,7 @@ namespace mrv
if (Aindex <= 0)
return;
model->prev();
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void next_file_limited_cb(Fl_Widget* w, ViewerUI* ui)
Expand All @@ -273,18 +276,109 @@ namespace mrv
if (Aindex + 1 >= numFiles)
return;
model->next();
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void goto_file_cb(Fl_Widget* w, void* data)
{
ViewerUI* ui = App::ui;
size_t Aindex = (size_t) data;
auto model = App::app->filesModel();
auto numFiles = model->observeFiles()->getSize();
if (Aindex < 0 || Aindex >= numFiles)
return;
model->setA(Aindex);
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void select_Bfile_cb(Fl_Widget* w, void* data)
{
ViewerUI* ui = App::ui;
size_t Bindex = (size_t) data;
auto model = App::app->filesModel();
auto numFiles = model->observeFiles()->getSize();
if (Bindex < 0 || Bindex >= numFiles)
return;

const auto bIndexes = model->observeBIndexes()->get();
const auto i = std::find(bIndexes.begin(), bIndexes.end(), Bindex);
model->setB(Bindex, i == bIndexes.end());
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void compare_a_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = App::app->filesModel();
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::A;
model->setCompareOptions(o);

ui->uiMain->fill_menu(ui->uiMenuBar);
}

void compare_b_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = App::app->filesModel();
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::B;
model->setCompareOptions(o);
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void compare_wipe_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = App::app->filesModel();
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Wipe;
model->setCompareOptions(o);
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void compare_overlay_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = App::app->filesModel();
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Overlay;
model->setCompareOptions(o);
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void compare_difference_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = App::app->filesModel();
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Difference;
model->setCompareOptions(o);
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void compare_horizontal_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = App::app->filesModel();
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Horizontal;
model->setCompareOptions(o);
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void compare_vertical_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = App::app->filesModel();
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Vertical;
model->setCompareOptions(o);
ui->uiMain->fill_menu(ui->uiMenuBar);
}

void compare_tile_cb(Fl_Widget* w, ViewerUI* ui)
{
auto model = App::app->filesModel();
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Tile;
model->setCompareOptions(o);
ui->uiMain->fill_menu(ui->uiMenuBar);
}

static std::string lastSavedFile;
static mrv::SaveOptions lastSavedOptions;

Expand Down
15 changes: 14 additions & 1 deletion src/lib/mrvFl/mrvCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,21 @@ namespace mrv
void next_file_cb(Fl_Widget* w, ViewerUI* ui);
void previous_file_limited_cb(Fl_Widget* w, ViewerUI* ui);
void next_file_limited_cb(Fl_Widget* w, ViewerUI* ui);
void goto_file_cb(Fl_Widget* w, void* idx);

//! Select A/B file callbacks
void goto_file_cb(Fl_Widget* w, void* idx);
void select_Bfile_cb(Fl_Widget* w, void* idx);

//! Compare callbacks
void compare_a_cb(Fl_Widget* w, ViewerUI* ui);
void compare_b_cb(Fl_Widget* w, ViewerUI* ui);
void compare_wipe_cb(Fl_Widget* w, ViewerUI* ui);
void compare_overlay_cb(Fl_Widget* w, ViewerUI* ui);
void compare_difference_cb(Fl_Widget* w, ViewerUI* ui);
void compare_horizontal_cb(Fl_Widget* w, ViewerUI* ui);
void compare_vertical_cb(Fl_Widget* w, ViewerUI* ui);
void compare_tile_cb(Fl_Widget* w, ViewerUI* ui);

void exit_cb(Fl_Widget* w, ViewerUI* ui);

//! Layer callbacks
Expand Down
32 changes: 8 additions & 24 deletions src/lib/mrvPanels/mrvComparePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ namespace mrv
bW->callback(
[=](auto w)
{
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::A;
model->setCompareOptions(o);
compare_a_cb(nullptr, p.ui);
});

bW = new Widget< Button >(X + 30, Y, 30, 30);
Expand All @@ -246,9 +244,7 @@ namespace mrv
bW->callback(
[=](auto w)
{
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::B;
model->setCompareOptions(o);
compare_b_cb(nullptr, p.ui);
});

bW = new Widget< Button >(X + 60, Y, 30, 30);
Expand All @@ -271,9 +267,7 @@ namespace mrv
bW->callback(
[=](auto w)
{
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Wipe;
model->setCompareOptions(o);
compare_wipe_cb(nullptr, p.ui);
});

bW = new Widget< Button >(X + 90, Y, 30, 30);
Expand All @@ -285,9 +279,7 @@ namespace mrv
bW->callback(
[=](auto w)
{
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Overlay;
model->setCompareOptions(o);
compare_overlay_cb(nullptr, p.ui);
});

bW = new Widget< Button >(X + 120, Y, 30, 30);
Expand All @@ -298,9 +290,7 @@ namespace mrv
bW->callback(
[=](auto w)
{
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Difference;
model->setCompareOptions(o);
compare_difference_cb(nullptr, p.ui);
});

bW = new Widget< Button >(X + 150, Y, 30, 30);
Expand All @@ -311,9 +301,7 @@ namespace mrv
bW->callback(
[=](auto w)
{
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Horizontal;
model->setCompareOptions(o);
compare_horizontal_cb(nullptr, p.ui);
});

bW = new Widget< Button >(X + 180, Y, 30, 30);
Expand All @@ -324,9 +312,7 @@ namespace mrv
bW->callback(
[=](auto w)
{
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Vertical;
model->setCompareOptions(o);
compare_vertical_cb(nullptr, p.ui);
});

bW = new Widget< Button >(X + 210, Y, 30, 30);
Expand All @@ -337,9 +323,7 @@ namespace mrv
bW->callback(
[=](auto w)
{
auto o = model->observeCompareOptions()->get();
o.mode = timeline::CompareMode::Tile;
model->setCompareOptions(o);
compare_tile_cb(nullptr, p.ui);
});

bW = new Widget< Button >(X + 240, Y, 30, 30);
Expand Down
Loading

0 comments on commit 78c5d4a

Please sign in to comment.