Skip to content

Commit

Permalink
Updated tlRender and defaults for Save Movie Advanced Options.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Sep 19, 2024
1 parent 9105349 commit 17414ac
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/lib/mrvApp/mrvSettingsObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,17 @@ namespace mrv
return p.settings[name] = defaultValue;
}

bool SettingsObject::hasValue(const std::string& name)
{
TLRENDER_P();
auto i = p.settings.find(name);
if (i != p.settings.end())
{
return true;
}
return false;
}

template < typename T > T SettingsObject::getValue(const std::string& name)
{
T out;
Expand Down
3 changes: 3 additions & 0 deletions src/lib/mrvApp/mrvSettingsObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ namespace mrv
//! Get a value safely.
template < typename T > T getValue(const std::string&);

//! Check if it has a value.
bool hasValue(const std::string&);

//! Get default value safely.
template < typename T > T getDefaultValue(const std::string&);

Expand Down
37 changes: 26 additions & 11 deletions src/lib/mrvWidgets/mrvSaveMovieOptionsUI.fl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ v->hide();}
}
Fl_Window uiAdvancedSettings {
label {Advanced Settings} open
xywh {720 371 411 310} type Double hide hotspot modal
xywh {1185 376 411 310} type Double hide hotspot modal
} {
Fl_Check_Button Override {
label Override
Expand Down Expand Up @@ -424,7 +424,7 @@ settings->setValue("SaveMovie/Color TRC", value);}
label Cancel
user_data uiAdvancedSettings user_data_type {Fl_Double_Window*}
callback {Override->value(0);
v->hide();} selected
v->hide();}
xywh {239 242 90 29}
}
}
Expand Down Expand Up @@ -863,32 +863,47 @@ for (auto entry : entries)
const int value = settings->getValue<int>("SaveMovie/Resolution");
o->value(value);} {}
}
Function {add_advanced_override(Fl_Check_Button* v)} {open
} {
Function {add_advanced_override(Fl_Check_Button* v)} {} {
code {auto settings = mrv::App::app->settings();
const bool value = settings->getValue<int>("SaveMovie/Override");
v->value(value);} {}
}
Function {add_advanced_color_range(Fl_Choice* o)} {open
} {
code {const auto& settings = mrv::App::app->settings();
const int value = settings->getValue<int>("SaveMovie/Color Range");
int value;
if (!settings->hasValue("SaveMovie/Color Range"))
value = o->find_index("PC");
else
value = settings->getValue<int>("SaveMovie/Color Range");
o->value(value);} {}
}
Function {add_advanced_color_space(Fl_Choice* o)} {} {
Function {add_advanced_color_space(Fl_Choice* o)} {open
} {
code {const auto& settings = mrv::App::app->settings();
const int value = settings->getValue<int>("SaveMovie/Color Space");
int value;
if (!settings->hasValue("SaveMovie/Color Space"))
value = o->find_index("bt709");
else
value = settings->getValue<int>("SaveMovie/Color Space");
o->value(value);} {}
}
Function {add_advanced_color_primaries(Fl_Choice* o)} {} {
Function {add_advanced_color_primaries(Fl_Choice* o)} {open
} {
code {const auto& settings = mrv::App::app->settings();
const int value = settings->getValue<int>("SaveMovie/Color Primaries");
o->value(value);} {}
}
Function {add_advanced_color_trc(Fl_Choice* o)} {} {
Function {add_advanced_color_trc(Fl_Choice* o)} {open
} {
code {const auto& settings = mrv::App::app->settings();
const int value = settings->getValue<int>("SaveMovie/Color TRC");
o->value(value);} {}
int value;
if (!settings->hasValue("SaveMovie/Color TRC"))
value = o->find_index("iec61966-2-1");
else
value = settings->getValue<int>("SaveMovie/Color TRC");
o->value(value);} {selected
}
}
Function {add_audio_codecs(Fl_Choice* o)} {} {
code {auto entries = tl::ffmpeg::getAudioCodecLabels();
Expand Down
2 changes: 1 addition & 1 deletion tlRender

0 comments on commit 17414ac

Please sign in to comment.