Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Oct 13, 2023
1 parent 1df09ce commit 82fd4cc
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 31 deletions.
10 changes: 6 additions & 4 deletions mrv2/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ v0.8.0
full name of the directory in the filename field and pressed Enter,
- Fixed a crash when loading a session with no files.
- Added session name to the window's title bar.
- Fixed a typo in Python's binding to sessios (oepenSession instead of
- Fixed a typo in Python's binding to session (oepenSession instead of
openSession).
- Made Save Session not save temporary EDLs in the session file.
- Added a '\_\_divider\_\_' tuple entry to Plug-in menus to add a divider line
Expand Down Expand Up @@ -51,12 +51,14 @@ v0.8.0
- Fixed missing frames (Repeat Last and Repeat Scratched) when the user was
reading a different layer and he was playing backwards or stepping through
the frames.
- Added drawing background transparent, solid or checkers.
- Added drawing background as transparent, solid or checkers.
- Made dragging a clip from the Files Panel not loose the selection.
- Fixed a network error (harmless) about edit mode.
- Some UI fixes:
* The Zoom factor in the Pixel Toolbar keeps its value when selecting
* The Zoom factor in the Pixel Toolbar keeps its value when selecting
it from the pulldown.
* All buttons and displays have the same size.
* All buttons and displays have the same size on both the timeline and
pixel toolbar.
* Cursor in all input fields is now red for easier reading.
* The FPS input widget now displays the FPS with different number of
digits to fit the value as best it can on the limited width.
Expand Down
9 changes: 7 additions & 2 deletions mrv2/lib/mrvCore/mrvHotkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ namespace mrv

Hotkey kToggleShowAnnotations(false, false, false, false, 0);

Hotkey kToggleBlackBackground(false, false, false, true, 'b');
Hotkey kTransparentBackground(true, false, false, false, 't');
Hotkey kSolidBackground(true, false, false, false, 'b');
Hotkey kCheckersBackground(false, false, false, false, 0);

Hotkey kFitScreen(false, false, false, false, 'f');
Hotkey kResizeMainWindow(false, false, false, true, 'w');
Expand Down Expand Up @@ -453,7 +455,10 @@ namespace mrv
HotkeyEntry(_("Set In Point"), kSetInPoint),
HotkeyEntry(_("Set Out Point"), kSetOutPoint),

HotkeyEntry(_("Toggle Black Background"), kToggleBlackBackground),
HotkeyEntry(_("Solid Background"), kSolidBackground),
HotkeyEntry(_("Checkers Background"), kCheckersBackground),
HotkeyEntry(_("Transparent Background"), kTransparentBackground),

HotkeyEntry(_("Hud Window"), kHudToggle),

HotkeyEntry(_("Toggle One Panel Only"), kToggleOnePanelOnly),
Expand Down
4 changes: 3 additions & 1 deletion mrv2/lib/mrvCore/mrvHotkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ namespace mrv
extern Hotkey kDisplayWindow;
extern Hotkey kDataWindow;

extern Hotkey kToggleBlackBackground;
extern Hotkey kTransparentBackground;
extern Hotkey kSolidBackground;
extern Hotkey kCheckersBackground;

extern Hotkey kCompareWipe;
extern Hotkey kCompareOverlay;
Expand Down
7 changes: 2 additions & 5 deletions mrv2/lib/mrvGL/mrvGLViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ namespace mrv

gl.render->begin(
renderSize, p.colorConfigOptions, p.lutOptions);

_drawBackground();
CHECK_GL;
if (p.missingFrame &&
p.missingFrameType != MissingFrameType::kBlackFrame)
Expand Down Expand Up @@ -324,9 +326,6 @@ namespace mrv
switch (p.backgroundOptions.type)
{
case timeline::Background::Solid:
p.backgroundOptions.solidColor =
image::Color4f(0.F, 0.F, 0.F, 1.F);
break;
case timeline::Background::Transparent:
{
uint8_t ur, ug, ub;
Expand All @@ -352,8 +351,6 @@ namespace mrv

if (gl.buffer && gl.shader)
{
_drawBackground();

math::Matrix4x4f mvp;

if (p.environmentMapOptions.type != EnvironmentMapOptions::kNone)
Expand Down
18 changes: 3 additions & 15 deletions mrv2/lib/mrvGL/mrvGLViewportDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1169,27 +1169,17 @@ namespace mrv
{
MRV2_GL();
TLRENDER_P();
if (p.timelinePlayers.empty())
return;
const auto& viewportSize = getViewportSize();

timeline::RenderOptions renderOptions;
renderOptions.clear = false;

gl.render->begin(
viewportSize, timeline::ColorConfigOptions(),
timeline::LUTOptions(), renderOptions);

const auto renderSize = getRenderSize();
switch (p.backgroundOptions.type)
{
case timeline::Background::Solid:
gl.render->clearViewport(p.backgroundOptions.solidColor);
gl.render->clearViewport(image::Color4f(0.F, 0.F, 0.F));
break;
case timeline::Background::Checkers:
gl.render->clearViewport(image::Color4f(0.F, 0.F, 0.F));
gl.render->drawColorMesh(
ui::checkers(
math::Box2i(0, 0, viewportSize.w, viewportSize.h),
math::Box2i(0, 0, renderSize.w, renderSize.h),
p.backgroundOptions.checkersColor0,
p.backgroundOptions.checkersColor1,
p.backgroundOptions.checkersSize),
Expand All @@ -1198,7 +1188,5 @@ namespace mrv
default:
break;
}

gl.render->end();
}
} // namespace mrv
6 changes: 3 additions & 3 deletions mrv2/lib/mrvUI/mrvMenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,21 +561,21 @@ namespace mrv
mode |= FL_MENU_INACTIVE;

idx = menu->add(
_("Render/Background/Transparent"), kToggleBlackBackground.hotkey(),
_("Render/Background/Transparent"), kTransparentBackground.hotkey(),
(Fl_Callback*)transparent_background_cb, ui, mode);
item = (Fl_Menu_Item*)&(menu->menu()[idx]);
if (backgroundOptions.type == timeline::Background::Transparent)
item->set();

idx = menu->add(
_("Render/Background/Solid"), kToggleBlackBackground.hotkey(),
_("Render/Background/Solid"), kSolidBackground.hotkey(),
(Fl_Callback*)solid_background_cb, ui, mode);
item = (Fl_Menu_Item*)&(menu->menu()[idx]);
if (backgroundOptions.type == timeline::Background::Solid)
item->set();

idx = menu->add(
_("Render/Background/Checkers"), kToggleBlackBackground.hotkey(),
_("Render/Background/Checkers"), kCheckersBackground.hotkey(),
(Fl_Callback*)checkers_background_cb, ui, mode);
item = (Fl_Menu_Item*)&(menu->menu()[idx]);
if (backgroundOptions.type == timeline::Background::Checkers)
Expand Down
2 changes: 1 addition & 1 deletion mrv2/lib/mrvWidgets/mrvFileButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace mrv

if (p.drag)
{
value(0);
value(1);
redraw();
int X = Fl::event_x_root();
int Y = Fl::event_y_root();
Expand Down

0 comments on commit 82fd4cc

Please sign in to comment.