|
1 | 1 | // SPDX-License-Identifier: Apache-2.0 |
2 | 2 | #include "ocio_engine.hpp" |
3 | 3 |
|
| 4 | +#include "xstudio/utility/helpers.hpp" |
4 | 5 | #include "xstudio/utility/string_helpers.hpp" |
5 | 6 | #include "xstudio/ui/opengl/shader_program_base.hpp" |
6 | 7 | #include "xstudio/thumbnail/thumbnail.hpp" |
@@ -328,7 +329,8 @@ OCIO::ConstConfigRcPtr |
328 | 329 | OCIOEngine::get_ocio_config(const utility::JsonStore &src_colour_mgmt_metadata) const { |
329 | 330 |
|
330 | 331 | const std::string config_name = |
331 | | - src_colour_mgmt_metadata.get_or("ocio_config", default_config_); |
| 332 | + utility::forward_remap_file_path( |
| 333 | + src_colour_mgmt_metadata.get_or("ocio_config", default_config_)); |
332 | 334 | const std::string displays = |
333 | 335 | src_colour_mgmt_metadata.get_or("active_displays", std::string("")); |
334 | 336 | const std::string views = src_colour_mgmt_metadata.get_or("active_views", std::string("")); |
@@ -378,17 +380,27 @@ OCIOEngine::get_ocio_config(const utility::JsonStore &src_colour_mgmt_metadata) |
378 | 380 | econfig->setActiveDisplays(displays.c_str()); |
379 | 381 | if (!views.empty()) |
380 | 382 | econfig->setActiveViews(views.c_str()); |
| 383 | + |
| 384 | + econfig->clearSearchPaths(); |
| 385 | + for (int i = 0; i < config->getNumSearchPaths(); ++i) { |
| 386 | + auto path = std::string(config->getSearchPath(i)); |
| 387 | + auto newpath = utility::forward_remap_file_path(path); |
| 388 | + econfig->addSearchPath(newpath.c_str()); |
| 389 | + } |
| 390 | + |
381 | 391 | config = econfig; |
382 | 392 | ocio_config_cache_[concat] = config; |
383 | 393 |
|
384 | 394 | return config; |
385 | 395 | } |
386 | 396 |
|
387 | | -const char * |
| 397 | +std::string |
388 | 398 | OCIOEngine::working_space(const utility::JsonStore &src_colour_mgmt_metadata) const { |
389 | 399 | auto config = get_ocio_config(src_colour_mgmt_metadata); |
390 | 400 | if (not config) { |
391 | 401 | return ""; |
| 402 | + } else if (src_colour_mgmt_metadata.contains("working_space")) { |
| 403 | + return src_colour_mgmt_metadata["working_space"].get<std::string>(); |
392 | 404 | } else if (config->hasRole(OCIO::ROLE_SCENE_LINEAR)) { |
393 | 405 | return OCIO::ROLE_SCENE_LINEAR; |
394 | 406 | } else { |
@@ -545,7 +557,7 @@ OCIO::TransformRcPtr OCIOEngine::display_transform( |
545 | 557 | } |
546 | 558 |
|
547 | 559 | OCIO::DisplayViewTransformRcPtr dt = OCIO::DisplayViewTransform::Create(); |
548 | | - dt->setSrc(working_space(src_colour_mgmt_metadata)); |
| 560 | + dt->setSrc(working_space(src_colour_mgmt_metadata).c_str()); |
549 | 561 | dt->setDisplay(_display.c_str()); |
550 | 562 | dt->setView(_view.c_str()); |
551 | 563 | dt->setDirection(OCIO::TRANSFORM_DIR_FORWARD); |
|
0 commit comments