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
9 changes: 1 addition & 8 deletions bin/toucan-filmstrip/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,7 @@ namespace toucan
const IMATH_NAMESPACE::V2d imageSize = _graph->getImageSize();

// Create the image host.
std::vector<std::filesystem::path> searchPath;
searchPath.push_back(parentPath);
#if defined(_WINDOWS)
searchPath.push_back(parentPath / ".." / ".." / "..");
#else // _WINDOWS
searchPath.push_back(parentPath / ".." / "..");
#endif // _WINDOWS
_host = std::make_shared<ImageEffectHost>(_context, searchPath);
_host = std::make_shared<ImageEffectHost>(_context, getOpenFXPluginPaths(getExeName()));

// Initialize the filmstrip.
OIIO::ImageBuf filmstripBuf;
Expand Down
9 changes: 1 addition & 8 deletions bin/toucan-render/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,7 @@ namespace toucan
}

// Create the image host.
std::vector<std::filesystem::path> searchPath;
searchPath.push_back(parentPath);
#if defined(_WINDOWS)
searchPath.push_back(parentPath / ".." / ".." / "..");
#else // _WINDOWS
searchPath.push_back(parentPath / ".." / "..");
#endif // _WINDOWS
_host = std::make_shared<ImageEffectHost>(_context, searchPath);
_host = std::make_shared<ImageEffectHost>(_context, getOpenFXPluginPaths(getExeName()));

// Open the movie file.
std::shared_ptr<ffmpeg::Write> ffWrite;
Expand Down
3 changes: 1 addition & 2 deletions lib/toucanRender/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ namespace toucan
const std::filesystem::path& path,
std::vector<std::filesystem::path>& out)
{
_findPlugins(path, out, 0, 2);
_findPlugins(path, out, 0, 10);
}

}
48 changes: 48 additions & 0 deletions lib/toucanRender/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,52 @@ namespace toucan
out.w = std::any_cast<double>(any[3]);
}
}

std::vector<std::filesystem::path> getOpenFXPluginPaths(
const std::filesystem::path& executablePath)
{
const std::filesystem::path parentPath = executablePath.parent_path();
std::vector<std::filesystem::path> searchPath;

// Add executable directory and relative paths
searchPath.push_back(parentPath);
#if defined(_WINDOWS)
searchPath.push_back(parentPath / ".." / ".." / "..");
// Add standard Windows OpenFX plugin path
searchPath.push_back("C:\\Program Files\\Common Files\\OFX\\Plugins");
#else // _WINDOWS
searchPath.push_back(parentPath / ".." / "..");
#if defined(__APPLE__)
// Add standard macOS OpenFX plugin path
searchPath.push_back("/Library/OFX/Plugins");
#else
// Add standard Linux/Unix OpenFX plugin path
searchPath.push_back("/usr/OFX/Plugins");
#endif // __APPLE__
#endif // _WINDOWS

// Add paths from environment variable OFX_PLUGIN_PATH if it exists
if (const char* envPath = std::getenv("OFX_PLUGIN_PATH")) {
#if defined(_WINDOWS)
const char delimiter = ';';
#else
const char delimiter = ':';
#endif
std::string envPathStr(envPath);
size_t pos = 0;
std::string token;
while ((pos = envPathStr.find(delimiter)) != std::string::npos) {
token = envPathStr.substr(0, pos);
if (!token.empty()) {
searchPath.push_back(token);
}
envPathStr.erase(0, pos + 1);
}
if (!envPathStr.empty()) {
searchPath.push_back(envPathStr);
}
}

return searchPath;
}
}
6 changes: 6 additions & 0 deletions lib/toucanRender/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,10 @@ namespace toucan
//! Conversion from any vector.
void anyToVec(const OTIO_NS::AnyVector&, IMATH_NAMESPACE::V2i&);
void anyToVec(const OTIO_NS::AnyVector&, IMATH_NAMESPACE::V4f&);

//! Get standard OpenFX plugin search paths.
//! Includes executable directory, standard OS-specific plugin directories,
//! and paths from the OFX_PLUGIN_PATH environment variable.
std::vector<std::filesystem::path> getOpenFXPluginPaths(
const std::filesystem::path& executablePath);
}
12 changes: 3 additions & 9 deletions lib/toucanView/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "ViewModel.h"
#include "WindowModel.h"

#include <toucanRender/Util.h>

#include <dtk/ui/DialogSystem.h>
#include <dtk/ui/FileBrowser.h>
#include <dtk/ui/MessageDialog.h>
Expand Down Expand Up @@ -41,15 +43,7 @@ namespace toucan

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

std::vector<std::filesystem::path> searchPath;
const std::filesystem::path parentPath = std::filesystem::path(argv[0]).parent_path();
searchPath.push_back(parentPath);
#if defined(_WINDOWS)
searchPath.push_back(parentPath / ".." / ".." / "..");
#else // _WINDOWS
searchPath.push_back(parentPath / ".." / "..");
#endif // _WINDOWS
_host = std::make_shared<ImageEffectHost>(context, searchPath);
_host = std::make_shared<ImageEffectHost>(context, getOpenFXPluginPaths(getExeName()));

auto fileBrowserSystem = context->getSystem<dtk::FileBrowserSystem>();
fileBrowserSystem->setNativeFileDialog(false);
Expand Down
12 changes: 3 additions & 9 deletions tests/toucan-test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <toucanRenderTest/PropertySetTest.h>
#include <toucanRenderTest/ReadTest.h>

#include <toucanRender/Util.h>

#if defined(toucan_VIEW)
#include <dtk/ui/Init.h>
#endif // toucan_VIEW
Expand All @@ -31,7 +33,6 @@ int main(int argc, char** argv)
std::cout << "Usage: toucan-test (path to test data)" << std::endl;
return 1;
}
const std::filesystem::path parentPath = std::filesystem::path(argv[0]).parent_path();
const std::filesystem::path path(argv[1]);

auto context = dtk::Context::create();
Expand All @@ -40,14 +41,7 @@ int main(int argc, char** argv)
dtk::uiInit(context);
#endif // toucan_VIEW

std::vector<std::filesystem::path> searchPath;
searchPath.push_back(parentPath);
#if defined(_WINDOWS)
searchPath.push_back(parentPath / ".." / ".." / "..");
#else // _WINDOWS
searchPath.push_back(parentPath / ".." / "..");
#endif // _WINDOWS
auto host = std::make_shared<ImageEffectHost>(context, searchPath);
auto host = std::make_shared<ImageEffectHost>(context, getOpenFXPluginPaths(argv[0]));

compTest(path);
propertySetTest();
Expand Down