Commit 9ed934a8 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Add OCIO Look support.

The code is based of that of Blender, as I couldn't figure out how else to
apply looks. The OCIO api wasn't clear about it, nor could I find much information,
but it somewhat works and doesn't crash.

Auditors: rempt, dkazakov
Ref: T210
parent 2819ad66
......@@ -164,6 +164,7 @@ LutDockerDock::LutDockerDock()
connect(m_cmbInputColorSpace, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings()));
connect(m_cmbDisplayDevice, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings()));
connect(m_cmbView, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings()));
connect(m_cmbLook, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings()));
connect(m_cmbComponents, SIGNAL(currentIndexChanged(int)), SLOT(updateDisplaySettings()));
m_draggingSlider = false;
......@@ -357,6 +358,8 @@ void LutDockerDock::enableControls()
m_cmbDisplayDevice->setEnabled(ocioEnabled && externalColorManagementEnabled);
m_lblView->setEnabled(ocioEnabled && externalColorManagementEnabled);
m_cmbView->setEnabled(ocioEnabled && externalColorManagementEnabled);
m_lblLook->setEnabled(ocioEnabled && externalColorManagementEnabled);
m_cmbLook->setEnabled(ocioEnabled && externalColorManagementEnabled);
bool enableConfigPath = m_colorManagement->currentIndex() == (int) KisConfig::OCIO_CONFIG;
......@@ -379,6 +382,7 @@ void LutDockerDock::updateDisplaySettings()
m_displayFilter->inputColorSpaceName = m_ocioConfig->getColorSpaceNameByIndex(m_cmbInputColorSpace->currentIndex());
m_displayFilter->displayDevice = m_ocioConfig->getDisplay(m_cmbDisplayDevice->currentIndex());
m_displayFilter->view = m_ocioConfig->getView(m_displayFilter->displayDevice, m_cmbView->currentIndex());
m_displayFilter->look = m_ocioConfig->getLookNameByIndex(m_cmbLook->currentIndex());
m_displayFilter->gamma = m_gammaDoubleWidget->value();
m_displayFilter->exposure = m_exposureDoubleWidget->value();
m_displayFilter->swizzle = (OCIO_CHANNEL_SWIZZLE)m_cmbComponents->currentIndex();
......@@ -531,6 +535,16 @@ void LutDockerDock::refillControls()
}
refillViewCombobox();
{
KisSignalsBlocker LookComboLocker(m_cmbLook);
m_cmbLook->clear();
int numLooks = m_ocioConfig->getNumLooks();
for (int k = 0; k < numLooks; k++) {
m_cmbLook->addSqueezedItem(QString::fromUtf8(m_ocioConfig->getLookNameByIndex(k)));
}
m_cmbLook->addSqueezedItem(i18nc("Item to indicate no look transform being selected","None"));
}
updateDisplaySettings();
}
......
......@@ -39,6 +39,7 @@ OcioDisplayFilter::OcioDisplayFilter(KisExposureGammaCorrectionInterface *interf
, inputColorSpaceName(0)
, displayDevice(0)
, view(0)
, look(0)
, swizzle(RGBA)
, m_interface(interface)
, m_lut3dTexID(0)
......@@ -124,12 +125,25 @@ void OcioDisplayFilter::updateProcessor()
if (!inputColorSpaceName) {
inputColorSpaceName = config->getColorSpaceNameByIndex(0);
}
if (!look) {
look = config->getColorSpaceNameByIndex(0);
}
if (!displayDevice || !view || !inputColorSpaceName) {
return;
}
OCIO::DisplayTransformRcPtr transform = OCIO::DisplayTransform::Create();
transform->setInputColorSpaceName(inputColorSpaceName);
transform->setDisplay(displayDevice);
transform->setView(view);
//Add looks, no idea if this is working right...
if (config->getLook(look)) {
transform->setLooksOverride(look);
transform->setLooksOverrideEnabled(true);
}
OCIO::GroupTransformRcPtr approximateTransform = OCIO::GroupTransform::Create();
// fstop exposure control -- not sure how that translates to our exposure
......
......@@ -64,6 +64,7 @@ public:
const char *inputColorSpaceName;
const char *displayDevice;
const char *view;
const char *look;
OCIO_CHANNEL_SWIZZLE swizzle;
float exposure;
float gamma;
......
......@@ -2,6 +2,14 @@
<ui version="4.0">
<class>WdgLut</class>
<widget class="QWidget" name="WdgLut">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>357</width>
<height>286</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
<property name="spacing">
<number>0</number>
......@@ -88,7 +96,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Components:</string>
......@@ -121,7 +129,7 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Exposure:</string>
......@@ -147,8 +155,8 @@
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="KisDoubleWidget" name="m_exposureDoubleWidget">
<item row="8" column="1">
<widget class="KisDoubleWidget" name="m_exposureDoubleWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -232,7 +240,7 @@
</item>
</layout>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="SqueezedComboBox" name="m_cmbComponents">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
......@@ -242,8 +250,8 @@
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="KisDoubleWidget" name="m_gammaDoubleWidget">
<item row="9" column="1">
<widget class="KisDoubleWidget" name="m_gammaDoubleWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -252,7 +260,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Gamma:</string>
......@@ -310,6 +318,23 @@
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="m_lblLook">
<property name="text">
<string>Look:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="SqueezedComboBox" name="m_cmbLook">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -328,6 +353,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment