Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/toucan-filmstrip/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ namespace toucan
const std::shared_ptr<ftk::Context>& context,
std::vector<std::string>& argv)
{
_cmdLine.input = ftk::CmdLineValueArg<std::string>::create(
_cmdLine.input = ftk::CmdLineArg<std::string>::create(
"input",
"Input .otio file.");
_cmdLine.output = ftk::CmdLineValueArg<std::string>::create(
_cmdLine.output = ftk::CmdLineArg<std::string>::create(
"output",
"Output image file.");

Expand Down
6 changes: 3 additions & 3 deletions bin/toucan-filmstrip/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ namespace toucan
const std::shared_ptr<ftk::Context>&,
std::vector<std::string>&);

void run() override;
void run();

private:
struct CmdLine
{
std::shared_ptr<ftk::CmdLineValueArg<std::string> > input;
std::shared_ptr<ftk::CmdLineValueArg<std::string> > output;
std::shared_ptr<ftk::CmdLineArg<std::string> > input;
std::shared_ptr<ftk::CmdLineArg<std::string> > output;
};
CmdLine _cmdLine;

Expand Down
6 changes: 4 additions & 2 deletions bin/toucan-filmstrip/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ int main(int argc, char** argv)
{
auto context = ftk::Context::create();
auto app = App::create(context, args);
if (0 == app->getExit())
if (!app->hasCmdLineHelp())
{
app->run();
out = app->getExit();
}
out = 0;
}
catch (const std::exception& e)
{
Expand Down
20 changes: 10 additions & 10 deletions bin/toucan-render/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ namespace toucan
const std::shared_ptr<ftk::Context>& context,
std::vector<std::string>& argv)
{
_cmdLine.input = ftk::CmdLineValueArg<std::string>::create(
_cmdLine.input = ftk::CmdLineArg<std::string>::create(
"input",
"Input .otio file.");
_cmdLine.output = ftk::CmdLineValueArg<std::string>::create(
_cmdLine.output = ftk::CmdLineArg<std::string>::create(
"output",
"Output image or movie file. Use a dash ('-') to write raw frames or y4m to stdout.");

Expand All @@ -64,37 +64,37 @@ namespace toucan
{
y4mList.push_back(spec.first);
}
_cmdLine.videoCodec = ftk::CmdLineValueOption<std::string>::create(
_cmdLine.videoCodec = ftk::CmdLineOption<std::string>::create(
std::vector<std::string>{ "-vcodec" },
"Set the video codec.",
"",
"MJPEG",
ftk::join(ffmpeg::getVideoCodecStrings(), ", "));
_cmdLine.printStart = ftk::CmdLineFlagOption::create(
_cmdLine.printStart = ftk::CmdLineFlag::create(
std::vector<std::string>{ "-print_start" },
"Print the timeline start time and exit.");
_cmdLine.printDuration = ftk::CmdLineFlagOption::create(
_cmdLine.printDuration = ftk::CmdLineFlag::create(
std::vector<std::string>{ "-print_duration" },
"Print the timeline duration and exit.");
_cmdLine.printRate = ftk::CmdLineFlagOption::create(
_cmdLine.printRate = ftk::CmdLineFlag::create(
std::vector<std::string>{ "-print_rate" },
"Print the timeline frame rate and exit.");
_cmdLine.printSize = ftk::CmdLineFlagOption::create(
_cmdLine.printSize = ftk::CmdLineFlag::create(
std::vector<std::string>{ "-print_size" },
"Print the timeline image size.");
_cmdLine.raw = ftk::CmdLineValueOption<std::string>::create(
_cmdLine.raw = ftk::CmdLineOption<std::string>::create(
std::vector<std::string>{ "-raw" },
"Raw pixel format to send to stdout.",
"",
std::optional<std::string>(),
ftk::join(rawList, ", "));
_cmdLine.y4m = ftk::CmdLineValueOption<std::string>::create(
_cmdLine.y4m = ftk::CmdLineOption<std::string>::create(
std::vector<std::string>{ "-y4m" },
"y4m format to send to stdout.",
"",
std::optional<std::string>(),
ftk::join(y4mList, ", "));
_cmdLine.verbose = ftk::CmdLineFlagOption::create(
_cmdLine.verbose = ftk::CmdLineFlag::create(
std::vector<std::string>{ "-v" },
"Print verbose output.");

Expand Down
22 changes: 11 additions & 11 deletions bin/toucan-render/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace toucan
const std::shared_ptr<ftk::Context>&,
std::vector<std::string>&);

void run() override;
void run();

private:
void _writeRawFrame(const OIIO::ImageBuf&);
Expand All @@ -45,18 +45,18 @@ namespace toucan

struct CmdLine
{
std::shared_ptr<ftk::CmdLineValueArg<std::string> > input;
std::shared_ptr<ftk::CmdLineValueArg<std::string> > output;
std::shared_ptr<ftk::CmdLineArg<std::string> > input;
std::shared_ptr<ftk::CmdLineArg<std::string> > output;
bool outputRaw = false;

std::shared_ptr<ftk::CmdLineValueOption<std::string> > videoCodec;
std::shared_ptr<ftk::CmdLineFlagOption> printStart;
std::shared_ptr<ftk::CmdLineFlagOption> printDuration;
std::shared_ptr<ftk::CmdLineFlagOption> printRate;
std::shared_ptr<ftk::CmdLineFlagOption> printSize;
std::shared_ptr<ftk::CmdLineValueOption<std::string> > raw;
std::shared_ptr<ftk::CmdLineValueOption<std::string> > y4m;
std::shared_ptr<ftk::CmdLineFlagOption> verbose;
std::shared_ptr<ftk::CmdLineOption<std::string> > videoCodec;
std::shared_ptr<ftk::CmdLineFlag> printStart;
std::shared_ptr<ftk::CmdLineFlag> printDuration;
std::shared_ptr<ftk::CmdLineFlag> printRate;
std::shared_ptr<ftk::CmdLineFlag> printSize;
std::shared_ptr<ftk::CmdLineOption<std::string> > raw;
std::shared_ptr<ftk::CmdLineOption<std::string> > y4m;
std::shared_ptr<ftk::CmdLineFlag> verbose;
};
CmdLine _cmdLine;

Expand Down
4 changes: 2 additions & 2 deletions bin/toucan-render/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ int main(int argc, char** argv)
{
auto context = ftk::Context::create();
auto app = App::create(context, args);
if (0 == app->getExit())
if (!app->hasCmdLineHelp())
{
app->run();
}
out = app->getExit();
out = 0;
}
catch (const std::exception& e)
{
Expand Down
4 changes: 2 additions & 2 deletions bin/toucan-view/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ FTK_MAIN()
auto context = ftk::Context::create();
auto args = ftk::convert(argc, argv);
auto app = toucan::App::create(context, args);
if (app->getExit() != 0)
return app->getExit();
if (app->hasCmdLineHelp())
return 0;
app->run();
}
catch (const std::exception& e)
Expand Down
2 changes: 1 addition & 1 deletion cmake/SuperBuild/Buildftk.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include(ExternalProject)

set(ftk_GIT_REPOSITORY "https://github.com/grizzlypeak3d/feather-tk.git")
set(ftk_GIT_TAG "2de0861f19326dab562b189e2988a49304475dc3")
set(ftk_GIT_TAG "d673afdb2d4a29dbfd7c98d5eefc3324b5e90241")

set(ftk_DEPS ZLIB nlohmann_json PNG Freetype lunasvg)

Expand Down
13 changes: 6 additions & 7 deletions lib/toucanResource/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ target_link_libraries(toucanResource)
set_target_properties(toucanResource PROPERTIES FOLDER lib)
set_target_properties(toucanResource PROPERTIES PUBLIC_HEADER "${HEADERS}")

if(BUILD_SHARED_LIBS)
install(
TARGETS toucanResource
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
install(
TARGETS toucanResource
EXPORT toucanRenderTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
22 changes: 8 additions & 14 deletions lib/toucanView/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace toucan
const std::shared_ptr<ftk::Context>& context,
std::vector<std::string>& argv)
{
_input = ftk::CmdLineValueArg<std::string>::create(
_input = ftk::CmdLineArg<std::string>::create(
"input",
"Input timeline.",
true);
Expand All @@ -36,27 +36,26 @@ namespace toucan
argv,
"toucan-view",
"Toucan viewer",
{ _input });
{ _input },
{},
ftk::AppFiles{ "toucan", "toucan-view" });

_settings = ftk::Settings::create(context, ftk::getSettingsPath("toucan", "toucan-view.settings"));

_timeUnitsModel = std::make_shared<TimeUnitsModel>(context, _settings);
_timeUnitsModel = std::make_shared<TimeUnitsModel>(context, getSettings());

_host = std::make_shared<ImageEffectHost>(context, getOpenFXPluginPaths(getExeName()));

auto fileBrowserSystem = context->getSystem<ftk::FileBrowserSystem>();
fileBrowserSystem->setNativeFileDialog(false);

_filesModel = std::make_shared<FilesModel>(context, _settings, _host);
_globalViewModel = std::make_shared<GlobalViewModel>(context, _settings);
_windowModel = std::make_shared<WindowModel>(context, _settings);
_filesModel = std::make_shared<FilesModel>(context, getSettings(), _host);
_globalViewModel = std::make_shared<GlobalViewModel>(context, getSettings());
_windowModel = std::make_shared<WindowModel>(context, getSettings());

_window = MainWindow::create(
context,
std::dynamic_pointer_cast<App>(shared_from_this()),
"toucan-view",
ftk::Size2I(1920, 1080));
addWindow(_window);
_window->show();

if (_input->hasValue())
Expand All @@ -77,11 +76,6 @@ namespace toucan
return out;
}

const std::shared_ptr<ftk::Settings>& App::getSettings() const
{
return _settings;
}

const std::shared_ptr<TimeUnitsModel>& App::getTimeUnitsModel() const
{
return _timeUnitsModel;
Expand Down
6 changes: 1 addition & 5 deletions lib/toucanView/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ namespace toucan
const std::shared_ptr<ftk::Context>&,
std::vector<std::string>&);

//! Get the settings.
const std::shared_ptr<ftk::Settings>& getSettings() const;

//! Get the time units model.
const std::shared_ptr<TimeUnitsModel>& getTimeUnitsModel() const;

Expand All @@ -55,8 +52,7 @@ namespace toucan
void open(const std::filesystem::path&);

private:
std::shared_ptr<ftk::CmdLineValueArg<std::string> > _input;
std::shared_ptr<ftk::Settings> _settings;
std::shared_ptr<ftk::CmdLineArg<std::string> > _input;
std::shared_ptr<TimeUnitsModel> _timeUnitsModel;
std::shared_ptr<ImageEffectHost> _host;
std::shared_ptr<FilesModel> _filesModel;
Expand Down
6 changes: 5 additions & 1 deletion lib/toucanView/AudioClipItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ namespace toucan
_size.displayScale = event.displayScale;
_size.border = event.style->getSizeRole(ftk::SizeRole::Border, event.displayScale);
}
_setSizeHint(_layout->getSizeHint());
}

ftk::Size2I AudioClipItem::getSizeHint() const
{
return _layout->getSizeHint();
}

void AudioClipItem::drawEvent(
Expand Down
1 change: 1 addition & 0 deletions lib/toucanView/AudioClipItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace toucan

void setGeometry(const ftk::Box2I&) override;
ftk::Box2I getChildrenClipRect() const override;
ftk::Size2I getSizeHint() const override;
void sizeHintEvent(const ftk::SizeHintEvent&) override;
void drawEvent(const ftk::Box2I&, const ftk::DrawEvent&) override;

Expand Down
7 changes: 3 additions & 4 deletions lib/toucanView/BackgroundTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace toucan
}
});

_optionsObserver = ftk::ValueObserver<GlobalViewOptions>::create(
_optionsObserver = ftk::Observer<GlobalViewOptions>::create(
_model->observeOptions(),
[this](const GlobalViewOptions& value)
{
Expand Down Expand Up @@ -125,10 +125,9 @@ namespace toucan
_scrollWidget->setGeometry(value);
}

void BackgroundTool::sizeHintEvent(const ftk::SizeHintEvent& event)
ftk::Size2I BackgroundTool::getSizeHint() const
{
IToolWidget::sizeHintEvent(event);
_setSizeHint(_scrollWidget->getSizeHint());
return _scrollWidget->getSizeHint();
}

void BackgroundTool::_widgetUpdate()
Expand Down
4 changes: 2 additions & 2 deletions lib/toucanView/BackgroundTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace toucan
const std::shared_ptr<IWidget>& parent = nullptr);

void setGeometry(const ftk::Box2I&) override;
void sizeHintEvent(const ftk::SizeHintEvent&) override;
ftk::Size2I getSizeHint() const override;

private:
void _widgetUpdate();
Expand All @@ -52,7 +52,7 @@ namespace toucan
std::shared_ptr<ftk::ColorWidget> _checkersColor1Widget;
std::shared_ptr<ftk::IntEditSlider> _checkersSizeSlider;

std::shared_ptr<ftk::ValueObserver<GlobalViewOptions> > _optionsObserver;
std::shared_ptr<ftk::Observer<GlobalViewOptions> > _optionsObserver;
};
}

Loading
Loading