completed color management implementation
This commit adds the background functionality of the render cache invalidating whenever a footage's color space is changed. This includes when the project's configuration is changed as well.
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "imagestream.h"
|
||||
|
||||
#include "footage.h"
|
||||
#include "project/project.h"
|
||||
#include "render/colormanager.h"
|
||||
|
||||
ImageStream::ImageStream() :
|
||||
@@ -69,7 +71,11 @@ void ImageStream::set_premultiplied_alpha(bool e)
|
||||
|
||||
const QString &ImageStream::colorspace()
|
||||
{
|
||||
return colorspace_;
|
||||
if (colorspace_.isEmpty()) {
|
||||
return footage()->project()->default_input_colorspace();
|
||||
} else {
|
||||
return colorspace_;
|
||||
}
|
||||
}
|
||||
|
||||
void ImageStream::set_colorspace(const QString &color)
|
||||
@@ -81,6 +87,15 @@ void ImageStream::set_colorspace(const QString &color)
|
||||
|
||||
void ImageStream::ColorConfigChangedSlot()
|
||||
{
|
||||
// FIXME: Update colorspace correctly
|
||||
colorspace_.clear();
|
||||
// Check if this colorspace is in the new config
|
||||
if (!colorspace_.isEmpty()) {
|
||||
QStringList colorspaces = ColorManager::ListAvailableInputColorspaces(OCIO::GetCurrentConfig());
|
||||
if (!colorspaces.contains(colorspace_)) {
|
||||
// Set to empty if not
|
||||
colorspace_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Either way, the color calculation has likely changed so we signal here
|
||||
emit ColorSpaceChanged();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#include "item.h"
|
||||
|
||||
Item::Item() :
|
||||
parent_(nullptr)
|
||||
parent_(nullptr),
|
||||
project_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -127,6 +128,18 @@ const Item *Item::root() const
|
||||
return item;
|
||||
}
|
||||
|
||||
Project *Item::project() const
|
||||
{
|
||||
const Item* root_item = root();
|
||||
|
||||
return root_item->project_;
|
||||
}
|
||||
|
||||
void Item::set_project(Project *project)
|
||||
{
|
||||
project_ = project;
|
||||
}
|
||||
|
||||
bool Item::CanHaveChildren() const
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#include "common/threadedobject.h"
|
||||
|
||||
class Project;
|
||||
|
||||
class Item;
|
||||
using ItemPtr = std::shared_ptr<Item>;
|
||||
|
||||
@@ -101,6 +103,9 @@ public:
|
||||
Item *parent() const;
|
||||
const Item* root() const;
|
||||
|
||||
Project* project() const;
|
||||
void set_project(Project* project);
|
||||
|
||||
virtual bool CanHaveChildren() const;
|
||||
|
||||
bool ChildExistsWithName(const QString& name);
|
||||
@@ -112,6 +117,8 @@ private:
|
||||
|
||||
Item* parent_;
|
||||
|
||||
Project* project_;
|
||||
|
||||
QString name_;
|
||||
|
||||
QString tooltip_;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
Project::Project()
|
||||
{
|
||||
name_ = tr("(untitled)");
|
||||
root_.set_project(this);
|
||||
}
|
||||
|
||||
Folder *Project::root()
|
||||
|
||||
Reference in New Issue
Block a user