ColorManager is now specific to the Project

OCIO config was set on a per-project basis, but we were using a singleton for
the ColorManager that would break if more than one project was ever open.
Now the ColorManager belongs to the Project and is always accessed through the
Project.
This commit is contained in:
itsmattkc
2019-12-17 15:18:07 +11:00
parent e1b8fd6352
commit a0b6bb842d
23 changed files with 187 additions and 245 deletions
@@ -34,14 +34,14 @@ void OpenGLColorProcessor::ProcessOpenGL()
olive::gl::OCIOBlit(pipeline_, ocio_lut_);
}
OpenGLColorProcessor::OpenGLColorProcessor(const QString &source_space, const QString &dest_space) :
ColorProcessor(source_space, dest_space),
OpenGLColorProcessor::OpenGLColorProcessor(OCIO::ConstConfigRcPtr config, const QString &source_space, const QString &dest_space) :
ColorProcessor(config, source_space, dest_space),
ocio_lut_(0)
{
}
OpenGLColorProcessor::OpenGLColorProcessor(const QString &source_space, QString display, QString view, const QString &look) :
ColorProcessor(source_space, display, view, look),
OpenGLColorProcessor::OpenGLColorProcessor(OCIO::ConstConfigRcPtr config, const QString &source_space, QString display, QString view, const QString &look) :
ColorProcessor(config, source_space, display, view, look),
ocio_lut_(0)
{
}
@@ -55,12 +55,12 @@ OpenGLColorProcessor::~OpenGLColorProcessor()
}
}
OpenGLColorProcessorPtr OpenGLColorProcessor::CreateOpenGL(const QString &source_space, const QString &dest_space)
OpenGLColorProcessorPtr OpenGLColorProcessor::CreateOpenGL(OCIO::ConstConfigRcPtr config, const QString &source_space, const QString &dest_space)
{
return std::make_shared<OpenGLColorProcessor>(source_space, dest_space);
return std::make_shared<OpenGLColorProcessor>(config, source_space, dest_space);
}
OpenGLColorProcessorPtr OpenGLColorProcessor::CreateOpenGL(const QString &source_space, const QString &display, const QString &view, const QString &look)
OpenGLColorProcessorPtr OpenGLColorProcessor::CreateOpenGL(OCIO::ConstConfigRcPtr config, const QString &source_space, const QString &display, const QString &view, const QString &look)
{
return std::make_shared<OpenGLColorProcessor>(source_space, display, view, look);
return std::make_shared<OpenGLColorProcessor>(config, source_space, display, view, look);
}
@@ -10,18 +10,20 @@ using OpenGLColorProcessorPtr = std::shared_ptr<OpenGLColorProcessor>;
class OpenGLColorProcessor : public ColorProcessor
{
public:
OpenGLColorProcessor(const QString &source_space, const QString &dest_space);
OpenGLColorProcessor(OCIO::ConstConfigRcPtr config, const QString &source_space, const QString &dest_space);
OpenGLColorProcessor(const QString& source_space,
OpenGLColorProcessor(OCIO::ConstConfigRcPtr config,
const QString& source_space,
QString display,
QString view,
const QString& look);
~OpenGLColorProcessor();
static OpenGLColorProcessorPtr CreateOpenGL(const QString& source_space, const QString& dest_space);
static OpenGLColorProcessorPtr CreateOpenGL(OCIO::ConstConfigRcPtr config, const QString& source_space, const QString& dest_space);
static OpenGLColorProcessorPtr CreateOpenGL(const QString& source_space,
static OpenGLColorProcessorPtr CreateOpenGL(OCIO::ConstConfigRcPtr config,
const QString& source_space,
const QString& display,
const QString& view,
const QString& look);
+3 -1
View File
@@ -66,7 +66,9 @@ void OpenGLWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable
OpenGLColorProcessorPtr color_processor = std::static_pointer_cast<OpenGLColorProcessor>(color_cache()->Get(video_stream->colorspace()));
if (!color_processor) {
color_processor = OpenGLColorProcessor::CreateOpenGL(video_stream->colorspace(),
// FIXME: We match with the colorspace string, but this won't change if the user sets a new config with a colorspace with the same string
color_processor = OpenGLColorProcessor::CreateOpenGL(video_stream->footage()->project()->color_manager()->GetConfig(),
video_stream->colorspace(),
OCIO::ROLE_SCENE_LINEAR);
color_cache()->Add(video_stream->colorspace(), color_processor);
}